We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Trying to set loadOnDemand to false to use getNode method (solved)

Hello, 

My code is attached. Version 16.4.42 of syncfusion/ej2-angular-navigations is working in this project. The problem is even if I do getNode() with 'RN_Nicaragua' or with incoming id always returns empty node.

Any solutions?

Also, when I set loadOnDemand to false and clicked on a node, there is a lag between the click and the expansion. This makes expansion performance worse than when loadOndDemand is setted to true. 

Any solutions?

Attachment: codigopng_9829cc72.7z

8 Replies

CI Christopher Issac Sunder K Syncfusion Team December 20, 2018 12:35 PM UTC

Hi Jon Andoni, 

Thank you for contacting Syncfusion support. 

We have checked your reported problem. We suspect that, you have tried to get the node which is not rendered. If you want get to particular tree node data(binded treeview format , not treeview data structure). You can use the getTreeData method to get the corresponding details. For this scenario, don’t need to disable loadOnDemand concepts.  
 
 

Please let us know if you require any further assistance. 

Thanks,
Christo



JA Jon Andoni December 20, 2018 01:49 PM UTC

Hello Christopher,

The thing is that the node "RN_Nicaragua" is expanded on the tree when it is created, so it is rendered. As I wrote, my problem is that even I set loadOnDemand to false (I mean that the complete tree is rendered with this order) when apply getNode() method to the tree always return  empty node, in your example if I set loadOnDemand to false and I try to getNode of a "not rendered" node it returns me the node value. I don´t understand. Refering to getTreeData or updateNode, both works fine.

In this url you can see the behaviour of the code, is a video: 
https://drive.google.com/file/d/1dmHYVHjCeIucRW33jGxTzUa_QhVlThvr/view?usp=sharing

I attach the changes on the code in the next message.

Bye.


JA Jon Andoni December 20, 2018 01:50 PM UTC

Here the changes on the code.

Bye.

Attachment: onNodeClickCode_3aaa09e7.7z


CI Christopher Issac Sunder K Syncfusion Team December 21, 2018 07:25 AM UTC

Hi Jon Andoni, 

We have tried hard to identify your cause of your reported problem, but unfortunately we were unable to find it. Because we were able to get the clicked Node Li element id in nodeClicked event and based on this li element to form the data in getNode method of TreeView. Could you please try the below modified code block in your application?  
   
public onNodeClick(e){ 
    let currLi = e.node; 
    //pass the li element not id 
    console.log(this.treeview.getNode(currLi)); 
} 

Please let us know if you are still facing the issue so that we can create a support incident in DirectTrac to track the problem. 

Thanks,
Christo



JA Jon Andoni January 9, 2019 01:38 PM UTC

Hello Christo,

We probe the solution but doens´t work, still facing the issue.

Thanks.


CI Christopher Issac Sunder K Syncfusion Team January 10, 2019 11:28 AM UTC

Hi Jon Andoni, 

We checked your reported issue in your mentioned scenarios and other possible scenarios available but unfortunately, we were unable to reproduce the case at our end. We were able to get the corresponding clicked node details on nodeClicked event arguments and passing corresponding node id or node element to getNode method could get the needed details. 
So, could you please once ensure if the tree node id for which you are trying to get the node details is present in the corresponding Tree element. If you are still facing this issue could you please reproduce it for us in this sample. 

Note: You need not use refresh method in your code as TreeView is refreshed on binding the fields property to it. 

Please let us know if you have any concerns. 

Thanks, 



JA Jon Andoni January 10, 2019 12:43 PM UTC

Hi Christopher, 
It works! After removing the treeView.refresh() getNode() method works!
Thank you very much!


CI Christopher Issac Sunder K Syncfusion Team January 11, 2019 05:52 AM UTC

Hi Jon Andoni, 

We are glad to hear that the problem has been resolved. Please let us know if you require any further assistance. 

Thanks,
Christo 


Loader.
Live Chat Icon For mobile
Up arrow icon