|
Rank: Advanced Member Groups: Member
Joined: 8/24/2007 Posts: 130
|
Hi,
I am using a treeview to display dynamically configured data. There are context menus on various nodes on the tree that allow the user to create or remove child nodes.
I initially designed the page so that the tree would databind onto the underlying object graph. Any time a node was created or removed, the object graph would be modified appropriately, and the tree re-bound. Unfortunately, I was finding that once the tree got to a certain size (more than about 50 nodes) performance was getting very slow.
I have now redesigned the page so that it now populates nodes on demand. This code is working fine, but I am still getting serious performance issues in IE. What I am finding is that when the user creates a new node, the page is still taking a VERY long time to render on callback (in excess of 20 seconds). Please note the following:
1. The tree view is hosted in a callback panel. 2. Viewstate on the treeview is switched off. 3. A context menu instruction to create a node calls eo_callback. In the page execute handler, the object graph is modified, and the tree is collapsed back to root node. 4. When the callback completes, the page takes about 20 seconds to render client side (I noted that there is 100% CPU usage on IE process). I cannot understand this, as it is only rendering the root node at this point. 5. Auto-populating nodes never takes this long. 5. When using Firefox, we do not get this long client side render time (takes only 3 or 4 seconds).
I really hope you can help me with this issue. I have spend several days re-coding this page to use populate on demand, as I was led to believe that this would solve the issue, but it has not.
Thank you.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
What you are doing is not populate on demand. Populate on demand is enabled by setting a TreeNode's PopulateOnDemand to true and handle the TreeView's ItemPopulate event. When you use the CallbackPanel, the whole TreeView is refreshed, that's why it takes so long.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 8/24/2007 Posts: 130
|
Thanks for the reply. I think that I probably didn't explain enough. I am setting each node to populate on demand and I am using the ItemPopulate event. The problem I describe is still happening. I am wondering if it is to do with the system chaining calls to ItemPopulate on callback (as I have read that this happens in your help).
Incidentally, for an average spec machine, how many nodes would you expect an IE browser to be able to render before performance issues tend to be experienced? I am finding that this number is not very large.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, IE is not very good at large number of named DTHML element, but I believe the problem in your case is that you are using the CallbackPanel to update the whole TreeView, which completely defeats the purpose of populate on demand. If you just use populate on demand, it should not be that long because it doesn't have to create a lot of items. You should try to replace your eo_Callback with this function: http://www.essentialobjects.com/ViewDoc.aspx?t=JSDoc.Public.TreeNode.populateOnDemand.htmlThanks
|
|
Rank: Advanced Member Groups: Member
Joined: 8/24/2007 Posts: 130
|
Hi, thanks again for the reply.
I have played with my code for a bit, and found that using the populateOnDemand client side function does indeed significantly speed up the process. Unfortunately, it does not solve my problem.
My treeview contains nodes with associated context menus. The context menu actions are either to create a new child node or delete the current node.
If I try to use populateOnDemand to create a new node, this works fine first time. But if I try to create a second node, the server side ItemPopluate handler is not fired (presumably because the system knows that the node has already been populated).
If I try to use populateOnDemand to delete an existing node, then I find that the parent node is not available to me in the server side ItemPopulate handler, and so I am therefore unable to delete the node.
Ahhh... please help!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Then you are probably out of luck here. The ultimate solution for this probably is to create/delete all the nodes on the client side and then submit all the changes to the server once, unfortunately this is not supported yet. As soon as you update a huge TreeView as a whole, it will take that long and we do not see any ways around it. Sorry about it!
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 8/24/2007 Posts: 130
|
Thing is, this is not a particularly big tree view (only about 30 nodes visible at any time in total).
Is there any way to mark a node as un-expanded in order to fire the item populate event?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
In that case you might want to try without CallbackPanel. As for making a node unexpanded, unfortunately no. The reason is all changes made by ItemPopulated event are accumulative. So once the page goes back to the server side, all previous ItemPopuplated calls are replayed in order to produces the same result. Merely setting a node to unexpanded without modifying that part will cause serious problem.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 8/24/2007 Posts: 130
|
How would you recommend I go about doing this without a callback panel? I assume I would need to handle the context menu click event client side, and manipulate the tree at this point. If this is the case, do you think that this would give me noticable performance improvements? (obviously we would have to put up with the postback page flicker)
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We have never had reports that 30 nodes would take 20 seconds to load. You can check out our own demo page or document page and you will see all of them loads on seconds. So if you don't have that many nodes, then load should be fast. If you do have a lot nodes, then there is no solution for the problem.
The easiest way for you go without CallbackPanel is to set the context menu's RaisesServerEvent to true. You can then handle the ContextMenu's ItemClick event on the server side and use TreeView.ContextNode (this property is new, so make sure you have the latest build) to get the node that triggered the context menu.
Try it in blank page without master page first to make sure the problem is not created by other contents in your page.
Thanks
|
|