Associate row as a child to another row

Associate row as a child to another row

laveronilaveroni Posts: 2Questions: 1Answers: 0

Hi, I am trying to add rowGrouping to my datatable with the functionality to collapse and expand the row groups. I know this isn't supported by the rowGroup extension, but I need to find a workaround to make it work.

I have tried storing the ids of the rows themselves and attempting to hide() them, but the problem I have here is the space that the rows would have taken is left as empty space, the row is simply hidden but then you can still scroll through where the rows would have been, their content is just hidden. I want to completely hide the rows when they're collapsed.

Maybe I can pursue this another way, by associating rows to a parent row group row and then toggling their visibility just like the child rows are implemented. Is this a possibility? Or does anyone have a workaround to add collapsing to the rowGroup extension?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 42,648Questions: 1Answers: 5,492 Site admin
    Answer ✓

    Hi,

    Thanks for your question. I've been thinking about this overnight and I think I can come up with a workaround (using display: none on the displayed tr elements as the row is drawn), but one thing it wouldn't take into account is the paging length. For example, if you had a single group displayed, and paging set at 10 rows, then collapsed the group, there wouldn't be more records suddenly shown - it would just the the collapsed group.

    If paging wasn't enabled, that wouldn't be an issue since artefact only visually effects the table when paging is enabled.

    Does that sound like a reasonable and workable compromise for your use case?

    Thanks,
    Allan

  • laveronilaveroni Posts: 2Questions: 1Answers: 0

    Thanks Allan, it definitely sounds like it will help my use case. I'll try to implement that and will follow up with the results. Thank you!

Sign In or Register to comment.