Premium forums

Save expanded row

  • jc mag
    jc mag avatar

    14 Mar 2012 (Link to this post)

    I'd like to know if this scenario is possible:
    A user expands a row in a master/detail grid, and clicks on a cell with a link that redirects him to another page.
    When the user comes back on the grid page, the previously expanded row is expanded.

    It would mean saving the expanded row when the user leaves the page (is there a method to retrieve the expanded row?), and expand it again when he comes back (is there a method to expand a row based on for example the ID?)


  • Answered Rosen
    Rosen avatar

    15 Mar 2012 (Link to this post)

    Hello,

    There is no built-in function which to retrieve  the expanded rows. However, you may track which row is expanded or collapsed through detailExpand/detailCollapse events, or maybe retrieve the expanded rows through jQuery:

    $("#MyGrid").data("kendoGrid").table.find("tr.k-master-row a.k-minus").closest("tr")


    To expand given detail row Grid's expandRow method should be used. Note that you should pass the master row element.Regards,
    Rosen
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  • jc mag
    jc mag avatar

    15 Mar 2012 (Link to this post)

    I'll try that, thanks ;)
  • Daniel
    Daniel avatar

    23 Apr 2012 (Link to this post)


     Hi,
     
     Can you please provide a example? 
     
     I have the following case: 
     I have a kendo grid with detail. The detail is another kendo grid. When I edit a field of the detail grid, I need to update something on the belongind row in the master grid, and I do that by setting the value in the dataSource of the master grid and calling sync().
     
     The problem comes that when I sync the dataSource, it collapses all the rows. This means that i need to expand the previously expanded rows. I could not find an example on how to do this. 

     tried something like: 
    var expandedRows = $("#masterGrid").data("kendoGrid").table.find("tr.k-master-row a.k-minus").closest("tr");
    $.each(expandedRows, function (index, row) {
                        $("#masterGrid").data("kendoGrid").expandRow(row);
                    });
     But it does not work.

     Can you help please ? 
     Thank you, Daniel

Read FAQ or see Kendo UI in action!

Launch Demos