Accordion trees in data tables

Accordion trees in data tables

990consulting990consulting Posts: 23Questions: 7Answers: 0

I have been very happy with DataTables for all of my tabular data representations. I have one use for which I have not yet figured out how to use it, and I'm wondering if there is a known solution.

Part of a website that I'm launching today involves an accordion tree associated with a table. You can see an example here:
https://www.open990.com/org/aMKkcMKsa1t6wopr/

I'd love to be using the many wonderful features of DataTables for this, including out-of-the-box responsive support, the ability to search within the table, and the ability to show and hide columns. I know that DataTables does support the ability to show and hide rows, but I'm not skilled enough with JavaScript to know how to use that for hierarchical data. Has someone already done it?

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @990consulting ,

    It would be possible to have a tree-like effect if you made heavy use of child rows as in this example here. The problem with doing it that way is that it prevents a lot of the table functionality, such as searching and ordering. It could work, but wouldn't be as slick as the example you posted.

    Cheers,

    Colin

  • allanallan Posts: 63,368Questions: 1Answers: 10,449 Site admin
    Answer ✓

    I'm sorry - DataTables does not currently support a tree view. I've long thought that it would be possible using a custom filter and fixed sorting information, but its not something I've actually tried to implement yet I'm afraid.

    Allan

  • 990consulting990consulting Posts: 23Questions: 7Answers: 0

    Hi Allan,

    You've done plenty. :) Just wondering.

    Thanks,
    David

This discussion has been closed.