See snippet https://snippet.webix.com/lq2u96vq
I am trying to achieve 2 things.
How do I select the first item "root", before the first render. i.e. there must always be a selected item
The context menu allows renaming, adding and deleting nodes. The rename option can be accomplished by double clicking with the mouse, BUT, how do I invoke this functionality from the Rename option in the context menu, i.e. in the contextClickProcess method.
Comments
https://docs.webix.com/api__link__ui.tree_ready_config.html
https://snippet.webix.com/c80bx9rm
integral, thanks for your help.
top class support service
Hello, @ Michael_Ross
Please, pay attention, in your snippet data from collection to tree are transmitted twice: the first time - via
data
and then via.sync()
. It's better to leave only one option.Both methods provide the same result, but
ready
will be called only if the source is defined asdata
.When using
.sync()
to choose the first entry and perform the correct select the best solution is to apply (sync callback)[https://docs.webix.com/desktop__data_binding.html#syncingcomponents]In addition to the Example with
edit
, I'd like to propose you an alternative variant (it's not necessary, but could be useful).If the context menu should open an editor on the item from which it was called, you can pre-select this item and/or use getContext() method to locate the target item (as an alternative of getting the selection)
Above all
select
could be transferred to that entry, which allows synchronizing all entriesHere is an example: https://snippet.webix.com/i4d26opk
Yes, I see many thanks, will refactor my code.