Hi All,
I have a webdatatree with the following tree structure:
Status > Alphabet Group > Company Name > Contact Name.
The tree is set to load on demand using the following settings:
WebDataTree.InitialDataBindDepth = 1 // Alphabet Group
WebDataTree.InitialExpandDepth = 0 //Status
When the user adds a new company, for example "Test Corp", is it possible to expand the "T" node and load all the companies that start with "T".
I have managed to expand the "T" node and select the newly added "Test Corp" node, but cannot figure out how to load all the other companies that start with "T".
Thanks!
Hi Michael,
Thanks for the response and sample code. I was able to resolve this using hints from the sample code you provided.
Appreciate it.
Regards.
Hi csggroup,
For the nodes.get_length() issue, when Initialize is called: due to "WebDataTree1.InitialDataBindDepth = 1;" the tree has not bound those children yet, so it is not aware of them. The WebDataTree performs AJAX callbacks to populate the tree nodes when they are expanded by default.
For the issue with SelectionChanged being called, could you provide any more information on the save button and any steps you are taking when this occurs? I haven't been able to reproduce a datamodel that would allow the set_selected to be called in your Initialize code. I've attached a sample that I've been working with, and I can't cause SelectionChanged to fire at all.
Please let me know if you have any further questions with this.
And the other issue is,
var
nodes = sender.getNode(statusIndex).get_childNode(alphabetIndex).get_childNode(entityIndex).getItems();
nodes.get_length() returns 0 randomly. I am not able to pinpoint the cases exactly.
Thanks
(Infragistics version - 11.2.20112.2086)
Thanks for the sample. I alse need to select the newly added node, but am unable to do it server side as the parent node is not expanded yet. The client side script for event Initialize is below. But, setting node.set_selected(true) causes the SelectionChanged event to be fired mysteriously when the save button is clicked next time. Please help.
var entityPath = document.getElementById('<%=uxNewEntityPathHidden.ClientID%>'); if (entityPath.value != "") { var entityPathSplit = entityPath.value.split('.'); var statusIndex = entityPathSplit[0]; var alphabetIndex = entityPathSplit[1]; var entityId = 0; if (entityPathSplit.length == 3) { entityId = entityPathSplit[2]; sender.getNode(statusIndex).get_childNode(alphabetIndex).set_expanded(true); var nodes = sender.getNode(statusIndex).get_childNode(alphabetIndex).getItems(); } else if (entityPathSplit.length == 4) { var entityIndex = entityPathSplit[2]; entityId = entityPathSplit[3]; sender.getNode(statusIndex).get_childNode(alphabetIndex).set_expanded(true); sender.getNode(statusIndex).get_childNode(alphabetIndex).get_childNode(entityIndex).set_expanded(true); var nodes = sender.getNode(statusIndex).get_childNode(alphabetIndex).get_childNode(entityIndex).getItems(); } entityPath.value = ""; for (var i = 0; i < nodes.get_length(); i++) { var node = nodes.getNode(i); if (node.get_key() == entityId) { node.set_selected(true); break; } }
}
Hello csggroup,
Please let me know if you have any other questions or concerns about this issue and I'll be glad to help you.