This is a migrated thread and some comments may be shown as answers.

Check/Uncheck node on ClientNodeClickedEvent

2 Answers 30 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
JX
Top achievements
Rank 1
JX asked on 07 Feb 2011, 08:03 AM
i'd like to have the user be able to click a treeviewnode, to check/uncheck the radtreeview (with checkboxes enabled).
in other words, i use the click event of the node, and
  if the node is checked for that click event, uncheck it. 
  if the node is unchecked for that click event, check it.

this portion works to check and unchecked node, but when a checked node is selected, the node stays checked, and does not change to Unchecked.

 

 

 

//Changes check status of node when clicked
 function ClientNodeClicked(sender, eventArgs)
 {
    var node = eventArgs.get_node();
    if (node.checked)
        {
            node.set_checked(false);
        }     
    else if (!node.checked)
    {
         node.check();
    }
 }

i also tried node.uncheck();
but no success.

please help to have the node unchecked on the click event, if the node is checked.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 07 Feb 2011, 09:20 AM
Hello,


Try the following client side code for this purpose.

client code:
function OnClientNodeClicked(sender, args) {
    var node = args.get_node();
    node.set_checked(!node.get_checked());
}



-Shinu.
0
JX
Top achievements
Rank 1
answered on 07 Feb 2011, 09:26 AM
brilliant, thanks!!
Tags
TreeView
Asked by
JX
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
JX
Top achievements
Rank 1
Share this question
or