Ext.ux.ItemSelector.getStore undefined
ext4.0中的Ext.ux.ItemSelector实例调用getStore方法获取数据源时发生错误,提示getStore undefined。
查看了下Ext.ux.ItemSelector的源代码,Ext.ux.ItemSelector继承Ext.ux.form.MultiSelect,而Ext.ux.form.MultiSelect继承的是Ext.form.field.Base,Ext.form.field.Base并没有getStore方法,并且Ext.ux.form.MultiSelect没有注册getStore方法,所以Ext.ux.ItemSelector也没有getStore方法了。
ext4.0在线文档中Ext.ux.ItemSelector确有getStore方法,想必应该是Ext.ux.ItemSelector这个组件没有完善吧。
要给Ext.ux.ItemSelector增加getStore方法,我们只需要给Ext.ux.form.MultiSelect扩展getStore方法即可。修改后的源代码如下
Ext.define('Ext.ux.form.MultiSelect', { ///////////////扩展Ext.ux.form.MultiSelectgetStore方法 getStore:function(){return this.store;}, /////////////// extend: 'Ext.form.field.Base', alternateClassName: 'Ext.ux.Multiselect', alias: ['widget.multiselect', 'widget.multiselectfield'], uses: [ 'Ext.view.BoundList', 'Ext.form.FieldSet', 'Ext.ux.layout.component.form.MultiSelect', 'Ext.view.DragZone', 'Ext.view.DropZone' ] //.....其他代码 });
Ext.ux.ItemSelector没有添加数据源更改时自动更新ui的事件,所以修改了Ext.ux.ItemSelector的数据源后并没有更新DOM树中的节点信息,不过Ext.ux.ItemSelector提供了bindStore方法重新绑定数据源,可以使用此bindStore方法更新Ext.ux.ItemSelector的UI
加支付宝好友偷能量挖...
原创文章,转载请注明出处:Ext.ux.ItemSelector.getStore undefined