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