Author Topic: rowDblClick on filtered rows  (Read 3010 times)

RedBully

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
rowDblClick on filtered rows
« on: November 03, 2014, 11:08:47 pm »
Hello,

I'm using paramgrid with header filtering.  I'm using rowDblClick and I need to identify the row that has been double clicked.

I initialise my grid with:

Code: [Select]
rowDblClick: function (event, ui) { handleDoubleClick(event, this, ui); },

and I have

Code: [Select]
handleDoubleClick = function(event, grid, ui) {
  var rowIndx = ui.rowIndx;

  //Do something with this row Index
}

This works fine until I filter the list using header filtering.
If the list is filtered, then the rowIndx is the index of the row with respect to the filtered data

e.g. If I have data with 10 rows and then filter so that only rows 7 and 8 are shown, rowIndx for the first row is 0 instead of 7 as expected

I need the index of the row with respect to the data, not with respect to the filtered data set.
I can get ui.rowData but this just gives me the data from the row and not the index of the row.

Is it possible to get the index of the row with respect to the data?

Thanks in advance
 

RedBully

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
Re: rowDblClick on filtered rows
« Reply #1 on: November 03, 2014, 11:59:48 pm »
I have worked around this problem by comparing ui.rowData with every row in my original data array in order to determine the row data index.  This works ok

Code: [Select]
var realRowIndex = ui.rowIndx;
for (var r = 0; r < data.length; r++) {
  if (data[r] == ui.rowData) {
    realRowIndex = r;
    break;
  }
}

//Use the real row index
ui.rowIndx = realRowIndex;

//Continue as normal