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

Add/Update/Delete in Kendo Treelist

3 Answers 503 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Sandhya
Top achievements
Rank 1
Sandhya asked on 23 Mar 2016, 03:32 PM

I am using Kenod Treelist to display the hierarchical data and its working fine.
I have placed the edit option to update/delete each row.
Now I am facing issue, how to add new row to each level:
My Treelist is having the hierarchy like below:
--Main Node

   -----Parent Node1

             ------Child Node1

             ------Child Node2

  -----Parent Node2
I should be able to add Main node/Parent Node/Child Node.
I have tried with toolbar: ["create"] which will give me the option to add the main node.
Any other way I can achieve this with Kendo Tree List?
Or any other control I can opt to achieve the Add/Edit/Delete functionality with hierarchical node.
Any help is highly appreciable.
Thanks

3 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 28 Mar 2016, 06:52 AM

Hello Sandhya,

 

There is built-in createChild command that will render a button to add child for given item. Seems that this is what you are looking for.

 

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Sandhya
Top achievements
Rank 1
answered on 28 Mar 2016, 10:59 AM

Hi Nikolay,

Thanks for your input.

Now the issue I am facing is Update/Delete command is not firing. I have created a separate custom method to do binding.Here is my code :

var JobList = new kendo.data.TreeListDataSource({
                        data: data,
                       
                        schema: {
                            model: {
                                id: "ID",
                                parentId: "ParentID",
                                fields: {
                                    ParentID: { field: "ParentID", type: "number", nullable: true },
                                },
                              
                                expanded: true
                               
                            }
                        },
                        transport: {
                            read: {
                                url: //url here
                                dataType: "json"
                               
                            },
                            update: {
                                url: url
                               data: data
                                    function (data) { },
                                    "POST",
                                    false,
                                    null
                                    ),
                             
                            },
                             parameterMap: function (data, type) {
                            if (type == "update") {
                                // send the created data items as the "models" service parameter encoded in JSON
                                //return { models: kendo.stringify(data.models) };
                                alert('Update');
                            }
                        }

Could you please help me what I am doing wrong here?

0
Nikolay Rusev
Telerik team
answered on 31 Mar 2016, 07:29 AM

Hello Sandhya,

 

We are not sure what might cause this behavior from the code snippet. We will need a isolated runnable example in order to assist you further.

 

The following demo seems to be working properly - http://demos.telerik.com/kendo-ui/treelist/editing

 

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
TreeList
Asked by
Sandhya
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Sandhya
Top achievements
Rank 1
Share this question
or