I'm using a WebDataTree, which is being populated server-side. I want to use the CSOM to manipulate some of the nodes, but I'm running into a problem. I've been able to find a reference to the tree using JavaScript, but my issue is that the node collection is not fully populated when the page loads. For example, if I load 12 nodes into the tree in C#, and then look at the tree in JS, I find that even though the result of getNodes().get_length() is 12, if I try to access a node using .getNodes().getItem(i), then I find that the array of nodes is empty. Oddly, it seems that the reference to a given node will only enter the array of nodes when I mouse over it: so, if I mouse over all of the nodes in the tree, I can then find them using getItem(), but I can't expect the user to mouse over all of the nodes, of course.
If this makes a difference, it may be helpful to know that the WebDataTree exists within a WebExplorerBar, which itself resides within a WebSplitter: so the tree is inside an iframe.
Is there a reason that the CSOM model is at odds with the tree? Can I force them to synchronise?
Thank you for the details shared . However, I will appreciate a couple more if possible.1) Is there any server side interaction/event fired between accessing the initial nodes collection and after hovering when the nodes are available? 2) Are you explicitly handling Node Hovered ClientSide event for the WebDataTree? For example in the markup it will look like
<ig:WebDataTree ID="WebDataTreeSample"… <ClientEvents NodeHovered="NodeHoveredHandler"/></ig:WebDataTree>If yes what is the handler function?3) Is the WebDataTree initially bound to all of its’s data, or it is for example rendering only one lv and conditionally fetching additional data from the Server? 4) Additionally, is there UpdatePanel involved in the WebDataTree implementation?5) What is the exact product version you are using? Is it 15.1.20151.2278?
Could be worth to check the following *In case WebTab is used - ViewState is corrupted when you use WebDataTree inside a WebTab. A workaround could be found here: http://help.infragistics.com/Help/Doc/ASPNET/2015.1/CLR4.0/html/Known_Issues_and_Limitations_ASPNET_15-1.html
It will be best if you could share a simple code sample illustrating the issue, as it will shorten the time required for recreating it in the same exact manner.
Thank you for the prompt response!
1) No, there is no other interaction. This behaviour is present when the page loads initially.
2) I'm not handling the NodeHovered event for the tree, no.
3) The tree is not bound to a data source - it is instantiated and then populated using a SQL query. This all happens server-side, during the Page_PreRender event. So, this could be it, then? Is there some extra step I'm missing? I've just been calling .Nodes.Add() on the tree and its nodes repeatedly.
4) Not to my knowledge.
5) My version number is 15.1.20151.2123.
The tree isn't inside a WebTab, unfortunately. It's inside a WebExplorerBar. The structure is Document1.aspx > form > div > WebSplitter > Panes > SplitterPane > Document2.aspx > form > WebExplorerBar (the tree is added programatically to this)
I'll wait for your response about point #3 before I try constructing a code sample, in case the solution is now simple! Thank you.
Hello,
Thanks for the details shared. I have further spend time on this matter.What I suggest is to use get_Node(i) instead of get_item(i); It appears, in order to obtain the nodes via the get_item method, it will require to first hover or access this node like using tree.getNodes().getNode(i) for example. From this point on you could use tree.getNodes().get_item(1) and it will return what you would expect.
To get a specific child node it is possible to use a similar approach like:tree.getNodes().get_Node(i).get_childNode(i).get_text();
-getNodes - Returns the collection of root nodes for the WebDataTree-tree.getNodes().get_length() will as well return the root lv nodes count only.
I expect this API usage will help you continue your work.
This has solved my problem. I'm able to use getNode(i) to retrieve the nodes I need. Thank you, Ivaylo!