Reload treeNode data - LazyLoading

Posted by: gkukko on 27 May 2018, 11:50 pm EST

    • Post Options:
    • Link

    Posted 27 May 2018, 11:50 pm EST

    Hi,

    I am having treeview which loads data using lazyload function. I checked the thread https://www.grapecity.com/en/forums/wijmo/is-there-any-method-to-tri_1, but it shows how to reset data to empty, so data can be fetched on next click event.

    I am trying to reset the data and expand the selected node so data can be fetched as soon as we set it to blank.

    If I try to explicitly invoke click event then it doesn’t do anything. If I manually click on node, then it fetch data as expected. I am using below code for this.

    ```

    const tv = node.treeView;

    node.setCollapsed(true, false, true);

    node.dataItem[‘items’] = ;

    tv.loadTree(true);

    node.element.click();

    
    Please let me know if you need any additional information.
  • Posted 28 May 2018, 6:07 pm EST

    Hi,

    If we understand correctly then you want to reload a node’s data programmatically (without click on tree node).

    In that case you actually don’t need to use the lazy load function, you can directly change the node’s dataItem and reload the tree.

    refer to the following code snippet:-

    
    const tv=node.treeView;
    
    /* load node data */
    
    var data=loadNodeData();
    
    node.dataItem['items']=data;
    
    /*reload tree view*/
    
    tv.loadTree(true);
    
    /*set node's collaped state as desired */
    
    node.setCollapsed(true, false, true);
    

    Please let us know if you have further queries.

    ~Manish

  • Posted 13 June 2018, 6:30 pm EST

    Thanks Manish.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels