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

Set startEdit on node in ClientNodeEditing

1 Answer 33 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jan
Top achievements
Rank 1
Jan asked on 10 Feb 2010, 01:21 PM
Hi Everybody,

I would like to crete new node on clientside and set this node to edit mode. And when user doesn't change the label and click outside, i would like show radalert and cancel postback -  so far so good. But after that I would like to set node to edit mode again. And I'm getting strange unhanded exceptions from code. This is my snippet:


function onClientNodeEditing(sender, eventArgs) { 
                var node = eventArgs.get_node(); 
                var oldText = node.get_text(); 
                var newText = eventArgs.get_newText() 
                var tree = $find("<%= ThreadRoot.ClientID %>"); 
                 
                if (newText == oldText) { 
                    radalert(Please change name of category!"); 
                    
                    tree.trackChanges(); 
                    node.startEdit(); 
                    tree.commitChanges(); 
 
 
                    eventArgs.set_cancel(true); 
                } 
            } 

Any ideas? for example this code returns Cannot set property 'onblur' of null (G Chrome) and stops execution with Uncaught RangeError, Maximum call stack size exceeded

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 15 Feb 2010, 09:12 AM
Hello Jan,

Could you please try it like this:

function nodeEditing(tree, eventArgs) {
     var node = eventArgs.get_node();
        var oldText = node.get_text();
        var newText = eventArgs.get_newText()
          
        if (newText == oldText) {
            radalert("Please change name of category!");
            eventArgs.set_cancel(true);
            setTimeout(function() { node.startEdit(); }, 100);
        }
 }

and let us know how it goes.

Best regards,
Yana
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
Jan
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or