我有一个带组合框的 MVC 面板,我会在他的商店(本地或远程)完成加载后从组合框中删除一些元素。
组合在此面板的 View 中声明如下:
{
xtype:'combo',
name: 'type',
editable: false,
//a local simple store with two field: 'valueType' and 'text'
store : Ext.create('AM.store.custompropview.propertyType'),
valueField : 'valueType',
fieldLabel: 'combo'
}
我已经尝试在 Controller 中控制事件“afterrender”或“boxready”,并在函数中尝试从商店中删除一些元素,但它根本不起作用。
'combo[name="type"]' : {
boxready:function(th, width, height, eOpts ){
th.store.removeAt(0);
th.store.removeAt(0);
th.store.removeAt(0);
}
我该怎么做?
谢谢
最佳答案
我认为你应该在商店加载后删除你的项目,而不仅仅是在你的组合呈现之后,这样你就可以在 Controller 的初始化函数中编写代码:
Ext.getStore('AM.store.custompropview.propertyType').on('load', function(store){
store.removeAt(0);
});
关于javascript - Extjs 4.1 加载后从组合框中删除元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18503743/