extjs combo中给Store插入一条数据

 

{
xtype: 'combo',
columnWidth: .55,
name: 'AQLLevel',
store: Ext.create('Scripts.Code.Common.store.InspLevelSwitchingStore'),
editable: false,
queryMode: 'local',
matchFieldWidth: false,
listConfig: { width: 200 },
valueField: 'COMM_CODE',
displayField: 'COMM_CODE_NM',
listeners:
{
render: function (com) {
var store = com.getStore();
store.load({
callback: function () {
var data = [{ COMM_CODE: '', COMM_CODE_NM: 'ALL' }];
if (store.data.items.length > 0) {
if (store.getAt(0).data.COMM_CODE_NM != 'ALL') {
store.insert(0, data);
}
} else {
store.insert(0, data);
};
com.select(store.data.items[0]);
}
});
},
expand: function (field, eOpts) {
var store = field.getStore();
var data = [{ COMM_CODE: '', COMM_CODE_NM: 'ALL' }];
if (store.data.items.length > 0) {
if (store.getAt(0).data.COMM_CODE_NM != 'ALL') {
store.insert(0, data);
}
} else {
store.insert(0, data);
};
}
}//end listeners
}

 

posted on 2017-08-19 10:35  在delphi路上  阅读(519)  评论(0编辑  收藏  举报