我有一个组合框,我正在从控制器加载它(下面的代码片段)
Ext.getCmp("combovalue2").getStore().loadRawData(value2);
value2
是我从模型中获得的对象,它工作成功(我验证了组合框的这个 onclick)。下面是我的表单面板中组合框的代码片段
{
xtype:'combo',
id:"combovalue2",
name: 'cpa',
cls:'extraComboBox',
forceSelection: true,
queryMode: 'local',
fieldLabel: 'Alliance',
displayField: 'label',
valueField: 'numAe',
emptyText: 'select Alliance',
store: new Ext.data.JsonStore({fields: ["numAe","label"]})
}
这就是我的 json 的样子
"cpaList": [
{
"label": "A Communications ",
"id": "USF ",
"numOff": 999,
"numAe": 483,
"pctFeeCalc": 0,
"pctFeeBasisPoint": 0
},
{
"label": "Ac Neilson, Inc ",
"id": "MMV ",
"numOff": 999,
"numAe": 876,
"pctFeeCalc": 20,
"pctFeeBasisPoint": 0
},
{
"label": "Acer Worldwide Inc. ",
"id": "CAA ",
"numOff": 999,
"numAe": 619,
"pctFeeCalc": 0,
"pctFeeBasisPoint": 0
},
{
"label": "Advantech, Inc. ",
"id": "SLE ",
"numOff": 999,
"numAe": 592,
"pctFeeCalc": 0,
"pctFeeBasisPoint": 0
},
{
"label": "Afo Ltd ",
"id": "NAN ",
"numOff": 999,
"numAe": 959,
"pctFeeCalc": 25,
"pctFeeBasisPoint": 0
},
{
"label": "All Systems Go ",
"id": "BCS ",
"numOff": 999,
"numAe": 944,
"pctFeeCalc": 25,
"pctFeeBasisPoint": 0
},
{
"label": "Alyssa Anne Lock ",
"id": "GRE ",
"numOff": 999,
"numAe": 369,
"pctFeeCalc": 20,
"pctFeeBasisPoint": 0
}
]
模型
{name: 'cpa', mapping: 'cpaList'}
但是我很难显示在呈现组合框时应该显示的值。我想为来自 json 的组合框设置值(这意味着 value2 是一个对象数组,我要设置的是一个字符串),同时还在我正在做的组合框中显示数据数组通过loadRawData(value2)
.