1

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.x.x framework.

I have checked the same issue exists with tree grid.

Thanking you in advance.

Ameya
  • 1,914
  • 4
  • 29
  • 55

2 Answers2

3

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

Guilherme Lopes
  • 4,688
  • 1
  • 19
  • 42
  • Thank you very much for the solution. I gave it a quick try in my code , seems to do the job.... Give me a day or two to test this solution completely in my code will close this thread. Relay awesome. :) – Ameya Oct 21 '14 at 05:42
  • No problem, I had to solve this problem two days ago. The real issue is that the beforecheckchange doesnt return the record so you have to find it some other way. Glad I could help. – Guilherme Lopes Oct 21 '14 at 05:50
  • Another help from you related to the same topic if you have tried to eplore the same. Can we get the check box ext component of the column by any way need to disable and enable some boxes. – Ameya Oct 22 '14 at 06:56
  • Hi Ameya, I have answered this question few days ago, check this post: http://stackoverflow.com/questions/26370392/extjs-how-to-enable-disable-a-checkbox-using-renderer-while-loading-a-grid – Guilherme Lopes Oct 22 '14 at 11:15
0

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.

Alexander
  • 19,906
  • 19
  • 75
  • 162
  • I am using ExtJS 5 Version , have updated my question also. So is there a existing workaround in ExtJS 5 ? – Ameya Oct 17 '14 at 10:44
  • The rowIndex is the same as the one you get in grid.beforecellclick event? In beforecellclick event, you get the record as well. You could have a look into the Ext code to find out how they do it. – Alexander Oct 17 '14 at 11:03
  • before cell click does not work for check column , although it works for other columns – Ameya Oct 17 '14 at 17:04