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

2 posts, 0 answers
  1. Ram
    Ram avatar
    3 posts
    Member since:
    Jul 2010

    Posted 24 Jul 2010 Link to this post

    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





  2. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 27 Jul 2010 Link to this post

    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
Back to Top