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

I can't access the RadTreeView.commitChanges() in client side

1 Answer 77 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ram
Top achievements
Rank 1
Ram asked on 24 Jul 2010, 05:32 AM

This is My ClientSide code ,I am planing to sort the Tree items using MoveUp and move down option in Context menu

function RadTreeView1_ClientContextMenuItemClick(sender, eventArgs) {
            //to get the direction
            var Direction = eventArgs._menuItem.get_text();
            //to get the position clicked
            var Index = eventArgs._node.get_index();
            //to get the lenght of the tree node
            var length = eventArgs._node._parent._children._array.length;
            //to get all siblings
            var nodes = eventArgs._node._parent._children._array;
            var counter;

            if (Direction == "Move Up") {
                temp = eventArgs._node.get_text();
                eventArgs._node.set_text(eventArgs._node.get_previousSibling().get_text());
                eventArgs._node.get_previousSibling().set_text(temp)
            }
            else if (Direction == "Move Down") {
                temp = eventArgs._node.get_text();
                eventArgs._node.set_text(eventArgs._node.get_nextSibling().get_text());
                eventArgs._node.get_nextSibling().set_text(temp)
            }
            eventArgs._node.get_treeView().commitChanges(); 
             var tree = document.getElementById("ctl00_TreeContentPlaceHolder_RadPanelBar1_i0_RadTreeView1");
             tree.commitChanges();
           
      }

Move up and down is achived in the code but still i can not able to retain the sorted order of the Treeview using the code
In tree object i can not able to find any method like commitChanges()
it thoroughs an error says it can not contain any method,
please help me out to complete the task as soon as possible,this is urgent.
Thanks in advance





1 Answer, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 27 Jul 2010, 03:28 PM
Hello Ram,

The problem is that you are using the domElement of the RadTreeView and you are trying to call the commitChanges() method from there.

var tree = document.getElementById("ctl00_TreeContentPlaceHolder_RadPanelBar1_i0_RadTreeView1");
           tree.commitChanges();

You need to work with the client-side object found this way:

var tree= $find("<%= RadTreeView1.ClientID %>");

Also in the code you provided I see you are working with the private fields of the RadTreeView:

eventArgs._node.set_text(eventArgs._node.get_nextSibling().get_text());

However this is not appropriate because if we change something in this fields your code will stop working. I'll suggest you to use the public propeties as described in this help topic.

Please let me know if you have further questions.

All the best,
Veronica Milcheva
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
Tags
TreeView
Asked by
Ram
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Share this question
or