0
我正在使用带有JsonReader的DataStore来填充ComboBox,但正确的值没有被标记为选中。在ExtJS的ComboBox中设置服务器中的值
组合框:
{
fieldLabel: 'Business Unit',
xtype:'combo',
width:167,
name: 'business_Unit',
hiddenName: 'businessUnit',
store: businessUnitStore,
displayField: 'buName',
valueField: 'buId',
mode: 'remote',
triggerAction: 'all',
typeAhead: false,
editable: false
}
和我在的形式使用JsonReader。
var leadReader = new Ext.data.JsonReader({
root: 'data',
totalProperty: 'total',
id: 'leadId'
}, [
{name:'title', type: 'string'},
{name:'firstName', type: 'string'},
{name:'lastName', type: 'string'},
{name:'designation', type: 'string'},
{name:'business_Unit', type: 'string', mapping: 'businessUnit.buName'},
]);
这是JSON响应:
{"data":{"leadId":22,"firstName":"fname","lastName":"lname","designation":"President","businessUnit":{"buId":4,"buName":"US","buDescription":""}},"success":true}
我想BusinessUnit美国在下拉列表中选择,也都可以在组合选择其他选项当我加载形式=。
editForm.getForm().load({url:fetchUrl, method: 'GET'});
一切工作正常,除了没有在组合中选择BusinessUnit = US。
请格式化您的代码... – 2011-03-22 12:17:56