I have the tree view activated on this site. It has categories in it with the all categories chack activated. Some of the sites this is enabled on have hunderds of categories. The problem comes in where the user clicks the "All Categories" check box and it takes an inordanent amount of time to check or uncheck all the categories. Is there a way around this. I am using the following modified javascript to allow for this action.
function UpdateAllChildren( nodes, checked ) |
{ |
var i; |
for( i = 0; i < nodes.length; i++ ) |
{ |
if( checked ) |
{ |
nodes[i].Check(); |
} |
else |
{ |
nodes[i].UnCheck(); |
} |
if( nodes[i].Nodes.length > 0 ) |
{ |
UpdateAllChildren(nodes[i].Nodes, checked); |
} |
} |
} |
function UpdateTopAllParent( nodes, checked ) |
{ |
var i; |
if(nodes.length == 0){nodes[0].Nodes.UnCheck();} |
for( i = -nodes.length; i = nodes.length; i++ ) |
{ |
if( checked ) |
{ |
nodes[i - nodes.length].UnCheck(); |
} |
else |
{ |
nodes[i].UnCheck(); |
} |
if( nodes[i].length = 0 ) |
{ |
UpdateTopAllParent(nodes[i].Nodes, checked); |
} |
} |
} |
function AfterCheck( node ) |
{ |
var parentNode = node.Parent; |
var currentNode = node; |
if(parentNode == null) |
{ |
if(node.Checked) |
{ |
UpdateAllChildren( node.Nodes, true ); |
} |
else |
{ |
UpdateAllChildren( node.Nodes, false ); |
} |
} |
else |
{ |
if(!node.Checked) |
{ |
while(parentNode != null) |
{ |
currentNode = parentNode; |
parentNodeparentNode = parentNode.Parent; |
} |
currentNode.UnCheck(); |
} |
} |
} |