You can just link statically required files in your index.html

  1. <link rel="stylesheet" type="text/css" href="scripts/ext/examples/ux/grid/css/GridFilters.css" />
  2. <link rel="stylesheet" type="text/css" href="scripts/ext/examples/ux/grid/css/RangeMenu.css" />
  3. <script type="text/javascript" src="scripts/ext/examples/ux/grid/FiltersFeature.js"></script>
  4. <script type="text/javascript" src="scripts/ext/examples/ux/grid/filter/Filter.js"></script>
  5. <script type="text/javascript" src="scripts/ext/examples/ux/grid/filter/StringFilter.js"></script>
  6. <script type="text/javascript" src="scripts/ext/examples/ux/grid/filter/ListFilter.js"></script>
  7. <script type="text/javascript" src="scripts/ext/examples/ux/grid/filter/BooleanFilter.js"></script>
  8. <script type="text/javascript" src="scripts/ext/examples/ux/grid/filter/NumericFilter.js"></script>
  9. <script type="text/javascript" src="scripts/ext/examples/ux/grid/filter/DateFilter.js"></script>
  10. <script type="text/javascript" src="scripts/ext/examples/ux/grid/menu/RangeMenu.js"></script>
 

The reason that ExtJS tries to load ".../features/filter.js" is that the object that it is looking for ("features.filter") is not yet defined. ExtJS guesses this must be in a file called "features/filter.js". However, it is actually defined in "grid/FeaturesFilter.js" (where "features.filter" is defined as an "alias" to "Ext.ux.grid.FiltersFeature").

Most people who have this problem have read the documentation and are trying to load Ext.ux.grid.FiltersFeature (usually at "ux/grid/FiltersFeature.js") but the timing of the load is such that it is not loaded when it is needed. Therefore, ExtJS tries to load the non-existent file.

The key to solving this problem is to ensure that the "Ext.ux.grid.FiltersFeature" is fully loaded (not just the load initiated) by the time the grid is initializing with the filters feature.

The sensible (and appropriate) thing is to put the "Ext.ux.grid.FiltersFeature" in the "requires"of the class extending the grid. This should ensure that the grid/FiltersFeature.js file is loaded before you need it.

  1. // This should work
  2. Ext.define("FrontSuite.view.MyGrid", {
  3. extend: 'Ext.grid.Panel',
  4. xtype: 'mygrid',
  5. requires: [
  6. 'Ext.ux.grid.FiltersFeature'
  7. ],
  8. title: 'My Grid',
  9. ...
  10. features: [{
  11. ftype : 'filters',
  12. encode : true
  13. }],
  14. columns: [
  15. { dataIndex: 'id', text: 'ID'},
  16. { dataIndex: 'name', text: 'Name'}
  17. ]
  18. }

If for some reason, the file does not load in time, you can put a (seemingly redundant) requires "Ext.ux.grid.FiltersFeature" in the Ext.application() call (ExtJS 4+).

  1. Ext.application({
  2. name: 'MyNamespace',
  3. extend: 'MyNamespace.Application',
  4. controllers: ['MyController'],
  5. autoCreateViewport: true,
  6. paths: {
  7. 'Ext.ux': 'path/to/my/ext/ux'
  8. },
  9. requires: [
  10. 'Ext.ux.grid.FiltersFeature'
  11. ]
  12. });

IMPORTANT NOTES ON CLASS LOAD TIMING: Putting the required class in the proper "requires" config for the proper requiring class is important so that when you do a build and create a minified Javascript file, you get only the bits of the ExtJS library code that are truly needed. However, you should watch the Javascript console for messages that say that ExtJS had to load a file synchronously. If it does this, the "correct" location for a "requires" should be supplemented by a "redundant requires" somewhere earlier, such as in Ext.application() as shown above.

source:http://stackoverflow.com/questions/7359512/how-to-use-filters-in-a-gridpanel

How to use filters in a GridPanel的更多相关文章

  1. Extjs的GridPanel的RowExpander的扩展

    对Extjs的grid使用,有时候单单使用其中的某些组.或某些行是远远不够的,还需要对行进行一些扩展,如:与filters相似的row扩展控件,如下 这个控件,我也是从网上找的小例子,按照其内部的某些 ...

  2. 【Ext.Net学习笔记】05:Ext.Net GridPanel的用法(包含Filter、Sorter、Grouping、汇总(Summary)的用法)

    GridPanel是用来显示数据的表格,与ASP.NET中的GridView类似. GridPanel用法 直接看代码: <ext:GridPanel runat="server&qu ...

  3. Ext.Net学习笔记15:Ext.Net GridPanel 汇总(Summary)用法

    Ext.Net学习笔记15:Ext.Net GridPanel 汇总(Summary)用法 Summary的用法和Group一样简单,分为两步: 启用Summary功能 在Feature标签内,添加如 ...

  4. Ext.Net学习笔记12:Ext.Net GridPanel Filter用法

    Ext.Net学习笔记12:Ext.Net GridPanel Filter用法 Ext.Net GridPanel的用法在上一篇中已经介绍过,这篇笔记讲介绍Filter的用法. Filter是用来过 ...

  5. Ext.Net学习笔记14:Ext.Net GridPanel Grouping用法

    Ext.Net学习笔记14:Ext.Net GridPanel Grouping用法 Ext.Net GridPanel可以进行Group操作,例如: 如何启用Grouping功能呢?只需要在Grid ...

  6. ABP(现代ASP.NET样板开发框架)系列之13、ABP领域层——数据过滤器(Data filters)

    点这里进入ABP系列文章总目录 基于DDD的现代ASP.NET开发框架--ABP系列之13.ABP领域层——数据过滤器(Data filters) ABP是“ASP.NET Boilerplate P ...

  7. ASP.NET MVC Filters 4种默认过滤器的使用【附示例】

    过滤器(Filters)的出现使得我们可以在ASP.NET MVC程序里更好的控制浏览器请求过来的URL,不是每个请求都会响应内容,只响应特定内容给那些有特定权限的用户,过滤器理论上有以下功能: 判断 ...

  8. 无废话ExtJs 入门教程十七[列表:GridPanel]

    无废话ExtJs 入门教程十七[列表:GridPanel] extjs技术交流,欢迎加群(201926085) 在Extjs中,GridPanel用于数据显示,即我们平时说的列表页.在本节中,我们先对 ...

  9. Ext GridPanel

    Extjs GridPanel用法详解 创建GridPanel 要使用GridPanel,首先要定义Store,而在创建Store的时候必须要有Model,因此我们首先来定义Model: //1.定义 ...

随机推荐

  1. python 简易计算器(只能计算加减乘除和括号)

    import re # 格式化字符串函数(消除一些错误的格式) def format_string(string): # 一系列的替换语句 string = string.replace(" ...

  2. unittest多线程生成报告(BeautifulReport)

    前言 selenium多线程跑用例,这个前面一篇已经解决了,如何生成一个测试报告这个是难点,刚好在github上有个大神分享了BeautifulReport,完美的结合起来,就能生成报告了. 环境必备 ...

  3. zoj 2829 Beautiful Number

    Beautiful Number Time Limit: 2 Seconds      Memory Limit: 65536 KB Mike is very lucky, as he has two ...

  4. String painter(区间DP)

    There are two strings A and B with equal length. Both strings are made up of lower case letters. Now ...

  5. HDU-1210Eddy's 洗牌问题

    Eddy's 洗牌问题 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Prob ...

  6. 以太坊和IPFS如何存储数据

    如何将JSON文件存储在IPFS上,并使用Oraclize访问智能合约中的数据呢? 以太坊是一个成熟的区块链,使开发人员能够创建智能合约,在区块链上执行的程序可以由交易触发.人们经常将区块链称为数据库 ...

  7. 基于神经网络的embeddding来构建推荐系统

    在之前的博客中,我主要介绍了embedding用于处理类别特征的应用,其实,在学术界和工业界上,embedding的应用还有很多,比如在推荐系统中的应用.本篇博客就介绍了如何利用embedding来构 ...

  8. Couriers(bzoj 3524)

    Description 给一个长度为n的序列a.1≤a[i]≤n.m组询问,每次询问一个区间[l,r],是否存在一个数在[l,r]中出现的次数大于(r-l+1)/2.如果存在,输出这个数,否则输出0. ...

  9. 巴蜀3540 -- 【Violet 6 最终话】蒲公英

    Description 原题的时间限制是 2s . 亲爱的哥哥: 你在那个城市里面过得好吗? 我在家里面最近很开心呢.昨天晚上奶奶给我讲了那个叫「绝望」的大坏蛋的故事的说!它把人们的房子和田地搞坏,还 ...

  10. 在eclipse中画类图

    学习设计模式的时候,希望能够画出类图,理清关系.但是StarUML还有重新去写类名.属性.方法等,不是很方便.网上给出了安装插件的方法额,就可以直接在eclipse中拖拽类,很方便.但是网上给出的插件 ...