【问题标题】:extjs - unable to add filters in gridextjs - 无法在网格中添加过滤器
【发布时间】:2014-06-02 18:51:28
【问题描述】:

我正在尝试做简单的事情,但不知何故它不适合我,在我的网格表中我想添加客户端过滤器(在列中),我尝试了一切并遵循http://docs.sencha.com/ext-js/4-0/#!/api/Ext.ux.grid.FiltersFeature的代码

我的代码是,

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

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

        columns: [
             {
                text: 'App',
                sortable: true,
                filterable: true,
                dataIndex: 'Stage'
            },
            {
                text: 'Stage',
                sortable: true,
                filterable: true,
                dataIndex: 'Type',                    
            }

.. ..

点击列排序选项可见,但没有过滤选项

提前致谢

【问题讨论】:

  • features: [filtersCfg],代替filters : [filtersCfg],试试
  • 带有“功能”,我的网格不渲染,这意味着它正在发生一些事情!
  • 肯定是 ;) 控制台说什么?
  • 我太傻了,不看控制台,它抱怨缺少 feature/filters.js 文件,但我在整个 extjs 包中没有看到任何这样的文件!

标签: extjs filter grid


【解决方案1】:

您可以使用Ext.require 要求其他扩展。

Ext.Loader.setConfig({
    enabled: true,
    paths: {
        'Ext.ux': './ext/ux'
    }
});

Ext.require([
    'Ext.ux.grid.FiltersFeature'
]);

FiltersFeature.js 位于examples\ux\grid

【讨论】:

  • 谢谢我这样做了,但是在 extjs-debug-all.js 文件中又出现了一个 GET 404 错误,它试图访问 localhost/feature/filters.js
  • 更新代码..需要设置可以找到ux文件夹的路径。
  • 感谢您的耐心等待,它并没有改变任何东西,因为文件filters.js不存在,我找到了另一个类似的线程sencha.com/forum/archive/index.php/…,这个家伙告诉他终于修好了,但他不知道如何,我也移动了 onReady() 下的所有内容,但结果是一样的。获取 404 错误
  • 您在“'Ext.ux', './ext/ux'”中传递路径时出错。 “,”应该是对象属性名称与其值之间的“:”!
  • @LucianDepold 谢谢,我修正了错字;)
【解决方案2】:

嗨@A1rPun 我发现我的一些文件已损坏,当我复制新文件时它起作用了,我认为你的答案是完美的,我们不需要任何 feature/filters.js 文件,只是在控制台中抛出了某种错误错误extjs

【讨论】:

  • 应该在我的回答中对此发表评论,以便我收到通知 :) 希望通过修复错字来解决错误。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-11-20
  • 1970-01-01
  • 2020-06-12
  • 2012-02-23
  • 1970-01-01
相关资源
最近更新 更多