Server-side paging for Kendo grid

1 Answer 2679 Views
General Discussions
James
Top achievements
Rank 2
James asked on 21 May 2018, 09:39 PM

 Hi,

 

I am using the Kendo UI grid for Angular and am using server-side paging. My code is paging through and retreiveing the data correctly (I have a method bound to the pageChange event on the grid) but the page number/button is not being updated (even thought I'm on page two, the button still say page one). 

 

How can I get the buttons to update correctly WITHOUT using the MVC extensions (I don't want to have an dependencies on the back end for this, it should have no idea I'm using Kendo at all).

 

Thanks,

James

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimiter Topalov
Telerik team
answered on 23 May 2018, 11:59 AM
Hello James,

The Grid "skip" property needs to be bound to a component class field that gets updated when the pageChange event is fired, so that the Grid pager rendering is properly updated, e.g.:

https://plnkr.co/edit/gmSDe9JpkYKTGW3JcL13?p=preview (proper state is passed to the service, but local state Grid is bound to is not updated -> when we go to second page items are correctly displayed, but pager stays at page 1)

https://plnkr.co/edit/AvIWeqKkOFckSUEv3Jpa?p=preview (state is updated properly and the Pager reflects the changed page number accordingly).

Basically, assuming the Grid skip property is bound to a component field named "skip" you will need to set it to the new value, coming as event data in the pageChange event, e.g.:

public onPageChange(e) {
  this.skip = e.skip;
  // call data service
}

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

I hope this helps.

Regards,
Dimiter Topalov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
James
Top achievements
Rank 2
commented on 23 May 2018, 02:02 PM

That worked, thanks!
Tags
General Discussions
Asked by
James
Top achievements
Rank 2
Answers by
Dimiter Topalov
Telerik team
Share this question
or