Unable to start_edit() a node if it is the only child of parent.

3 posts, 0 answers
  1. Himanshu
    Himanshu avatar
    3 posts
    Member since:
    Apr 2011

    Posted 22 Apr 2011 Link to this post

    Hi,
      I'm not able to start_edit() a new node at the 2nd Level client-side if the parent node does not have any child previously and this is the only child.

    Below is the code I've written to add a new node.

                    function AddNode(parentNode)
                    {
                        var tree = parentNode.get_treeView();
                        tree.trackChanges();
                        var node = new Telerik.Web.UI.RadTreeNode();
                        node.set_text("New Node");
                        node.set_value("New Node");
                        parentNode.get_nodes().add(node);
                        node.select();
                        tree.add_nodeEdited(NodeAdded);
                        tree.commitChanges();
                        node.startEdit();
                    }


    at the node.startEdit() statement it throws an error as: "htmlfile: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus."


    Please note that the ExpandMode of the Nodes are "WebService"

    -Himanshu

  2. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 27 Apr 2011 Link to this post

    Hi Himanshu,

    This kind of error usually occurs in IE when you try to focus an element which is not visible.

    In order to overcome this issue try to expand the parent item before you call the startEdit method.

    Please try the following implementation of the AddNode function:
    function AddNode(parentNode) {
     
        var tree = parentNode.get_treeView();
        tree.trackChanges();
        var node = new Telerik.Web.UI.RadTreeNode();
        node.set_text("New Node");
        node.set_value("New Node");
        parentNode.get_nodes().add(node);
        parentNode.expand();
        node.select();
        tree.add_nodeEdited(NodeAdded);
        tree.commitChanges();
        setTimeout(function() { node.startEdit() }, 20);
     
    }

    Regards,
    Dimitar Terziev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. Himanshu
    Himanshu avatar
    3 posts
    Member since:
    Apr 2011

    Posted 27 Apr 2011 Link to this post

    Hi Dimitar,
     Thanks so much, this resolves my problem.


    -Himanshu.
Back to Top