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

[Solved] trackChanges() not working for unchecked nodes?

4 Answers 212 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Chris Sears
Top achievements
Rank 1
Chris Sears asked on 01 Feb 2008, 07:49 AM
I'm trying to implement a "check all children" scenario in RadTreeView. Basically, when a user checks a parent node, all child nodes should be checked and disabled. When a parent node is unchecked, all child nodes should be unchecked and enabled.

When nodes are checked using client side code, everything seems to work fine. However, if a child node was checked when the page was loaded and only client-side code is used to uncheck it, the node is reported back to the server as being checked.

Is it possible that unchecking a node isn't successfully tracked by trackChanges() and commitChanges()?

Here's the client-side code I'm using:

function onUnitNodeChecked(sender, eventArgs){
    var node = eventArgs.get_node();
    var childNodes = node.get_nodes();
    if (childNodes.get_count() == 0) {return;}
    var tree= $find("<%= tvUnits.ClientID %>");
    tree.trackChanges();
    if (node.get_checked()){
        checkAllNodes(childNodes, true);
    } else {
        checkAllNodes(childNodes, false);
    }
    tree.commitChanges();
}

function checkAllNodes(nodes, check){
    for (var i=0; i<nodes.get_count(); i++){
        var node = nodes.getNode(i);
        if (check){
            node.set_checked(true);
            node.set_enabled(false);
        } else {
            node.set_enabled(true);
            node.set_checked(false);
        }
        checkAllNodes(node.get_nodes(), check);
    }
}

4 Answers, 1 is accepted

Sort by
0
Josh
Top achievements
Rank 1
answered on 04 Feb 2008, 06:19 AM
I have almost same issue. I was using the same JS code as the client side checkbox demo. Even adding the trackChanges() & commitChanges() methods doesn't help. What happens is when I postback it just sends what I used to have selected BEFORE I use the parent node to deselect/select the nodes.

I have another issue involving the client side select method as well but I will start new thread.
0
Simon
Telerik team
answered on 04 Feb 2008, 05:10 PM
Hi Chris,

This turns out to be a bug with the RadTreeView control and it is being tracked for fixing. Thank you for reporting it.

Greetings,
Simeon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jason Maronge
Top achievements
Rank 1
answered on 04 Feb 2008, 05:54 PM
This is good news.  Any idea when this fix would be available?

Jason
0
Simon
Telerik team
answered on 05 Feb 2008, 02:15 PM
Hello Jason Maronge,

The fix will be included in the next SP2 of the controls.

Regards,
Simeon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
TreeView
Asked by
Chris Sears
Top achievements
Rank 1
Answers by
Josh
Top achievements
Rank 1
Simon
Telerik team
Jason Maronge
Top achievements
Rank 1
Share this question
or