简体   繁体   English

ExtJs 4.1网格的分组功能启用和禁用问题

[英]ExtJs 4.1 grid's grouping feature enabling and disabling issue

I am using ExtJs 4.1. 我正在使用ExtJs 4.1。 My application is having two grid. 我的应用程序有两个网格。 Both the grid have grouping feature (I am using two unique Grouping feature). 两个网格都具有分组功能(我正在使用两个独特的分组功能)。 Both the grids are using single store . 两个网格都使用单一存储 Each grid is having two button used to enable and disable the grouping feature. 每个网格都有两个用于启用和禁用分组功能的按钮。 All this is working fine. 所有这一切都很好。

Problem : When I disable grouping feature in one grid and open second grid, the grouping feature in second grid also gets disabled even though the grids & grouping features are different. 问题 :当我在一个网格中禁用分组功能并打开第二个网格时,即使网格和分组功能不同,第二个网格中的分组功能也会被禁用。 I am not sure what is the reason for this behavior. 我不确定这种现象的原因是什么。

Please use this fiddle to reproduce the issue and see the code. 请使用此小提琴来重现问题并查看代码。

Use fiddle to see the code

Thanks !!!1 谢谢!!! 1

This would work... http://jsfiddle.net/WRTM3/1/ 这将起作用... http://jsfiddle.net/WRTM3/1/

Ext.define('myKindOfStore');
var store1 = Ext.create('myKindOfStore');
var store2 = Ext.create('myKindOfStore');

It seems that the grouping feature is actually executed on the store behind the grid. 似乎分组功能实际上是在网格后面的商店上执行的。 Since you use the same store in both grids each grouping plugin act like two different light switches controling the same bulb... 由于您在两个网格中使用相同的存储,因此每个分组插件的作用就像控制相同灯泡的两个不同的电灯开关一样。

If you want to seperate grids behaviour, just define a new store and create two seperate store instances for each grid (see my jsfiddle fork) 如果要分离网格行为,只需定义一个新商店并为每个网格创建两个单独的商店实例(请参阅我的jsfiddle分支)

This way all operations on grid1=store1 have no effects on grid2=store2 including filtering, sorting, etc. 这样,对grid1 = store1的所有操作都不会对grid2 = store2产生任何影响,包括过滤,排序等。

Hope this is what you wanted :-) 希望这就是你想要的:-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM