最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - ExtJs Store.Load() vs Model.Load() - Stack Overflow

programmeradmin3浏览0评论

What is the difference between store.load() vs model.load()? One uses callback, the other uses success/failure, with slightly different function signatures.

Other than that, is there any main difference to use store.load(), OR not use it and just directly call model.load()? Difference when loading nested models with relationships?

What is the difference between store.load() vs model.load()? One uses callback, the other uses success/failure, with slightly different function signatures.

Other than that, is there any main difference to use store.load(), OR not use it and just directly call model.load()? Difference when loading nested models with relationships?

Share Improve this question asked Apr 30, 2013 at 7:45 TomTom 16.3k15 gold badges75 silver badges115 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

If you look at "Usage in Stores" section of Ext.data.Model documentation you'll find these two sentences:

A Store is just a collection of Model instances - usually loaded from a server somewhere. Store can also maintain a set of added, updated and removed Model instances to be synchronized with the server via the Proxy.

and

It is very mon to want to load a set of Model instances to be displayed and manipulated in the UI

So this means that store is typically used as a collection (or I would call it a repository) of many model instances that syncs data with defined backhand and maintains a list of model instances that can be filtered, queried etc.

On the other hand Ext.data.Model.load method only loads one instance data by specific model id.

Based on this I would say that difference between Ext.data.Model.load and Ext.data.Store.load is in amount of data you want to load (one or many model instances).

发布评论

评论列表(0)

  1. 暂无评论