简体   繁体   中英

Extjs Grouped Grid checkcolumn change actual rowIndex

I am using grouped grid containing a 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. 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. If I would selected last row check column, the rowIndex that would be returned would be 2, because only 3 rows are visible. That is virtual or visible rowindex is returned how to know/get the actual row index without all the group being expanded.

My Bushiness requirement requires me know the exact row index to get the record from the store. 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.

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

What version of ExtJS are you using?

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.

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.

If this does not solve your issue, and you are on Ext4, consider abusing the "convert" function on the underlying model. This won't work in ExtJS5 any more, I fear, but for the time being it is a good interim solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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