Permission Configuration System under asp. net1.1 from design to implementation (IV)

Source: Internet
Author: User
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 .....

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.