Click Event on parent - nestedRows

Tags: #<Tag:0x00007fd2c20dca40>

Can we have a click event on the parent to expand the child elements while using nestedRows instead of +/- ?

Sorry @srikanth.venkata

there’s no event for this yet. You’d need to check if ht_nestingButton element has a second class of ht_nestingExpand or ht_nestingCollapse to check if it is collapsed or expanded.

Thanks @aleksandra_budnik for your reply. I will try to work around this.

Hello @aleksandra_budnik,

I was able to change the class from ht_nestingExpand to ht_nestingCollapse and viceversa on the div. Is there any extra step that I need to perform to collapse the rows? The event is on a td at this moment.

Have you already added the trimRows/ untrimRows ?

Thanks @aleksandra_budnik. With trimRows, is there a way in which we can find the indexes of the child rows associated to the parent?

You can use afterGetRowHeader method to check if cell is a parent or a child here is an example

Thank you @aleksandra_budnik. I have updated the fiddle. instead of col, it should be row. Small Change.

@aleksandra_budnik : afterGetRowHeader gives me the list of rows and I am able to differentiate between the child and parent.

I have 1 question here -

a) Is there any hook that gives me which row I have clicked and what is the data and what are the child elements associated to the clicked row it? Or Should this be done by plain javascript?


You can use the afterSelectionEnd hook with getDataAtRow method

Hi @aleksandra_budnik : I was able to work around and have a click event on the parent to collapse and expand the child elements. I will share the fiddle with you soon. Thanks for your help.

Sure. Please take your time.

I guess that we can close the topic as it’s more than a month now but if there’s anything to add here please open a new topic.