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

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

2 Answers 159 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Sagar
Top achievements
Rank 1
Sagar asked on 06 Jul 2018, 07:48 AM

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 Answers, 1 is accepted

Sort by
0
Accepted
Neli
Telerik team
answered on 09 Jul 2018, 12:02 PM
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.
0
Sagar
Top achievements
Rank 1
answered on 18 Feb 2019, 10:09 AM
Hey Neli, thanks for your help. I saw your dojo example and yeah treeView text() method worked for me. once again thank you.
Tags
TreeView
Asked by
Sagar
Top achievements
Rank 1
Answers by
Neli
Telerik team
Sagar
Top achievements
Rank 1
Share this question
or