1
我正在嘗試創建級聯組合框,但我無法填充第二個組合框。Ext JS Cascading Combobox
目前,我已經是這樣的:
var comboStore = null;
comboStore = Ext.create('Ext.data.Store', {
fields: ['ID', 'Name', 'isChecked'],
data: field.values
});
console.log(comboStore);
var comboboxField = Ext.create('SGS.view.field.ComboBox', {
listeners: {
select: function (combo, record, index) {
var tablescomboStore = null;
Ext.Ajax.request({
url: 'Services/DBSourceService.ashx',
method: 'GET',
params: {
id: combo.value
},
reader: {
type: 'json',
rootProperty: 'data', successProperty: 'success'
//root: 'items'
},
success : function(response, opts)
{
var tablescomboStore = null;
tablesComboStore = Ext.create('Ext.data.Store', {
response: ['ID', 'Name', 'isChecked'],
data: response.values
});
var tablesComboboxField = Ext.create('SGS.view.field.ComboBox', {
cls: 'ACombo3',
labelSeparator: '',
labelWidth: 110,
width: 400,
fieldLabel: response.name,
name: response.propName,
displayField: 'Name',
valueField: 'ID',
forceSelection: true,
editable: false,
store: tablesComboStore
});
if (tablesComboStore != null) {
var selected = null;
Ext.each(tablesComboStore.data.items, function (item) {
if (item.data.Checked) { selected = item; }
});
if (selected) tablesComboboxField.select(selected);
}
tablesComboboxField.addListener('select', checkDirty);
instance.add(tablesComboboxField);
},
});
}
},
cls: 'ACombo2',
labelSeparator: '',
labelWidth: 110,
width: 400,
fieldLabel: field.name,
name: field.propName,
displayField: 'Name',
valueField: 'ID',
forceSelection: true,
editable: false,
store: comboStore
});
if (comboStore != null) {
var selected = null;
Ext.each(comboStore.data.items, function (item) {
if (item.data.Checked) { selected = item; }
});
if (selected) comboboxField.select(selected);
}
comboboxField.addListener('select', checkDirty);
instance.add(comboboxField);
我第一次收到一個JSON我把在商店建立某種形式的領域,如名稱,值和組合框。我想在第一個組合框選擇後收到第二個Json來填充我的第二個組合框。
第二個組合框正在創建,但沒有數據。
它的工作,終於來了!謝謝 – dex90 2014-10-02 15:55:53