模型中的字段是否可以是组合框-extjs4
我在ExtJS中定义了这个城市模型模型中的字段是否可以是组合框-extjs4,extjs,combobox,extjs4,extjs4.2,Extjs,Combobox,Extjs4,Extjs4.2,我在ExtJS中定义了这个城市模型 Ext.define('Packt.model.staticData.City', { extend : 'Packt.model.sakila.Sakila', idProperty : 'city_id', fields : [{ name : 'city_id' }, { name : 'city' }/*, { //doesn't work //name : '
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.fieldNice。然而,我面临的问题是:我有一个Ext.ux.LiveSearchGridPanel类型的AbstractGrid。我正在尝试重用代码,以便不同的菜单项根据所选菜单项/aka模型使用不同的数据/存储加载相同的网格。检查上面的图片。
cellEditing = new Ext.grid.plugin.CellEditing({
clicksToEdit: 1
});
Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
plugins: [cellEditing],
columns: [{
text: 'Name',
dataIndex: 'name'
}, {
text: 'Countries',
dataIndex: 'country',
editor: new Ext.form.field.ComboBox({
typeAhead: true,
selectOnTab: true,
store: countryStore,
})
})
}],
height: 200,
width: 400,
renderTo: Ext.getBody()
})]