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

2 posts, 0 answers
  1. Diwakar
    Diwakar avatar
    2 posts
    Member since:
    Jan 2015

    Posted 27 Jan 2015 Link to this post

    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?
  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 27 Jan 2015 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
Back to Top