Lazy Loading items in the Tree in File Manager

We’re evaluating the Webix File Manager and we like the tree you have in the left hand side of the File Manager. I would like to know if it would be possible to do lazy loading of the items in the tree. For e.g., I don’t want to load all the items in the hierarchy in a single go to create the tree. I will first populate just the first level of the tree and when the user clicks a particular folder, we will download the contents of that folder from the server side and expand the tree for that folder. Can this be done?

Hello,

Yes, FileManager supports dynamicac loading. Please take a look at the docs and demo:

http://docs.webix.com/file_manager__loading_data.html#dynamicloading

http://docs.webix.com/samples/64_file_manager/04_loading/01_dynamic_loading.html

I am trying to load dynamically for Webix tree-

This is the code I currently have:

//For ROOT

  1. url:‘api/fulltree/getChildrenOfNode?nodeType=root’,
    // For [sub] directories
  2. on:{
  3. onDataRequest: function (id) {
  4.    webix.message("Getting children of " + id);
    
  5.      this.parse(
    
  6.      webix.ajax().get('api/fulltree/getChildrenOfNode?
    
  7. nodeId=’+id+’&nodeType=’+type).then(function(data) {
  8.              return data = data.json();
           })
    
    );
  9.    return false;
     }
    
    }

As you can see, on line 7, I will need to include a type reference to the API I have for returning the subdirectories. However, I am unable to do so since I can only use the ‘id’ parameter for onDataRequest. My website previously used a jstree and their function looked like “function(Node node)” and I could reference the id using “node.id” and the type as “node.type”.

My JSON looks like :
0:
id:“5b29972ae84a74665fb473ea”
“type”: “space”,
value:“vibhav”
webix_kids:false
1:
id:“5b2c0b83b64a35912886b207”
type:“collection”
value:“vibhav”
webix_kids:false
2:
id:“5b2b183bb64a7d2cad311baf”
type:“collection”
value:“lol”
webix_kids:false
3:
id:“5b2af7c0b64a7d2cad311b69”
type:“collection”
value:“knknnk”
webix_kids:true

How could I reference the ‘value’ in the API call.
Any help from the technical team will be greatly appreciated. I really want to use Webix.

Hello,

You can read any property of a tree node with the getItem method that can access a node by its id:

url:'api/fulltree/getChildrenOfNode?nodeType=root',
on:{
  onDataRequest: function (id) {
    var node = this.getItem(id);
    console.log(node); //log node object

    this.parse(
       webix.ajax().get(
          'api/fulltree/getChildrenOfNode?nodeId='+id+'&nodeType='+node.type
        ).then(function(data) {
          return data = data.json();
       })
     );
    return false;
  }
}