Hook to catch expand/collapse nestedRows

Tags: #<Tag:0x00007efc6b927ae8> #<Tag:0x00007efc6b927840>

Hi!

First of all, congrats for the awesome plugin you have created, it’s been a while using it and it’s fantastic!

I’ve been reading some topics about catching the expand/collapse action (https://forum.handsontable.com/search?q=nestedrows%20hook%20collapse%20expand), however I don’t get what I need. I’ve been trying some hooks without success:

  • ‘afterUntrimRow’ -> is not triggered when clicking on -/+
  • ‘afterOnCellMouseDown’ -> is not triggered when clicking on -/+ (only triggered when clicking out the button in the cell)
  • ‘afterGetRowHeader’ -> gets triggered but not very useful

I rather not to go with JS native solution (crawling DOM)…

What I really need is to keep persistent expanded/collapsed rows after rendering, as I didn’t find any way out of the box, I’m trying to keep recorded which rows are collapsed and then manually collapse them when rendering datagrid (with collapsingUI.collapseChildren)

BTW: I’m using latest version (13.0.0)

Thanks in advance!

Jose

Hi @joseic

The nestedRows does not have a dedicated hook. This https://jsfiddle.net/h365gd9t/3/ doesn’t seem to be the best option. But at the moment, it might be the only one.
Currently, when you click on the expand/collapse handler, the keyDown event is stolen by Handsontable. But at the same time, the afterDocumentKeyDown does not inform us about the event on the handler. That is why I used the global keyUp event to console the header of the row.

Would that help?

Hi Aleksandra,

Thanks for the quick response. I’d go with that workaround then

Kindly
Jose

1 Like