Hi again,
Accessing the child nodes wasn't that much of a problem. The bigger problem
was
disabling them, which required (from what I have found) making changes in
the
control itself, to support a new attribute - "disabled".
Here is the the resulting code:
Add eventhandler:
oncheck="javascript
: if (this.clickedNodeIndex != null)
__disableChildNodes(this);"
// Select and disable all child nodes under the recently clicked node
function __disableChildNodes( tree )
{
var node = tree.getTreeNode(tree.clickedNodeIndex);
var state = node.getAttribute('checked');
__setChildNodesState( node, state );
}
function __setChildNodesState( node, state )
{
var children = node.getChildren();
if ( children[0] != undefined )
{
for (var i = 0; i < children.length; i++)
{
children[i].setAttribute('checked',state);
children[i].setAttribute('disabled',state);
__setChildNodesState( children[i], state );
}
}
}
"Johan Åhlén" <jo***@NObostadstipsSPAM.com> wrote in message
news:eh**************@TK2MSFTNGP12.phx.gbl...
Hi,
Does anybody have any idea how to access child nodes in a TreeView
without using postbacks?
For example: in the subtree below I want to disable nodes B, C and D
when A is checked (and enable them again when A is unchecked):
Subtree:
[ ]A---[ ]B
|----[ ]C
|----[ ]D
I want to do this entirely in javascript. Any idea how to access the state
of the child nodes from the eventhandlers?
Thanks for any help!
Johan
---
Johan Åhlén
Bostadstips Sverige AB
Email: jo***@NObostadstipsSPAM.com <-- remove NOSPAM to email me
Web: http://www.bostadstips.com
Tel +46 31 842500