Hello,
I have a TreeView that loads very slowly taking about 5 seconds, attatched is a image of what the treeview looks like with around 350 nodes(The most nodes we ever would have is around 900), the code looks like this:
<ej:treeview
ID="TreeViewPracticeTests"
runat="server"
DataTextField="Text"
DataIdField="ID"
DataParentIdField="ParentID"
ClientSideOnNodeChecked="onCheckProdNode"
ClientSideOnNodeUnchecked="onUnCheckedProdNode"
ClientSideOnCreated="onCreate"
DataHasChildField="HasChild"
DataExpandedField="Expanded"
ChildrenAsTriggers="False"
ShowCheckbox="True" DataIsCheckedField="NodeChecked">
</ej:treeview>
<asp:HiddenField ID="PracticeTestTreeViewCheckedList" runat="server"/>
OnNodeChecked and OnNodeUnchecked I just get a list of the ids and save them to the hiddenfield, so I have access to them on the code behind.
Those javascript methods look like this:
function onCheckProdNode(args) {
var lstChecked = args.currentCheckedNodes;
var arr = [];
for (var i = 0; i < lstChecked.length; i++) {
if (lstChecked[i].id > 0) {
arr.push(lstChecked[i].id);
}
};
var valuefromHiddenField = document.getElementById('<%=PracticeTestTreeViewCheckedList.ClientID%>').value;
if (valuefromHiddenField == "nothing") {
document.getElementById('<%=PracticeTestTreeViewCheckedList.ClientID%>').value = arr.toString();
} else {
var arrOldItems = document.getElementById('<%=PracticeTestTreeViewCheckedList.ClientID%>').value.split(',');
var newArr = arr.concat(arrOldItems);
document.getElementById('<%=PracticeTestTreeViewCheckedList.ClientID%>').value = newArr.toString();
}
}
I have tried to use loadOnDemand but that doesn't seem to work because if a parent node is selected it doesn't have the ids of the child nodes that were selected, because it is not expanded yet.
I previously had this in a asp treeview and there were no speed issues. I don't know if there is something else I can do to make the performance better?
Thanks
Attachment:
TreeViewImage_81a03826.zip