How to translate nested row to source row?

Tags: #<Tag:0x00007f8b25d35010>

I’m using nestedRows and notice that the row number in callbacks like afterChange represents the visual row. So for example data like this:

[
  { d: "Fruit", __children: [{ d: "Apple" }, { d: "Orange" }, { d: "Pear" }],
  { d: "Car", __children: [...] },
  { d: "Etc", __children: [...] }
]

Which renders like:

+ Fruit
     Apple
     Orange
     Pear
- Car
- Etc

If I modify the "Orange" row I get a change with row of 2. How can I correlate that back to my original source data, ie data[0].__children[1]? The problem is that with expanding and collapsing I have no idea how to correlate the visual row to the source data row and child.

Hi @abeall

I think that currently the only way to know if your cell at A3 is the Orange or Etc is to use the hiddenRows plugin data. By using hot.getPlugin('trimRows').trimmedRows you can check if the Fruit is collapsed.

Actually, I found getPlugin("nestedRows").dataManager which has a lot of necessary functions, like isParent, getRowIndexWithinParent, getRowParent, etc.

1 Like