gpt4 book ai didi

javascript - 从 JSON Store 的子集创建 Store

转载 作者:行者123 更新时间:2023-12-02 03:27:05 35 4
gpt4 key购买 nike

我有一个 JSON 存储,定义如下

var subAccountStore = new Ext.data.JsonStore({
autoLoad: true,
proxy: {
type:'ajax',
url : '/opUI/json/subaccount.action?name="ABC"'
},
fields: ['accountName', 'quantity','accountNumbers'],
listeners: {
load: function(store, records, success) {
// ???????
},
single: true
}
});

示例数据为

[{"accountName":"'ABC'","quantity":100,"accountNumbers":['12345A','12345B','12345C']},{"accountName":"'XYZ'","quantity":100,"accountNumbers":['99999A','99999B','99999C']}]

如何为 accountNumbers 动态创建商店并分配给网格内的组合框?

谢谢塔拉罕

最佳答案

对于帐号,您必须单独声明商店。例如,在面板项目中

items: [{
xtype: 'combobox',
id: 'addObjectComboCopy',
fieldLabel: '<h style= "color:red;">*</h> accountNumbers',
store: addFormStore,
displayField: 'select',
valueField: 'name',
editable: false,
allowBlank: false

}]

此处 Store 必须声明如下所示

var addFormStore = Ext.create('Ext.data.Store', {
fields: ['name', 'select'],
data: [
{"name": "01", "select": "12345A"},
{"name": "02", "select": "12345B"},
{"name": "03", "select": "12345C"}
]

});

关于javascript - 从 JSON Store 的子集创建 Store,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14445783/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com