Ashiq Ali
Ashiq Ali

Reputation: 29

How to set Kendo grid dataSource pageSize programmatically

How to set pageSize in Kendo grid dataSoure. I have tried the following code but its not working.

grid.dataSource.data(result).dataSource.pageSize(5);

function loadCentres(e) {
    arrCentreId = new Array();
    arrCentreIdRemove = new Array();
    $.ajax({
        type: 'GET',
        url: '@Url.Action("GetCentres", "AAMaintenance")',
        dataType: 'json',
        data: { examinerId: hdnexaminerId },
        success: function (result) {
            var grid = $("#Centres").data("kendoGrid");
            grid.dataSource.data(result).dataSource.pageSize(5);
        }
    });
}

Upvotes: 2

Views: 270

Answers (1)

Mantas Čekanauskas
Mantas Čekanauskas

Reputation: 2228

You are doing everything just fine. However, you are missing one line of code:

grid.refresh();

This way grid will be rendered using new DataSource configuration

Upvotes: 2

Related Questions