Check/Uncheck node on ClientNodeClickedEvent

3 posts, 0 answers
  1. JX
    JX avatar
    7 posts
    Member since:
    Jan 2011

    Posted 07 Feb 2011 Link to this post

    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. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 07 Feb 2011 Link to this post

    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.
  3. JX
    JX avatar
    7 posts
    Member since:
    Jan 2011

    Posted 07 Feb 2011 Link to this post

    brilliant, thanks!!
Back to Top