Why does ui.context_menu() not work for ui.tree? #4010
-
QuestionWy does the ui.context_menu() not work for ui.tree ? |
Beta Was this translation helpful? Give feedback.
Answered by
falkoschindler
Nov 21, 2024
Replies: 2 comments 2 replies
-
@cwfbss Can you, please, try to create a minimum reproducible code example? What have you tried? What exactly does not work? This would allow us and the community to help more efficiently. Thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
-
just for the sake of simplicity: with ui.tree([
{'id': 'numbers', 'children': [{'id': '1'}, {'id': '2'}]},
{'id': 'letters', 'children': [{'id': 'A'}, {'id': 'B'}]},
], label_key='id', on_select=lambda e: ui.notify(e.value)):
with ui.context_menu():
ui.menu_item('..any action on current selection..')
ui.menu_item('Move directory / file to...')
ui.separator()
ui.menu_item('Reset', auto_close=False) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I see. The problem seems to be that
with ui.tree(): ...
want's to populate the tree's default slot, but there is no such slot. Quasar's QTree only has slots for individual node headers and bodies. You can use them to add context menus like this: