首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

Ext ComboBox 能够依据输入的record的指定字段过滤列表

2012-11-23 
Ext ComboBox 能够根据输入的record的指定字段过滤列表combo默认能够根据输入的内容过滤的列表内容,不过这

Ext ComboBox 能够根据输入的record的指定字段过滤列表
combo默认能够根据输入的内容过滤的列表内容,不过这个过滤只是根据displayField来的。如果要能够同时根据自己制定的字段过滤就需要如下修改:
在combo的源码的doQuery方法中

if(forceAll === true || (q.length >= this.minChars)){            if(this.lastQuery !== q){                this.lastQuery = q;                if(this.mode == 'local'){                    this.selectedIndex = -1;                    if(forceAll){                        this.store.clearFilter();                    }else{                        this.store.filter(this.displayField, q);                        //hack                        if(this.otherFilterField){                        this.setValue(this.getRawValue());                        if(this.store.data.length==0)                    this.store.filter(                                      this.otherFilterField, q);                    }                    }                                    this.onLoad();



然后需要构造这种combo的时候指定otherFilterField为record的其他字段就可以了

热点排行