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

maintain state of collapsed rows on grid refresh

3 Answers 979 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 11 Jul 2014, 08:21 PM
I have a grid with grouping. If you collapse a group and then refresh the grid, all groups return to their default expanded state.

I'm wondering if there is a way to keep track of which groups are collapsed, so that upon refreshing the grid those specific rows can be collapsed again.

My initial attempt at this was to select all collapsed rows with jQuery, and then pass that list of jQuery objects into the grid's collapseRow function, like this:

var rows = $('td[aria-expanded=false]').parents('tr.k-grouping-row');
grid.collapseRow(rows);

That works in that I can expand/collapse only those rows that were collapsed when the rows variable was created, however after refreshing the grid those jQuery objects no longer exist on the page so passing "rows" into the collapseRow function has no effect.

I know that you can save various states about the grid, such as grouping, sorting and column ordering, but is there currently any way to accomplish this?

3 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 15 Jul 2014, 12:48 PM
Hello Chris,

I got a little bit confused, by default the state of the detail rows is collapsed and they expand on demand by the user. If this is the case then here is an example that uses a local array to keep track of the expanded rows and then expand each of them on dataBound, please check it out and let me know if it helps:

http://jsbin.com/bewobi/1/edit

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Soni
Top achievements
Rank 1
answered on 31 Aug 2016, 12:24 PM

Hi Chris,

Did you find the solution of your problem?

I also have the same requirement i have to save the collapsed group on grid refresh.

Can anyone help me on this??

Problem Statement: I have a kendo grid and i am doing grouping by one column and in that grouped items i have collapsed some groups but on grid refresh it goes off.

Please help.

 

Thanks,

Soni

0
Kiril Nikolov
Telerik team
answered on 01 Sep 2016, 12:23 PM
Hello,

Please check the following article and let me know if it helps:

http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/state/persist-expanded-rows

Regards,
Kiril Nikolov
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Soni
Top achievements
Rank 1
Share this question
or