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

How to bind child elements on the click of parent row in MVC

1 Answer 164 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Diwakar
Top achievements
Rank 1
Diwakar asked on 27 Jan 2015, 10:35 AM
I want to show a Kendo Treelist on my page without any child elements.
But when I click on any row, an ajax call has to be made to fetch the data and the row should expand with the child elements under it.
How can it be achieved?

1 Answer, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 27 Jan 2015, 01:22 PM

Hello Diwakar,

I believe you are looking for the remote data loading scenario. If you want to handle clicks on the entire row, you can call the expandRow method via a jQuery event handler on the .k-grid-content tr elements:

$("body").on("click", ".k-grid-content tr", function(e) {
    var row = $(e.target).closest("tr");
    var treelist = row.closest(kendo.roleSelector("treelist")).data("kendoTreeList");
    if (treelist && row.length) {
        treelist.expand(row);
    }
});

Regards,
Alex Gyoshev
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
Diwakar
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or