473,395 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

accessing subnodes in TreeView from javascript


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
Nov 17 '05 #1
1 1839

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

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Kristofer Andersson | last post by:
I am using xslt to transform some parts of a document but want to output some parts of the document just like they are (node with all subnodes and attributes). Below are the templates I am...
0
by: Pat Roy | last post by:
Hello... I've created a treeview that looks something like: Root .....Folder1 .........Subfolder1A .............File .............File .........Subfolder1B
10
by: Dan Nash | last post by:
Hi peeps.. Im using the TreeView control from IE COntrols to create a directory structure, and trying to do it recursively. The code works, but my question is simply how can I make the subdirs...
3
by: Peter | last post by:
Hello, We are inserting a side menu to our application using a class that is writing HTML on all our pages. This is a part of the code as an example: writer.Write(" <table WIDTH=""100%""...
10
by: p3t3r | last post by:
I have a treeview sourced from a SiteMap. I want to use 2 different CSS styles for the root level nodes. The topmost root node should not have a top border, all the other root nodes should have a...
1
by: Victor Rodriguez | last post by:
Is there a way that I can have a client side event like oncontextmenu="showfunction();" on each node? thanks, Victor
8
by: Matt MacDonald | last post by:
Hi All, I have a form that displays hierarchical categories in a treeview. Ok so far so good. What I was to do is have users be able to select a node in the treeview as part of filling out the...
0
by: jalicej | last post by:
In my C# web application i have a treeview control with showcheckboxes = All . So for each node the check box is shown. When i check on the parent node all its child nodes should be checked...
0
by: Limno | last post by:
Hi, I have a treeview control with showcheckboxes = All in my C#.net web application. When i check on the child node its parent node should be checked automatically.similarlly when i uncheck...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.