Skip to content

Nicegui Tree with toggle buttons #3085

Closed Answered by falkoschindler
Ottokranz asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Ottokranz,

This one is a bit tricky. For some reason the toggle component seems to be nested more deeply, so that we need to write $parent.$parent.$parent.$emit() to emit from the tree element. I wonder if there's a more elegant way to do that.

And to reflect the toggle value in the data model, we need to handle the event arguments and update the nodes accordingly. Unfortunately there's no API for iterating nodes or searching them by ID, so we need to implement it ourselves:

nodes = [
    {'id': 'numbers', 'description': 'Just some numbers', 'update': True, 'children': [
        {'id': '1', 'description': 'The first number', 'update': False},
        {'id': '2', 'description': 'The se…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Ottokranz
Comment options

@Ottokranz
Comment options

@falkoschindler
Comment options

@Ottokranz
Comment options

Answer selected by Ottokranz
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