Javascript ExtJS组合框错误:无法读取属性';商店';未定义的
我有一个选项卡面板,有几个选项卡。其中一个包含网格,网格包含3个ITME: 1项编辑器类型为“textfield”,2项编辑器类型为“combobox” 问题:我想根据前面的组合框筛选组合框存储。但由于某些原因,它只在第一次起作用。之后,存储返回undefined 这是我的密码:Javascript ExtJS组合框错误:无法读取属性';商店';未定义的,javascript,extjs,combobox,filtering,store,Javascript,Extjs,Combobox,Filtering,Store,我有一个选项卡面板,有几个选项卡。其中一个包含网格,网格包含3个ITME: 1项编辑器类型为“textfield”,2项编辑器类型为“combobox” 问题:我想根据前面的组合框筛选组合框存储。但由于某些原因,它只在第一次起作用。之后,存储返回undefined 这是我的密码: items:[{ xtype: 'grid', id:'schema', border: false, data:[], columns: [{
items:[{
xtype: 'grid',
id:'schema',
border: false,
data:[],
columns:
[{
text : 'Size',
dataIndex: 'size',
id: "SizeDropdown",
width : 200,
sortable : true,
editor : {
xtype: 'combobox',
id:'SelectSize',
editable:true,
valueField: 'typeValue',
displayField: 'typeValue',
mode:'local',
lastQuery: '',
listeners:{
},
store: new Ext.data.SimpleStore({
fields: ['size', 'typeValue'],
data: [
['char', '12'],
['char', '30'],
['char', '31'],
['int', '250'],
['int', '500'],
['int', '1000'],
]
}),
allowBlank: false,
validator: function(input){
return true;
}
}
}],
listeners: {
beforeitemclick: function (eventThis, record, rowIndex, e) {
var SizeStore = Ext.getCmp('SizeDropdown').editor.store
SizeStore.clearFilter();
SizeStore.filter('size', record.data.type);
}
}
'record.data.type'返回“char”或“int”,具体取决于前面的组合框,过滤工作正常。但这只是第一次。在此之后,它在这里中断:
var SizeStore = Ext.getCmp('SizeDropdown').editor.store
并返回:
Cannot read property 'store' of undefined
我正在使用ExtJs“4.0.7”在Tab类之外声明存储完成了这项工作 以下是我所做的:
var sizeDropdownStore = new Ext.data.SimpleStore({
fields: ['size', 'typeValue'],
data: [
['char', '12'],
['char', '30'],
['char', '31'],
['int', '250'],
['int', '500'],
['int', '1000'],
]
});
...{
xtype: 'combobox',
id:'SelectSize',
editable:true,
valueField: 'typeValue',
displayField: 'typeValue',
mode:'local',
listeners:{
},
store: sizeDropdownStore,
allowBlank: false
}...
你可以把商店搬到你班外。正常地定义它。我认为在编辑器中定义存储不是一个好主意。另外,你能在fiddle.sencha.com上重新创建你的问题吗?有了这些帮助,问题会简单得多。@pagep谢谢,我在课堂外宣布了商店,它成功了。:)如果你愿意,把它写下来作为答案,我会接受的。