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

grid paging issue

3 Answers 458 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 2
Chris asked on 12 May 2016, 10:17 AM

Hi,

I am creating a kendo grid and trying to get paging working. I have updated the dataSource schema so that total is set and I can see from the console.log output that it returns a value but I still get the message "No items to display" and the paging doesnt work. Below is the the kendo grid code and a sample of the json returned. Can anyone see what I am doing wrong?

 

$("#requestBreakdown").kendoGrid({
            dataSource: {
                type: "json",
                transport: {
                    read: "/home/Grid_DataSource?startDate=01/05/2016&endDate=12/05/2016",
                    dataType: "json"
                },
                pageSize: 2,
                serverPaging: false,
                schema: {
                    data: "Data",
                    total: function (data) {
                        console.log(data.Total);
                        return data.Total;
                    },
                }

            },
            groupable: false,
            sortable: true,
            pageable: true,
            columns: [
                { field: "TITLE", title: "Title" },
            ]
        });

 

JSON response

{"Data":[
{"WORKORDERID":1,"TITLE":"First"},
{"WORKORDERID":2,"TITLE":"Second"},
{"WORKORDERID":3,"TITLE":"Third"}
//ADDITIONAL ITEMS REMOVED
],"Total":124}

3 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 12 May 2016, 02:10 PM

Hi Chris,

I created a test page, based on the provided information and code, and it appears to work as expected. Please compare with your implementation:

http://dojo.telerik.com/aYuCu

Generally, a "no items to displayā€¯ message may be rendered in the pager when the Kendo UI DataSource can't locate the "total" number in the server response. For example, schema.total can be set incorrectly, or the total information may be missing.

More information about using schema.total is available at:

http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.total
 
http://docs.telerik.com/kendo-ui/framework/datasource/crud#read-remote

If you have more questions, please modify the provided solution and get back to us. I will readily assist.

Regards,

Stefan

Telerik

Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Chris
Top achievements
Rank 2
answered on 13 May 2016, 10:33 AM

Hi,

Thanks for this. I am still not getting it to show. I have stripped out the JSON so that it matches exactly what is returned in your example (there was extra columns that I have taken out for now to make sure they werent causing any issue).

The only change to the javascript from what you have in your example is I set serverPaging to false.

I am going to make sure I have the latest version of the js files to see if that fixes it, otherwise I'm not sure what else to try.

0
Chris
Top achievements
Rank 2
answered on 13 May 2016, 02:15 PM
upgrading to the latest version (2016.2.504) and making sure the js files I included on the page matched what you had in your example got it working for me.
Tags
Grid
Asked by
Chris
Top achievements
Rank 2
Answers by
Stefan
Telerik team
Chris
Top achievements
Rank 2
Share this question
or