0
我在ExtJS的在模型中的字段可以是一個組合框 - ExtJS的4
定義城市的這種模式Ext.define('Packt.model.staticData.City', {
extend : 'Packt.model.sakila.Sakila',
idProperty : 'city_id',
fields : [{
name : 'city_id'
}, {
name : 'city'
}/*, { //doesn't work
//name : 'country_id',
xtype: 'combobox',
store: Ext.getStore('countries'),
fieldLabel: 'Choose Country',
//queryMode: 'local',
displayField: 'country',
valueField: 'country_id',
}*/],
associations : [{
type : 'belongsTo',
model : 'Country',
primaryKey : 'city_id',
foreignKey : 'country_id'
}]
});
是否有可能在一個模型來創建一個組合框,像在上述評論的代碼?
我想在我的網格中創建行,並且希望國家/地區列出組合框中列出的國家/地區。 StaticData列表的每個菜單項都使用不同的數據/存儲/模型加載相同的Ext.ux.LiveSearchGridPanel。
當我點擊添加按鈕,這是發生了什麼:
onButtonClickAdd : function(button, e, options) {
var grid = button.up('staticdatagrid'),
store = grid.getStore(),
modelName = store.getProxy().getModel().modelName,
cellEditing = grid.getPlugin('cellplugin');
store.insert(0, Ext.create(modelName, {
last_update : new Date()
}));
/*
cellEditing.startEditByPostion({
row : 0,
column : 1
});
*/
},
是的,我只是在文檔中發現,在模型字段的類型是Ext.data.field – Vlad
尼斯。然而,我面臨的問題是這樣的:我有一個類型爲Ext.ux.LiveSearchGridPanel的AbstractGrid。我正在嘗試重新使用代碼,以便不同的菜單項根據選定的菜單項/ aka模型加載具有不同數據/商店的同一網格。檢查上面的圖像。 – Vlad