javascript - Extjs GridFilter 功能不起作用

标签 javascript extjs filter extjs4

我在 Ruby On Rails + Ext js 应用程序中工作..我正在尝试显示具有过滤器功能的网格,但我不能我已经阅读了很多帖子甚至 Sencha 示例页面,但我无法让它工作。

这是实时代码.. 没有网格面板工作的简单网格 https://fiddle.sencha.com/#fiddle/3fh

Ext.Loader.setConfig({enabled: true});
Ext.Loader.setPath('Ext.ux', '../ux');
Ext.require([
    'Ext.grid.*',
    'Ext.data.*',
    'Ext.ux.grid.FiltersFeature',
    'Ext.toolbar.Paging'
]);



var store = Ext.create('Ext.data.Store', {

   fields: [
           {name: 'tipo', type: 'string'},
           {name: 'concepto', type: 'string'},
           {name: 'ingreso', type: 'int'},
           {name: 'egreso', type: 'int'},
           {name: 'por_alicuota', type: 'float'},
           {name: 'fecha', type: 'string', dateFormat:'m/Y'}
       ] ,     

   data: [
{tipo:'Fijo',concepto:'Ingresos por Cuotas',ingreso:345000,egreso:0,por_alicuota:0,fecha:'11/2013'},
{tipo:'Extra',concepto:'Ingresos por Sanciones',ingreso:24500,egreso:0,por_alicuota:0,fecha:'11/2013'}

          ],

})

var filtersCfg = {
        ftype: 'filters',
        local: true,
        filters: [{
                type: 'string',
                dataIndex: 'tipo'
            }, {
                type: 'string',
                dataIndex: 'concepto'
            }]
    };

var grid =   Ext.create('Ext.grid.Panel', {
        renderTo: Ext.getElementById("leftPanel"),
        store: store,
        height: 300,
        filters : [filtersCfg],
        title: "grid view",

        columns: [
             {
                text: 'Pay',
                sortable: true,
                filterable: true,
                dataIndex: 'tipo'
            },
            {
                text: 'Concept',
                sortable: true,
                filterable: true,
                dataIndex: 'concepto',                    
            }]

});

Ext.onReady(function() {
    Ext.QuickTips.init();


    grid.render('content');
    grid.show();
});

希望大家能帮帮我!

最佳答案

filters: [filtersCfg], 替换为 features: [filtersCfg],,并删除 dataIndex: 'concepto', 这可能会使 IE 崩溃。请务必注意,ExtJS 文件加载器似乎无法在此 fiddle 中工作(类型错误)。

关于javascript - Extjs GridFilter 功能不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21643152/

相关文章:

javascript - Angularjs ng-model更新输入元素而不是div元素的变量

javascript - `new Array(5).map()` 是如何工作的?

javascript - 如何使用javascript添加从右到左的动画?

javascript - ExtJS 6 网格面板商店未填充

excel - 如何插入条件 "if it contains"以在 VBA 中搜索特定字母?

SQL按同一列中的多个项目进行过滤

javascript - 在MouseOver上调用Js函数

tomcat - 在一个 Tomcat 中运行 Grails 和 Sencha ExtJS

javascript - ExtJS 5.0 - 添加按钮作为组件的覆盖

list - MIT Scheme Expression append 的替代形式