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

Save expanded row

4 Answers 415 Views
Grid
This is a migrated thread and some comments may be shown as answers.
jc mag
Top achievements
Rank 1
jc mag asked on 14 Mar 2012, 01:02 PM
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?)


4 Answers, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 15 Mar 2012, 10:16 AM
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!
0
jc mag
Top achievements
Rank 1
answered on 15 Mar 2012, 11:14 AM
I'll try that, thanks ;)
0
Daniel
Top achievements
Rank 1
answered on 23 Apr 2012, 02:48 PM

 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
0
Marcin
Top achievements
Rank 1
answered on 23 Jul 2013, 09:23 AM
How can I select expanded/collapsed row by CSS selector. Solution written above doesn't work for me.
Tags
Grid
Asked by
jc mag
Top achievements
Rank 1
Answers by
Rosen
Telerik team
jc mag
Top achievements
Rank 1
Daniel
Top achievements
Rank 1
Marcin
Top achievements
Rank 1
Share this question
or