|
Rank: Newbie Groups: Member
Joined: 7/6/2011 Posts: 3
|
Hi All,
We are using EO.Web Treeview control to bind more than 200 items to it. It is able to bind 200 items datasource successfully. Each node of tree view is having checkbox attached to it. We are having functionality like "Checking All Items In TreeView" and "UnChecking All Items In Treeview".
The problem is when we are doing checking and unchecking functionality we are getting following javascript error : Stop running this script?
A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer might become unresponsive.
The code for checking and unchecking is as follow : var object = eo_GetObject(treeid); object.getTopGroup().getItemByIndex(0).setCheckState(status);
We are having top node which is having all child nodes. The child noes may have other child nodes in turn. As we are having one top node, if we set state of top node , it will going to apply all subsequent nodes. But if we get 200 items(i.e. childnoes) , then it is giving above javascript error message.
Can you please provide your view on this ASAP ?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We can only reproduce the problem at about 800 nodes. However it's quite normal for you you will get that when you try to check/uncheck many nodes at the same time, different machine and tree view configurations may give you different limits.
To permanently resolve the problem, you must avoid checking/uncheck all the nodes inside a single call. You can write a function to check/uncheck a certain number of nodes (for example, 50 nodes), then setup a timer and let the timer to call your function to check/uncheck some more nodes. Repeat this process until all nodes are done (if you have to use AutoCheckChildren, then your code needs to check child nodes first, then check parent node). The key is you have to break a single function call into multiple function calls.
Hope this helps.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 7/6/2011 Posts: 3
|
Hi,
Thanks for your feedback. From following lines of your reply, i just want can you please give us some code example to write such a code which is checking/unchecking certain number of nodes in a chunks(means first 50, then next 50 and so on...) using essential object client side API ?
Thanks...
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, The code will be something like this:
Code: JavaScript
function check_some_nodes()
{
//Return if we are done
if (!more_node_to_check)
return;
//Use getTopGroup(), getItemCount(), getItemByIndex(),
//getSubGroup() to traverse all nodes but stops once you
//reached a certain number of nodes, use global variable
//to remember where you stopped
....check some more nodes...
//Call us again later from a timer
setTimeout(function()
{
check_some_nodes();
}, 10);
}
You will need to take a look of the client side reference section for all the vailable objects/functions: http://doc.essentialobjects.com/library/1/clientapi_howto.aspxThanks
|
|