extjs 4.1 我什么时候在商店和模型上使用代理?

标签 extjs extjs4.1

在 extjs 4.1 中使用代理有两种方法(在我的例子中是服务器代理),一种可以将其绑定(bind)到模型或将其绑定(bind)到商店。

我对用法有点困惑:将代理绑定(bind)到商店和将其绑定(bind)到模型有什么区别?

什么情况下会使用一种方式或另一种方式?

最佳答案

好的,我在 sencha App Architecture Part 2 的文档中找到了它

为模型使用代理:

It is generally good practice to do this as it allows you to load and save instances of this model without needing a store. Also, when multiple stores use this same model, you don’t have to redefine your proxy on each one of them.



使用商店代理:

In Ext JS 4, multiple stores can use the same data model, even if the stores will load their data from different sources. In our example, the Station model will be used by the SearchResults and the Stations store, both loading the data from a different location. One returns search results, the other returns the user’s favorite stations. To achieve this, one of our stores will need to override the proxy defined on the model.

关于extjs 4.1 我什么时候在商店和模型上使用代理?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11965488/

相关文章:

extjs - Ext.getCmp 在 extjs 中不工作

javascript - 向显示字段添加点击事件

javascript - 使用 Ext.grid.Panel.reconfigure() 打破网格 RowEditing 插件

forms - 将字段标记为无效

javascript - "sencha app watch"到底在做什么?

sencha-touch - Sencha Cmd V3 测试版

javascript - ExtJS 自动调整大小选项卡面板

extjs - 如何在 Extjs 4.1 中使用 treecombo

extjs - Date Format In Extjs 3.4 不渲染显示

Extjs 4.1 - 多选和上传文件