简体   繁体   English

Extjs Grouped Grid checkcolumn更改实际的rowIndex

[英]Extjs Grouped Grid checkcolumn change actual rowIndex

I am using grouped grid containing a checkcolumn . 我正在使用包含checkcolumn的 组网 I need to control the selection of the check boxes , that is allow or not allow selection. 我需要控制复选框的选择,即允许或不允许选择。 I use the beforecheckchange function to do that. 我使用beforecheckchange函数来做到这一点。 To explain the issue consider the scenario. 要解释该问题,请考虑该方案。 There are five group each containing 3 rows out of which only the last group is only expanded. 有五个组,每组包含3行,其中只有最后一个组才被展开。 If I would selected last row check column, the rowIndex that would be returned would be 2, because only 3 rows are visible. 如果我选择最后一行检查列,则返回的rowIndex将为2,因为只有3行可见。 That is virtual or visible rowindex is returned how to know/get the actual row index without all the group being expanded. 这是虚拟或可见的rowindex返回如何知道/获取实际的行索引,而不是所有组都被扩展。

My Bushiness requirement requires me know the exact row index to get the record from the store. 我的Bushiness要求要求我知道从商店获取记录的确切行索引。 The check column is mapped with data/record from the store that allows me to take decision to allow check on the check check box. 检查列与商店中的数据/记录映射,允许我决定是否允许检查复选框。 Also one from lower group is checked then same level check box from higher need also be checked. 还要检查下层组中的一个,然后再检查更高级别的同级复选框。

I am using ExtJS 5.xx framework. 我正在使用ExtJS 5.xx框架。

I have checked the same issue exists with tree grid. 我检查了树网格存在同样的问题。

Thanking you in advance. 提前感谢你。

I believe that this would solve your issue: 我相信这会解决你的问题:

// You checkcolumn listeners
listeners: {
    beforecheckchange : function(component, rowIndex, checked, eOpts) {
        var row = component.getView().getRow(rowIndex),
            record = component.getView().getRecord(row),
            realIndex = component.getView().ownerCt.getStore().indexOf(record);
        console.log(rowIndex, realIndex);
    }
}

Demonstration Fiddle: https://fiddle.sencha.com/#fiddle/c3e 演示小提琴: https//fiddle.sencha.com/#fiddle/c3e

What version of ExtJS are you using? 您使用的是什么版本的ExtJS?

There are at least two known grouping bugs in ExtJS 4.2.1, fixed in 4.2.2 ( EXTJS-10027 ) and 4.2.3 ( EXTJS-10043 ), respectively. ExtJS 4.2.1中至少有两个已知的分组错误,分别在4.2.2( EXTJS-10027 )和4.2.3( EXTJS-10043 )中修复。

It would be easier to fix these bugs in your version of Ext (or by simply upgrading) than writing workarounds for each and every grid. 在您的Ext版本中(或通过简单升级)修复这些错误比为每个网格编写解决方法更容易。

If this does not solve your issue, and you are on Ext4, consider abusing the "convert" function on the underlying model. 如果这不能解决您的问题,并且您使用的是Ext4,请考虑滥用基础模型上的“转换”功能。 This won't work in ExtJS5 any more, I fear, but for the time being it is a good interim solution. 我担心,这在ExtJS5中不再起作用,但暂时它是一个很好的临时解决方案。

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

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