Grid paging not working on page load.

15 posts, 0 answers
  1. Jason
    Jason avatar
    10 posts
    Member since:
    Jun 2012

    Posted 05 Aug 2012 Link to this post

    I have a grid that is successfully fetching my json data.  When the grid loads, the data is present but the paging buttons on the lower left do not work and the grid says "No items to display" on the lower right.  If I change the drop down to change the number of items per page, the grid refreshes and the paging works correctly and the number of records are also displayed.  Any ideas?
  2. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 06 Aug 2012 Link to this post

    Hello Jason,

    Unfortunately, the provided information is not sufficient in order to track the cause for such behavior.  Therefore, please provide a small sample in which this can be observed locally.

    Regards,
    Rosen
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Jason
    Jason avatar
    10 posts
    Member since:
    Jun 2012

    Posted 06 Aug 2012 Link to this post

    I found the answer to my question in the API documentation.  
  5. Jeroen
    Jeroen avatar
    2 posts
    Member since:
    Aug 2012

    Posted 13 Aug 2012 Link to this post

    Hi Jason,

    I'm having the same problem. Could you please explain what the solution is you found in the docs?

    Thanks!
  6. John
    John avatar
    13 posts
    Member since:
    May 2012

    Posted 13 Aug 2012 Link to this post

    I was looking at this from another forum post and I think this demonstrates my problem.
    Here is the jsfiddle: http://jsfiddle.net/dimodi/F6ghT/ 

    The buttons on this pager are not the same as the one above.
    http://demos.kendoui.com/web/grid/index.html 

    I can't get (first, prev, next, last) to show on my pager.  Any suggestions?  I am thinking I am missing something in the docs.
    I tried to set total and still didn't work.  I tried prevNext: true and that didn't work (even though it states it is the default).

    How do I get prev/next/first/last buttons appear on my grid?

    Thanks!
  7. Jeroen
    Jeroen avatar
    2 posts
    Member since:
    Aug 2012

    Posted 13 Aug 2012 Link to this post

    I figured it out by reading the manual. My problem was in the datasource. I did not specify a 'schema.total'. I fixed it by adding the following code to my datasource:

    total: function(response) {
        return $(response.data).length;
    }

    Hopefully this can be of any help.
  8. Gerald
    Gerald avatar
    5 posts
    Member since:
    Jun 2012

    Posted 24 Aug 2012 Link to this post

    @John - I had the same issue. The problem was I had kendoui web version 2012.1.322. As soon as I downloaded the latest version kendoui.web.2012.2.710.open-source everything cleared right up. It appears they made some changes from the earlier release. Hope this helps.

    Updated jsFiddle example: http://jsfiddle.net/F6ghT/102/
  9. Ashish
    Ashish avatar
    2 posts
    Member since:
    Jul 2013

    Posted 10 Jul 2013 Link to this post

    Hello
                      I'm also Facing same Problem,In my case my Grid is showing All the records which are coming from Database  in the Json Format at the time of Page load,1st time my pagesize is not working,but after selecting pages from left bottom footer it works fine,same problem for showing Total page number at the right bottom footer,First time while page loads it is showing  "Nan-Nan of items"  ,Paging "Next" button is also not working properly it is showing directly Last page ,it is not going to next page,Please find the attached Screen shot for more details

  10. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 11 Jul 2013 Link to this post

    Hi Ashish,

    You should verify that you are providing the total number of records.
    However, it is not clear from the provided description if you are using a remote or local binding and how the data is set. Therefore, a sample test page in which the issue can be observed will be appreciated.

    Also please consider starting separate thread instead of re-opening an old one.

    Regards,
    Rosen
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  11. Ashish
    Ashish avatar
    2 posts
    Member since:
    Jul 2013

    Posted 17 Jul 2013 Link to this post

    Hi Rosen
              I'm using Remote Binding and it is coming in json format,what ever Total records are coming from Database it is binding all at once  first time but when selecting other page sizes then it is working fine,I have attached the sample page of code please check it and let me know where I'm going wrong.
    Thanks & Regards
    Ashish
  12. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 18 Jul 2013 Link to this post

    Hi Ashish,

    Looking at the code you have provided it seems that the DataSource declaration is incorrect. The various options for the DataSource are not set to the DataSource but at the Grid instead. The particular issue which you have described is caused by not setting the pageSize correctly. Therefore, please refer our documentation on how to configure the Grid's dataSource option.

    Regards,
    Rosen
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  13. frank
    frank avatar
    1 posts
    Member since:
    Sep 2012

    Posted 18 Nov 2013 Link to this post

    total: function(response) {
                                    return $(response.data).length;
                                },

    This code resolved paging in Kendo UI Grid

    Thanks

    DANIEL
  14. Andrea
    Andrea avatar
    1 posts
    Member since:
    Jan 2014

    Posted 30 Apr 2014 Link to this post

    Jeroen's Answer:
    ____________
    schema: {
                   total: function(response) {
                   return $(response.data).length;
                   },
                  etc...
    }
    ___________
    works perfectly, thank you!
  15. Tim
    Tim avatar
    18 posts
    Member since:
    Jul 2014

    Posted 26 Feb 2015 Link to this post

    A ping to say its still needed even for the latest release. I tried separating my data from the grid but no change. My paging bar and "no items to display" were still not updating once the grid datasource populated. Adding the total function from Frank and Andrea fixed my problem as well. I also noticed if I sorted by clicking on the column header or applied a filter through my custom search box it would update. I just didn't update when the data arrived until I interacted. This below made the value fill in perfectly.

         ...,
         schema: {
              total: function(response) {
                   return $(response.data).length;
          },
          data,
         ..., etc

    Thanks!
  16. Simon
    Simon avatar
    32 posts
    Member since:
    Apr 2007

    Posted 12 Apr Link to this post


    total: function (response) {
    return response.Object.length;
    }, 
Back to Top
Kendo UI is VS 2017 Ready