Load a branch in tree

Hi,
I am using a hierarchical tree that works fine. But when I try to load a given branch after adding it, it puts all child items as first level of the new branch. I understand that it is due to the way load on demand works, but I want to load the complete branch at once. Is there a way to accomplish this?
I am using tree.parse to load the branch. The get I am calling returns data like
// typical loadBranch response
// {"parent":"2","data":[{"id":5,"value":"List"}]}

treeB.parse(webix.ajax().get(url).then(function (data) {
return data = data.json();

how can I load the complete branch? Or should I recursively load it?
Thanks.

Comments

  • Hello, @ftedin

    The nested hierarchy of records can be loaded at once if items have the default structure (similar to the full JSON that can be loaded to the tree). In such case, the incoming records will be loaded/parsed as usual (regarding the specified parent)
    You could use for that purpose loadBranch method that allows you to load data to the specified branch, as direct children of the node with the ID provided. The thing is that you are supposed to put the data to the hierarchy structure.

    Here is the snippet: https://snippet.webix.com/wd7rdxiq

    On the other hand, you could also use parse method. But the data still should be with the same structure.
    Snippet ts there: https://snippet.webix.com/yl4y86yx

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion