saving a node data by clicking outside of the node in kendo treeview

3 posts, 1 answers
  1. Sagar
    Sagar avatar
    2 posts
    Member since:
    Jun 2018

    Posted 06 Jul 2018 Link to this post

    Hi, 

    I've been using Kendo jquery UI for only one month. I have created a kendo tree, now I can properly rename each node with inline editing.

    At the time of renaming a node i made this inline editable using Jeditable library. But after editing the node text only when I'm pressing ENTER button then only it's saving the node text. I want to save this changed node text  also when I click out side of the tree. Anyone can help me please?

    This rename thing happening under the kendoContextMenu, Please go through the code below:

    $("#menu").kendoContextMenu({
                    target: "#treeview",
                    filter: ".k-in",
                    select: function (e) {
                        e.preventDefault();
                        var button = $(e.item);
                        var node = $(e.target); 
                        console.log(node)
                        var treeView = $("#treeview").data("kendoTreeView"); 
                        var buttonSelect = $(e.item).children(".k-link").text();
                        switch (buttonSelect) {

        case "Rename":
                                node.editable(function (value, settings) {
                                    console.log(value)
                                    return value;
                                }, {
                                        event: "click",
                                        cssclass: "treeInlineEdit"
                                    })
                                node.trigger("click", [e]);
                                break;

          }        
                    },

     })

  2. Answer
    Neli
    Admin
    Neli avatar
    333 posts

    Posted 09 Jul 2018 Link to this post

    Hello Sagar,

    As far as I understand, you need to change the text of the node when the 'Rename' option is selected from a Context menu. If this is the case, I would suggest you to use the TreeView text method in order to change the text of a node. This way the text will be changed by selecting the menu item, without pressing the 'Enter' key.
    switch (buttonSelect) {
    case "Rename":
       treeView.text(node, "changed text");               
       break;
    }

    In the linked Dojo example I used the provided snippet, but when the 'Rename' is selected the text of the node is changed by using the implementation described above.
    I hope this helps.

    Regards,
    Neli
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Sagar
    Sagar avatar
    2 posts
    Member since:
    Jun 2018

    Posted 18 Feb 2019 Link to this post

    Hey Neli, thanks for your help. I saw your dojo example and yeah treeView text() method worked for me. once again thank you.
Back to Top