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

Reset to first page after sort or server side filtering

7 Answers 1802 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David A.
Top achievements
Rank 1
David A. asked on 20 Dec 2012, 03:48 AM
Hi,

I am trying to get the grid to go back to page one on any sorting or filtering operation (ServerOperation=true) on an ajax enabled grid.  I noticed even the samples dont return to page one when sorting - it leaves you right on the same page.

Right now I do this:
$("#clients-grid").data("kendoGrid").dataSource.read()

and it does a read, but leaves it on the page the user was last at.  How do I get this to go back to page 1?

Thank you.
David A

7 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 20 Dec 2012, 07:36 AM
Hello David,

When filtering the grid widget will reset it's page index as the result set will be reduced. However when sorting this is not neccessary as the same page numbers should be available. Sorting does not reduce the result set/data items/.

Regards,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David A.
Top achievements
Rank 1
answered on 20 Dec 2012, 07:48 AM
Thank you for your response Nikolay.  I am filtering externally from a search box and want the page index to be reset. If I am on page 3 and perform a datasource.read() which filters the results to 1 page, the grid stays on page 3 and is blank.  How can I force the grid to go to page 1?

Thank you.
0
Nikolay Rusev
Telerik team
answered on 20 Dec 2012, 09:14 AM
Hello David,

You should use DataSource.filter method in order to reset the page index.

Regards,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David A.
Top achievements
Rank 1
answered on 21 Dec 2012, 10:57 PM
Hello Nikolay.  Thank you again for your response but I didn't state my question clearly for which I apologize.  I have an external field that I am using to narrow the search results on and not using the grid filters.  I dug into the js source for grid and this seems to work:
$("#clients-grid").data("kendoGrid").dataSource.page(1);


It must refetch the data behind the scenes.
David A

0
Accepted
Petur Subev
Telerik team
answered on 25 Dec 2012, 03:01 PM
Hello David,

To combine several operation such as paging, filtering, grouping etc. within one request you can use the query method.

Kind regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David A.
Top achievements
Rank 1
answered on 26 Dec 2012, 07:19 PM
Thank you Petur.  That is exactly what I was looking for.
0
Sivaramakrishna Reddy
Top achievements
Rank 1
Veteran
answered on 31 Mar 2020, 02:53 PM
Thank you. It is working for me.
Tags
Grid
Asked by
David A.
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
David A.
Top achievements
Rank 1
Petur Subev
Telerik team
Sivaramakrishna Reddy
Top achievements
Rank 1
Veteran
Share this question
or