treeview:how to get the selected node on javascript click event

N

Naim Rizk

hi,
I have a treeview with nodes that contain images of a checkbox. it can
be an image of a checked or unchecked checkbox. When a user click on a
node the image of the checkbox will change from checked to unchecked and
vice versa. And of course that will be done on the client side.

i added this javasript function.

function myfunction(){
SelectedNode =
event.srcElement.getTreeNode(event.treeNodeIndex);
if (SelectedNode.ImageUrl == "image1") {
SelectedNode.ImageUrl= "image2";
else
SelectedNode.ImageUrl= "image1";
}

anyway event.srcElement.getTreeNode(event.treeNodeIndex) is returning
null.
 
N

Naim Rizk

i just found that I can display a checkbox treeview by setting the
checkbox propety of the node to true. so my problem is solved. but
anyway if someone can tell we how we can get the selected node in
javascript and change the image,the text... i'll appreciate it

Naim
 
R

rune solheim

Hi,

try to use:
SelectedNode =
event.srcElement.getTreeNode(event.srcElement.clickedNodeIndex);

instead of:
SelectedNode = event.srcElement.getTreeNode(event.treeNodeIndex);

/Rune
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top