Copy row in kendo TreeList in ASP.NET MVC

1 Answer 88 Views
Button TreeList
Kripal
Top achievements
Rank 1
Kripal asked on 23 Jan 2024, 09:40 AM | edited on 23 Jan 2024, 09:44 AM

Hi All,

We're using telerik kendo treelist for the application. we need functionality like if we click on Copy data button then it will clone the selected row along with data. We've tried to find copy functionality but we're not able to do it. so we have add custom button ("Copy Data"). 

Please let us know if there is any other way to achieve this functionality.

adding button "Copy Data"  in toolbar:


.Toolbar(tb =>
    {     
            tb.Custom().Name("Copy").Text("Copy Data");        
    })

"Copy Data" button click event:

$('.k-button-text').click(function () {
        alert('clicked');
        debugger
        var treeList = $("#TeamTreeList").data("kendoTreeList");
        var row = treeList.select();
        if (row.length > 0) {
            var data = treeList.dataItem(row);
            console.log(data.RoleName); 
        }
    });

 

 

 

1 Answer, 1 is accepted

Sort by
1
Anton Mironov
Telerik team
answered on 26 Jan 2024, 07:42 AM

Hello Kripal,

Thank you for the code snippets, the image, and the details provided.

Yes, you are totally correct - I confirm this is the recommended approach to achieve the copy functionality.

 

Kind Regards,
Anton Mironov
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.

Kripal
Top achievements
Rank 1
commented on 30 Jan 2024, 10:09 AM

Hi Anton,

We need code for copy data button click event. Could you please provide sample code for clone/copy row and paste after selected row. 

Regards,
Kripalsinh
Anton Mironov
Telerik team
commented on 02 Feb 2024, 08:14 AM

Hi Kripal,

In order to achieve the desired behavior, for the copy part, I would recommend using the approach from the following article:

Here is a dojo example:


Best Regards,
Anton Mironov

Tags
Button TreeList
Asked by
Kripal
Top achievements
Rank 1
Answers by
Anton Mironov
Telerik team
Share this question
or