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

kendo grid pageSizes

3 Answers 1546 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Teklas
Top achievements
Rank 1
Teklas asked on 15 Oct 2020, 12:54 PM

Currenty i'm using kendo grid server site pagination and there is a problem with page size property. When i choose page size 'all' then i check request body on the web browser and i don't see pageSize property  but when i choose 50 page size everything is OK.

{skip: 0, page: 1, sort: [{field: "Id", dir: "desc"}]} --> page size ALL

{skip: 0, pageSize:50,  page: 1, sort: [{field: "Id", dir: "desc"}]} --> page size 50

 

 

 

 var dataSource = new kendo.data.DataSource({
            type: "json",
            ...
            batch: false,
            pageSize: 20,
            serverPaging: true,
            serverFiltering: true,
            serverSorting: true, 
            schema: {
                data: "Data",
                total: "Total",
                errors: "Errors",
                model: {
                    id: "Id",
                    fields: fieldsCommon
                }
            }
        });

        var masterGrid = $("#" + divId).kendoGrid({
            dataSource: dataSource,
            edit: function (e) {

            },
            save: function (e) {
                kendo.ui.progress($(".k-window"), true);
            },
            groupable: true,
            sortable: true,
            pageable: {
                pageSizes: ['all', 10, 20, 50, 100],
                refresh: true,
                buttonCount: 5
            },
            selectable: true,
            height: 450,
            reorderable: true,
            resizable: true,
            columnMenu: false,
            columns: [
             ...
            ]
        }).data("kendoGrid");

3 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 19 Oct 2020, 11:38 AM

Hello Teklas,

Indeed, pageSize is not sent when the "all" page size option is selected.  The grid will send the current pageSize and skip once the serverPaging is set to true. On the server-side, your data should be paged using the provided info and return it together with the total number of items. Please take a look at the following SO thread demonstrating this:

Let me know if you have any questions on the matter.

Regards,
Nikolay
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

0
Teklas
Top achievements
Rank 1
answered on 21 Oct 2020, 10:59 AM

 

Hello Nikolay,

Yes I know how I can  make it on server-side but i was working with old version of kendo and it was sending pageSize property with total count of records. I don't want to change my server side logic because I have no time.

Thank you

     

0
Georgi
Telerik team
answered on 23 Oct 2020, 06:36 AM

Hi Teklas,

You could define a custom parameterMap handler and include the pageSize parameter even when the `All` page size option is selected.

Regards,
Georgi
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
Teklas
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Teklas
Top achievements
Rank 1
Georgi
Telerik team
Share this question
or