请看:
节点全部选中的实现:
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);
}
}
}
{
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 );
}
}
{
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 );
}
}
节点的展开和折叠实现:
{
var NodeArray = node.getChildren();
for ( var i = 0 ;i < NodeArray.length;i ++ )
{
cNode = NodeArray[i];
cNode.setAttribute('checked', false );
}
}
//
TreeView的节点展开收回
function ExpandAllNodes()
{
var tree = document.getElementById(' <%= tvRoleFunctions.ClientID %> ');
Expandedall(tree);
}
function CollospaeAllNodes()
{
var tree = document.getElementById(' <%= tvRoleFunctions.ClientID %> ');
Unexpandedall(tree);
}
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);
}
}
}
{
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 " );
}
}
这个怎么调用就不用说了吧!呵呵........
{
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 " );
}
}
下次写作预告:
在Firefox下TreeView的父子节点联动实现、节点的全部选择和节点的展开和折叠实现.....