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

Select All Rows with Paging

3 Answers 1347 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 30 Dec 2015, 03:02 PM

I am trying to select all rows, but I also have paging enabled. I am using the angular grid control.

I have checkbox column with a checkbox for select all in the header row. I am utilizing the option that I have seen in other posts to select all:

grid.items().addClass('k-state-selected');

 This seems to work for the page that I am viewing, but I want to select all rows on all pages. Is there a way to do this with paging enabled?

3 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 30 Dec 2015, 03:39 PM
Hi John,

For persisting selection during data operations like paging, sorting, filtering, etc., please refer to the following help article:
However, the demonstrated approach will not work for selecting all items, because the items in the other pages will not be available when you try to select them, but you could easily apply the same principle and manually include all identifying values from the items in the array that will hold the selected items. You could retrieve all items with a manual query that will return all items.

Another options would be to change the page size to "All", select all items, preserve the selection and then toggle the page size back.

Hope this helps.


Regards,
Konstantin Dikov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
John
Top achievements
Rank 1
answered on 30 Dec 2015, 03:44 PM

I will take a look at the persisting selection demo. Also, how do I toggle the pageSize to 'All' and back? Is there a method on the grid object to do this?

 Thanks

0
Konstantin Dikov
Telerik team
answered on 30 Dec 2015, 04:03 PM
Hi John,

You can use the grid's dataSource pageSize method for changing the page size. For your convenience, following is a simple demo demonstrating how to display all items in the grid and how to change the page size back to the original value:

Regards,
Konstantin Dikov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
John
Top achievements
Rank 1
Share this question
or