How to expand child grid in ClientRowTemplate of Hierarchy Grid

4 posts, 0 answers
  1. Victor
    Victor avatar
    1 posts
    Member since:
    Sep 2014

    Posted 22 Sep 2014 Link to this post

    Hi experts,

    First of all, sorry for asking some basic stuff about the grid as I'm quite new on the kendo grid.

    As mentioned in the title, I would like to know how do I generate the link that expands the child grid from ClientRowTemplate.

    What I'm doing now is altering the hierarchy.cshtml from the demo.  But not getting any luck to achieve this.

    Many Thanks,

    Victor
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2310 posts

    Posted 23 Sep 2014 Link to this post

    Hello Victor,


    You could add a link/button to the row which will invoke the expandRow method of the Grid API.
    E.g.
    columns.Bound(e => e.Title).ClientTemplate("<button class='expand'>Expand</button>");

    $("#grid").on("click", ".expand", function () {
        var grid = $("#grid").data("kendoGrid");
        grid.expandRow(this);
    });

    Regards,
    Dimiter Madjarov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Steve
    Steve avatar
    17 posts
    Member since:
    Oct 2014

    Posted 05 Nov 2014 in reply to Dimiter Madjarov Link to this post

    Dimiter,

    Do you have an example of your reply that follows cshtml and/or razor format???   I've got the .Bound part but where does the $ part go?
  4. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2310 posts

    Posted 06 Nov 2014 Link to this post

    Hello Steve,


    The rest is a JavaScript code that should be included on the Grid page. For example in a script block.
    E.g.
    <script>
    $("#grid").on("click", ".expand", function () {
        var grid = $("#grid").data("kendoGrid");
        grid.expandRow(this);
    });
    </script>

    Regards,
    Dimiter Madjarov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top