How to emit callback function in the slot of ui.tree #5564
Unanswered
wasabismile
asked this question in
Q&A
Replies: 1 comment
-
|
Hi @wasabismile, Borrowing from #3085 (reply in thread), here is a working example: tree = ui.tree([
{'id': 'numbers', 'children': [{'id': '1', 'workcontent': 'abc'}, {'id': '2', 'workcontent': 'edf'}]},
{'id': 'letters', 'children': [{'id': 'A'}, {'id': 'B'}]},
], label_key='id')
tree.add_slot('default-body', '''
<q-input v-model="props.node.workcontent" @update:model-value="() => {
let parent = $parent;
while (!parent.$el.classList.contains('q-tree')) parent = parent.$parent;
parent.$emit('rename', props.node);
}" />
''')
tree.on('rename', lambda e: print(e)) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Example Code
Description
I want to update the nodes values by emitting function in ui.tree slot
@update:model-value="() => $parent.$emit('rename', props.node)", but it does not workNiceGUI Version
1.4.37
Python Version
3.11
Browser
Chrome
Operating System
Windows
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions