【发布时间】:2016-10-11 16:02:28
【问题描述】:
在我们的应用程序中,我们有很多名称/值存储,它们在加载时创建并像这样放入 JSONStore 中:
Ext.create("Ext.data.JsonStore", {
data: data,
model: 'EM.model.controlUnit.CodeList',
storeId: "cl_" + tableId,
sorters: [{
sorterFn: aSorterFunction
}],
});
模型非常简单,看起来像这样:
Ext.define('EM.model.controlUnit.CodeList', {
extend: 'Ext.data.Model',
fields: [{
name: 'value', type: 'int'
}, {
name: 'label', type: 'string'
}, {
name: 'description', type: 'string'
}]
});
我认为商店是可以互换的,所以我决定在组合中使用商店(没有特殊的组合商店,所以我认为 JSONStore 必须与 SimpleStore 一样好)。我得到了这样的商店:
var msDataStore = Ext.getStore("cl_t_cl_maritalstatus");
然后像这样使用商店:
{
xtype: 'combo',
fieldLabel: 'Marital Status',
displayField: "label",
valueField: "value",
store: msDataStore
}
当我运行应用程序时,组合中填充了来自商店的值,但是,当我弹出组合框时,会抛出此错误:
ext-debug-w-cmets.js:9951 未捕获 Ext.data.proxy.Server.buildUrl():您正在使用 ServerProxy 但有 没有提供网址。
我不想要任何服务器代理。这些是简单的本地存储名称值集合。
- JSONStore 可以与组合一起使用吗?
- 如果没有。将 JSONStore 转换为组合可接受的东西的最佳方法是什么。我可以切碎、更改、重组存储对象。但我只是想知道在进行某种漫长而毫无意义的旅程之前,我是否可以做一些更简单的事情。
【问题讨论】: