KendoUI grid - enable / disable pagination

I would like to show that to display only the page, if I have more entries than my pageSize . Is there any way to achieve this?

Ideally, when data is added / deleted on the client, the pagination mechanism will be displayed / hidden accordingly (again, only display if there are more elements than the page size).

Any ideas / workarounds?

Update

The answer provided by j4ro seems to work fine once I deleted the height setting code. This was not necessary for me, but your mileage may vary, as I have not tested this with a more typical use case.

dataBound: function () { if (this.dataSource.totalPages() === 1) { this.pager.element.hide(); } else { this.pager.element.show(); } } 
+6
source share
1 answer

Add this function to your grid on the dataBound event:

 dataBound: function () { var gridContent = this.element.find('.k-grid-content'); if (this.dataSource.totalPages() === 1) { gridContent.css('height', gridContent.height() + this.pager.element.innerHeight()); this.pager.element.hide(); } else { this.pager.element.show(); gridContent.css('height', gridContent.height() - this.pager.element.innerHeight()); } } 
+7
source

All Articles