How to filter combo extjs when there is empty value?

家住魔仙堡 提交于 2019-12-11 16:58:47

问题


Value in combo box doesn't filter and value "null" still show.

This code SkpdCombo.js and I didn't find what error. So please help me what's mistake and what should I do with this code?

Ext.define('App.view.skpd.SkpdCombo', {
    extend: 'App.view.CommonCombo',
    alias: 'widget.SkpdCombo',
    fieldLabel: 'Skpd',
    displayField:'_combo_',
    valueField: 'skpd_id',
    queryMode: 'remote',
    initComponent: function() {
        if (!this.store){
            this.store = new App.store.SkpdStore();
            this.store.load();
        }

        this.callParent();

        this.store.on('load', function(store, records, successful, operation, eOpts){
            var value_no = this.getValue();

            if (store.find('skpd_no', value_no) != null){
                this.setValue(value_no);
            }else{
                this.store.clearFilter(true);
            }
        }, this);
    }
});

Ok I'll wait for your answer guys. Thanks.


回答1:


this.store.load(); is called before the store onLoad event is defined.

Also this.callParent(); I think must be the first call in the constructor.



来源:https://stackoverflow.com/questions/44558923/how-to-filter-combo-extjs-when-there-is-empty-value

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!