How to create a collapsing tree table in html/css/js?

后端 未结 6 1085
故里飘歌
故里飘歌 2020-11-30 19:46

I have some data to display that is both tabular and hierarchical. I\'d like to let the user be able to expand and collapse the nodes.

Sort of like this, except func

6条回答
  •  攒了一身酷
    2020-11-30 20:31

    I'll throw jsTree into the ring, too. I've found it fairly adaptable to your particular situation. It's packed as a jQuery plugin.

    It can run from a variety of data sources, but my favorite is a simple nested list, as described by @joe_coolish or here:

    • Item 1
      • Item 1.1
      • ...
    • ...

    This structure fails gracefully into a static tree when JS is not available in the client, and is easy enough to read and understand from a coding perspective.

提交回复
热议问题