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.
Unfortunately, activation email could not send to your email. Please try again.

Treeview loading slowly

Thread ID:

Created:

Updated:

Platform:

Replies:

129731 Mar 30,2017 01:10 PM Mar 31,2017 08:06 AM ASP.NET Web Forms 1
loading
Tags: TreeView
Gideon
Asked On March 30, 2017 01:10 PM

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

Ashokkumar Balasubramanian [Syncfusion]
Replied On March 31, 2017 08:06 AM

Hi Gideon,              
 
The performance of the TreeView issue occurs due to the number of nodes with checked state, it takes time to render those nodes with checkbox and processing actions such as “parent node should be checked based on child nodes checked state, and child nodes checked state based on parent checked state”.  
 
However, we have logged “Need to improve the performance of TreeView control with checkbox enabled” as a feature request in our database to optimize the checkbox functionality for improving performance. We will implement this feature in any of our upcoming releases.  
 
Regards, 
Ashokkumar B.   


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;