Is there a way to pass back arbitrary data to the server when dynamically loading child nodes? The query string contains only two values: continue=true and parent=X. I would like to pass back maybe key:value stored in the node.
continue=true is just a marker that this query is a auto generated dynamic request, not the original data loading request ( it may matter for dyn. loading in datatable, where you may want to provide datatable’s configuration as part of initial data loading )
As for extra parameters - yep, you can do it like next
I see the onBeforeContextMenu and onAfterContextMenu… But I would like to see an example of popping a custom context menu depending on which tree node I click.
You can create a few menu instances and show necessary one from onBeforeContextMenu or use a single menu instance and just user filter api to show|hide some options from onBeforeContextMenu handler
In the onBeforeContextMenu handler you can use this.getItem(id) to get full info about item which was right-clicked.
Can onDataRequest be used for trees that are hybrid, i.e. with the first level of nodes defined in data, and the second level loaded dynamically? I’ve spent a lot of time reading bits and pieces scattered about the docs and the forum trying to figure out paging for loading tree nodes dynamically, but due to lack of documentation, I have to give up.
The second part of problem is the bug in Webix, that causes second data loading call. I have added the line at bottom of above snippet, that can be used as temporary fix. Correct fix will be available as part of the next build.
Is return false at the end of onDataRequest necessary? The documentation says the function returns void and in practice removing return false didn’t make any difference.
When event doesn’t return false, component will try to apply default auto-loading logic. As in above case component was loaded from local data it will not have any visible effect.
In case of loading from the server ( .load, or by url property ) component will try to load the same url with extra parameters.
I have marked to update the related article in docs
You might have already seen a comment on this on GitHub.
Function signature is based on:
parameters from @params section. It is important to specify parameter types although they are not seen in the table. Parameters can be compulsory (entered via a hyphen) and optional (entered via an asterisk)
return value from @returns section.
API doc template type (api_method, api_config, api_event) that hints which pattern should the engine use for parsing.