grid paging issue

4 posts, 1 answers
  1. Chris
    Chris avatar
    3 posts
    Member since:
    Sep 2015

    Posted 12 May 2016 Link to this post

    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}

  2. Answer
    Stefan
    Admin
    Stefan avatar
    2958 posts

    Posted 12 May 2016 Link to this post

    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!
  3. Chris
    Chris avatar
    3 posts
    Member since:
    Sep 2015

    Posted 13 May 2016 in reply to Stefan Link to this post

    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.

  4. Chris
    Chris avatar
    3 posts
    Member since:
    Sep 2015

    Posted 13 May 2016 in reply to Stefan Link to this post

    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.
Back to Top