Select page in kendo grid

1 Answer 152 Views
Grid Pager
Jason
Top achievements
Rank 1
Jason asked on 04 Apr 2023, 12:40 AM

I have a kendo-grid with pageable set to true and can navigate to page 2. This all works fine. (see below)

If I then reload the grid data with new data, the view is still on page 2. How do I force a reset so the grid goes back to page 1?

<kendo-grid
                    [kendoGridBinding]="gridItems"
                    [navigable]="true"
                    [isDetailExpanded]="expandDetail"
                    (detailExpand)="onDetailExpand($event)"
                    [selectable]="{enabled: false}"
                    [kendoGridSelectBy]="false"
                    (cellClick)="onRowClicked($event)"
                    [scrollable]="true"
                    [pageable]="true"
                    [pageSize]="100"
                    [hideHeader]="true"
                    [columnMenu]="false"
                    class="section-l-grid"
                    #secondGrid

1 Answer, 1 is accepted

Sort by
1
Martin Bechev
Telerik team
answered on 06 Apr 2023, 10:10 AM

Hi Jason,

Setting the skip property of the binding directive to 0 is needed when the Grid data is modified by externally, and the page needs to be reset to 1. 

@ViewChild( DataBindingDirective) dataBinding: DataBindingDirective;

this.dataBinding.skip = 0

In the Overview example:

https://www.telerik.com/kendo-angular-ui/components/grid/

The page is reset to 0 each time when the global search is used.

In case the Grid is sorted or filtered using the built-in functionalities, setting the skip to 0 is not required, since the Grid changes the page to 1 by default. The Grid by default doesn't persist the state when refreshing the page.

I hope this sheds some light on the case.

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid Pager
Asked by
Jason
Top achievements
Rank 1
Answers by
Martin Bechev
Telerik team
Share this question
or