Let's continue with the previous one. We have some sleep :) (the German VS team last night was amazing). I still want to finish writing it. How can we implement the Select All TreeView function for All nodes today? How can we expand and collapse freely?
See:
Implementation of Selecting All nodes: function SelectAllFunctions ()
{
Var tree = document. getElementById ('<% = tvRoleFunctions. ClientID %> ');
Var chckAll = document. getElementById ('<% = chSelectAll. ClientID %> ');
Var NodeArray = tree. getChildren ();
For (var I = 0; I <NodeArray. length; I ++)
{
CNode = NodeArray [I];
If (chckAll. checked)
{
CNode. setAttribute ('checked', true );
GetSelectedFunctionID (cNode );
Checked (cNode );
}
Else
{
CNode. setAttribute ('checked', false );
UnChecked (cNode );
}
}
}
Function Checked (node)
{
Var NodeArray = node. getChildren ();
For (var I = 0; I <NodeArray. length; I ++)
{
ChildNode = NodeArray [I];
ChildNode. setAttribute ('checked', true );
}
} Function UnChecked (node)
{
Var NodeArray = node. getChildren ();
For (var I = 0; I <NodeArray. length; I ++)
{
CNode = NodeArray [I];
CNode. setAttribute ('checked', false );
}
}
Expand and collapse a node: // detach a node in the TreeView
Function ExpandAllNodes ()
{
Var tree = document. getElementById ('<% = tvRoleFunctions. ClientID %> ');
Expandedall (tree );
}
Function CollospaeAllNodes ()
{
Var tree = document. getElementById ('<% = tvRoleFunctions. ClientID %> ');
Unexpandedall (tree );
} Function Expandedall (node)
{
Var I = 0;
Var nodes = new Array ();
Nodes = node. getChildren ();
// Alert (nodes. length );
For (I = 0; I <nodes. length; I ++)
{
Var cNode;
CNode = nodes [I];
CNode. setAttribute ("expanded", "true ");
If (parseInt (cNode. getChildren (). length )! = 0)
{
Expandedall (cNode );
}
}
} Function Unexpandedall (node)
{
Var I = 0;
Var nodes = new Array ();
Nodes = node. getChildren ();
For (I = 0; I <nodes. length; I ++)
{
Var cNode;
CNode = nodes [I];
If (parseInt (cNode. getChildren (). length )! = 0)
{
Unexpandedall (cNode );
}
CNode. setAttribute ("expanded", "false ");
}
}
You don't need to call this! Haha ........
Next writing notice:
In Firefox, the parent-child node Association implementation of the TreeView, the selection of all nodes, and the expansion and collapse of nodes are implemented .....