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

Support for PageCount-Variable in Pager

4 Answers 585 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel Knoll
Top achievements
Rank 1
Daniel Knoll asked on 12 Jan 2017, 10:57 AM

We are migrating our application from the ASP.NET AJAX Grid, where we had the PageCount in the Pager-Message as stated here:

http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/functionality/paging/changing-the-default-pager/using-pagertextformat

{1} is total number of pages.

Unfortunately, the Pager of the Kendo Grid does not support the PageCount.

http://docs.telerik.com/kendo-ui/api/javascript/ui/pager#configuration-messages.display

Is there any workaround to get the pageCount in the pager?

4 Answers, 1 is accepted

Sort by
0
Eduardo Serra
Telerik team
answered on 13 Jan 2017, 05:11 PM
Hello Daniel,

Although including the total number of pages in the Kendo UI Grid pagination section is not possible out of the box, the DataSource API does offer a method that returns the total number of pages; you can read more about totalPages here.

I have prepared a sample in the Kendo UI Dojo to see how it can be obtained. In the databound event of the grid the following line displays the total number of pages in the console:

console.log($("#grid").data("kendoGrid").dataSource.totalPages());

I hope this helps!

Regards,
Eduardo Serra
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Daniel Knoll
Top achievements
Rank 1
answered on 14 Jan 2017, 09:14 PM

Hello,

 

thank you for your input.

I've tried your approach.

In the pager I set the message to <span class="grid-pagecount" /> so that an empty span will be rendered.

Then in the dataBound event I get the reference to the span and tried to set the dataSource.totalPages(). Unfortunately, the pager message is rendered after the databound event. So I can't set the span from this event..

 

Do you have any further help on this issue?

Best regards,

Daniel

0
Eduardo Serra
Telerik team
answered on 16 Jan 2017, 04:59 PM
Hello Daniel,

You're right, the pager message is rendered after the dataBound event. I was able to set the total number of pages on the pager message in the document.ready function, but that brings us the problem of the number disappearing when the page changes.

If you want to follow that approach I could recommend you using a timeout; I have prepared a sample in the Kendo UI Dojo showing how this could work, take a look at it here.

I hope this helps!

Regards,
Eduardo Serra
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Daniel Knoll
Top achievements
Rank 1
answered on 18 Jan 2017, 06:03 AM

This works, thank you very much for your support. :)

Best regards,

Daniel

Tags
Grid
Asked by
Daniel Knoll
Top achievements
Rank 1
Answers by
Eduardo Serra
Telerik team
Daniel Knoll
Top achievements
Rank 1
Share this question
or