New to Kendo UI for jQuery? Download free 30-day trial

Dynamically Change the Page Size of the Grid to Adjust Its Height


Product Grid for Progress® Kendo UI®
Operating System All
Browser All
Browser Version All


How can I change the pageSize property of the Grid when the height changes so that as many rows as possible are always displayed.


  1. Calculate the number of rows that will fit in the available space by subscribing to the resize event of the window element.
  2. Change the pageSize by using the pageSize method of the dataSource.
  #grid {
    margin: 0;
    padding: 0;
    border-width: 0;
    height: 100%;
    /* DO NOT USE !important for setting the Grid height! */

  html {
    overflow: hidden;
    font: 13px sans-serif;
<div id="parent">
  <div id="grid"></div>
  var gridElement = $("#grid");

  function resizeGrid() {"kendoGrid").resize();

    var newHeight = gridElement.height();

    var headerHeight = $(".k-grid-header").height();
    var pagerHeight = $(".k-grid-pager").height();
    var rowHeight = $("#grid tr:last").height();

    var numberOfRows = Math.round((newHeight - headerHeight - pagerHeight) / rowHeight);"kendoGrid").dataSource.pageSize(numberOfRows);"kendoGrid").refresh();

  $(window).resize(function() {

    dataSource: {
      type: "odata",
      transport: {
        read: ""
      schema: {
        model: {
          fields: {
            OrderID: {
              type: "number"
            ShipName: {
              type: "string"
            ShipCity: {
              type: "string"
      pageSize: 25
    scrollable: false,
    resizable: true,
    pageable: true,
    columns: [{
        field: "OrderID",
        filterable: false,
        width: 200

See Also

In this article
Not finding the help you need? Improve this article