Skip to content

datatree expand/collapse/toggle all children with button #155

Answered by billcla
billcla asked this question in Q&A
Discussion options

You must be logged in to vote

It was me... funnily enough! I had a seperate function from a previous test that was causing issues.

Essentially this disables the ability for a user to collaspe a tree by setting the "dataTreeStartExpanded": True within the table options, and then on the event of someone collapsing the tree:

self.tabulator_1.on("dataTreeRowCollapsed", self.row_expand)

Which calls:

def row_expand(self, row, level):
    print(f"row: {row}")
    print(f"level: {level}")
    row.treeExpand()

This instantly expands the tree to keep it open, which is what I needed in my use case. The print lines can be ommited or hashed out as are just there for testing/debugging.

Thanks for listening to an idiot rant... ;-)

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@s-cork
Comment options

@billcla
Comment options

@s-cork
Comment options

@billcla
Comment options

Answer selected by billcla
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants