ExtJS 5.1 - 网格与网格过滤器插件在网格重新配置后中断
ExtJS 5.1 - Grid with gridfilters plugin breaks after grid.reconfigure
我正在将一些 ExtJS 4 的东西迁移到 ExtJS 5.1。 我有一个网格,可以从服务器获取它的元数据,并在元交换事件上重新配置存储:
store: Ext.create('Ext.data.Store', {
model: 'MyModel',
listeners: {
metachange: function (store, meta) {
this.grid.reconfigure(store, meta.columns);
},
scope: this
},
proxy: {
type: 'ajax',
url: '/mygriddata',
reader: {
type: 'json',
rootProperty: 'rows',
totalProperty: 'totalRows'
}
}
})
我还为此网格启用了网格过滤器。 当商店首次加载时,一切正常。 我可以按下网格列的触发按钮,列菜单显示"升序排序"、"降序排序"、"过滤器",并且我可以使用我为该列指定的过滤器(日期、字符串等)。
但是,在存储重新加载不同的元数据后,事情会中断,从而触发元更改事件并调用 grid.reconfigure。 具体来说,当我单击网格列的触发按钮时,我得到一个"未定义不是函数错误",并且列菜单没有出现。
如果我在没有先单击列触发器按钮的情况下更改元数据,则不会发生此错误 - 这与构建过滤器菜单项然后重新配置网格有关,这会破坏过滤器菜单项。 似乎当我重新配置网格时,我还需要以某种方式刷新过滤器或重建菜单项,但我不确定如何做到这一点。任何帮助将不胜感激,谢谢!
错误的完整堆栈跟踪:
Uncaught TypeError: undefined is not a function ext-all-debug.js:86455
Ext.define.getDockedItems ext-all-debug.js:86465
Ext.define.getDockingRefIt emsext-all-debug.js:87641
Ext.define.getRefItems ext-all-debug.js:130763
Ext.define.getRefItems ext-all-debug.js:75497
Ext.define.getRefItems ext-all-debug.js:7378
Ext.Base.Base.addMembers.callParent ext-all-debug.js:87640
Ext.define.getRefItems ext-all-debug.js:15057
getItems ext-all-debug.js:15310
cq.Query.Ext.extend._execute ext-all-debug.js:15271
cq.Query.Ext.extend.execute ext-all-debug.js:15480
Ext.apply.query ext-all-debug.js:63058
Ext.define.query ext-all-debug.js:63101
Ext.define.down ext-all-debug.js:101658
Ext.define.showMenuBy ext-all-debug.js:101651
Ext.define.onHeaderTriggerClick ext-all-debug.js:101179
Ext.define.onHeaderCtEvent ext-all-debug.js:11800
fire ext-all-debug.js:18530
Ext.define.fire ext-all-debug.js:18506
Ext.define.publish ext-all-debug.js:18556
Ext.define.doDelegatedEvent ext-all-debug.js:18543
Ext.define.onDelegatedEvent ext-all-debug.js:4402
Ext.Function.ExtFunction.bind.method
我的解决方案:
Ext.define('Overrides.grid.filters.Filters', {
override: 'Ext.grid.filters.Filters',
onReconfigure: function(grid, store, columns, oldStore) {
var me = this;
me.sep = Ext.destroy(me.sep);
if (me.menuItems && me.menuItems[grid.id]) {
me.menuItems[grid.id].destroy();
}
me.callParent(arguments);
}
});
相关文章:
- 在不刷新整个网格的情况下,向Asp.net网格视图添加新行
- 如何在创建新网格之前销毁网格堆栈
- 剑道网格-插入具有外部列的新对象失败
- CRM 2011-在插入新记录或修改现有记录时捕获子网格的事件
- 如何在网格视图中每次单击按钮或链接时打开不同的新弹出窗口
- 访问所选记录的网格值并使用 javascript 传递到新窗口
- 将网格视图的两列相乘,并将其显示在新列中
- 设置新网格行的动画
- EXTJS 4.2:点击按钮,在新窗口中将选定的网格行从一个网格复制到另一个网格
- 使用新项目更新KendoUI网格数据源
- 如何在剑道网格中添加具有预定义数据的新行
- 使用一些默认值在剑道网格中添加新行
- 插入数据并用新数据刷新数据网格后,关闭弹出窗口
- ExtJS 5.1 - 网格与网格过滤器插件在网格重新配置后中断
- 如何在剑道UI网格中标记新添加的行
- 检查网格插件 ExtJs 中的新元素
- FetchXML 查询在子网格中返回的动态 CRM 2015 中的活动记录 - 主题超链接将打开新的活动
- 使用 vuejs 新的 vuex 存储得到意外的配置错误
- 将现有的剑道网格绑定到新的 JSON 对象
- ExtJS 5 - 将网格中双击的单元格的值传递到新窗口