extjs - 如何使用Extjs4在网格过滤功能中应用精确匹配?

标签 extjs extjs4

我正在使用Extjs4,我想在网格过滤上应用​​exactMatch。我正在使用新引入的网格过滤功能。我尝试使用exactMatch,但它不起作用。这是我的示例代码:

Ext.define('MyModel', {
        extend: 'Ext.data.Model',
        fields: [
            {name: 'ID', type: 'string'},
            {name: 'Title', type: 'string'}
        ]
    });

var store = Ext.create('Ext.data.Store', {         
        model: 'MyModel',
        proxy: {
            type: 'ajax',                       
            url: 'myurl',                       
            reader: {
                type: 'json'                  
            }
        },
        sorters: [{
            property: 'ID',
            direction:'DESC'
        }],
        autoLoad:true            
    });

var filters = {
        ftype: 'filters',               
        encode: true, 
        local: true,   
        filters: [{
            type: 'numeric',
            dataIndex: 'ID',
            disabled: true
        },{
            type: 'string',
            dataIndex: 'Title',
            exactMatch:true
        }]
    };

var grid = Ext.create('Ext.grid.Panel', {
        store: store,
        columns: [{
            header: 'ID',
            dataIndex: 'ID',
            width: 20
        },{
            header: 'List Title',
            dataIndex: 'Title',
            flex:1
        }],
        renderTo: 'editor-grid',
        width: 700,
        height: 400,
        frame: true,                      
        features: [filters]
    });

谢谢..

最佳答案

看起来对于 ExtJS V4.0,您不必为网格配置单独的过滤器选项,因为它们已经包含在内。您可以在数据加载后调用商店上的方法进行过滤,如下所示:

store.filter("Title", "Bob");

或者如果你想像这样执行多个过滤器:

store.filter([
    {property: "email", value: "Bob"},
    {filterFn: function(item) { return item.get("ID") > 10; }}
]);

关于extjs - 如何使用Extjs4在网格过滤功能中应用精确匹配?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6421622/

相关文章:

javascript - 与此等效的 jQuery 是什么,它有什么作用?

javascript - Extjs4 创建混合

javascript - extjs 4 中的范围问题

Javascript - Sencha touch 2.1 - 调用 app.js 级函数返回 "[object Object] has no method ' getLocalLoggedUserDetails'"

javascript - 如果列的所有单元格均为空,extjs 隐藏列

ExtJS 在表单中对齐单选组

extjs - extJs门户内的extJs gmappanel

javascript - 下载以前版本的 ExtJs

model-view-controller - 正确的 extjs MVC 文件夹结构

extjs - 将组件插入到 ExtJS 4 中的 Tabpanel 选项卡中