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

nodeCheck function doesn't seem to be working

4 Answers 68 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Emily Hatch
Top achievements
Rank 1
Emily Hatch asked on 19 Nov 2010, 10:40 PM
I am attempting to use the nodeCheck functionality within an OnChecked event.  I need to be able to uncheck the passed item under certain circumstances.  I am using the following code:

function OnChecked(e) {
    //logic here to determine if uncheck is needed....

    $('#TreeView').data('tTreeView').nodeCheck(e.item, false);
}

Nothing seems to happen - the item remains checked.  The e.item is returning properly and I can get the Text and Values, as well as the current checked status.

My current setup
  • ASP.NET MVC version :  2
  • OS : Windows 7
  • exact browser version : Firefox 3.6.12 / IE 8.0.7600.16385
  • exact version of the Telerik product :  Extension for ASP.NET MVC Q3 2010
  • preferred programming language (VB.NET or C#)  : C#

  • Thanks,
    Emily

    4 Answers, 1 is accepted

    Sort by
    0
    T. Tsonev
    Telerik team
    answered on 23 Nov 2010, 10:20 AM
    Hi Emily,

    Instead of trying to un-check the item you can cancel the onChecked event:

    function OnChecked(e) {
        //logic here to determine if uncheck is needed....
        e.preventDefault();
    }

    I hope this helps.

    Greetings,
    Tsvetomir Tsonev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    0
    Emily Hatch
    Top achievements
    Rank 1
    answered on 25 Nov 2010, 01:38 AM
    Thanks - that works great for the uncheck option. 

    If I wanted to check something, the nodeCheck method seems like the best way to go, if it works.  Is there another option?
    0
    T. Tsonev
    Telerik team
    answered on 25 Nov 2010, 09:27 AM
    Hello Emily,

    The current node will get checked if you don't cancel the onChecked event. The nodeCheck method can be used for checking/un-checking other nodes:

    var treeview = $("#TreeView").data("tTreeView");
    var item = $("li:first", treeview.element)[0]; //DOM element
    treeview.nodeCheck(item, true);

    Greetings,
    Tsvetomir Tsonev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    0
    Emily Hatch
    Top achievements
    Rank 1
    answered on 01 Dec 2010, 06:30 PM
    Thanks for the help - everything is working as expected per your comments above.
    Tags
    TreeView
    Asked by
    Emily Hatch
    Top achievements
    Rank 1
    Answers by
    T. Tsonev
    Telerik team
    Emily Hatch
    Top achievements
    Rank 1
    Share this question
    or