Data Grid Pagination

9 posts, 1 answers
  1. Arsene
    Arsene avatar
    7 posts
    Member since:
    Jan 2012

    Posted 27 Jan 2012 Link to this post

    Hello geeks,

    I have an issue concerning the pagination. I set the paging features for the grid but when I move to the next page there is no link to come back to the previous. Can you please assist me. This is the code I used:

    $("#users-list").kendoGrid({
            dataSource: {
                transport: {
                    read: "<%=request.getContextPath() %>/UsersServlet?action=8"
                },
                schema: {
                    data: "data",
                    total: "total"
                },
                pageSize: 2
            },
            columns: [ 
                      { title: "Full Name", field: "fullName" },                   
                       { title: "User Name", field: "userName" }, 
                       { title: "Status", field: "status" },   
                       { title: "Expiry Date", field: "expiryDate" },                   
                       { title: "Creator", field: "createdBy"},
                       { title: "Creation Date", field: "creationDate" }
                     ],
            scrollable: false,
            pageable: true,
            sortable: true,
            filterable: true,
            
        });
    });


    I have two records in the result
  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 27 Jan 2012 Link to this post

    Hello Arsene,

    You will have to set serverPaging: true of the DataSource and make sure that the response from server has total field with the amount of the items.

    Regards,
    Nikolay Rusev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Arsene
    Arsene avatar
    7 posts
    Member since:
    Jan 2012

    Posted 27 Jan 2012 Link to this post

    Hello Nikolay, 


    I do not want to paginate from the server. I have fetched all the data from the server and I would like to do the pagination from the client side. That is how come I got the error I am reporting.
  4. Mangesh
    Mangesh avatar
    16 posts
    Member since:
    Sep 2011

    Posted 27 Jan 2012 Link to this post

    Hi Arsene,

    I guess replacing total with the following code will help you,

    total: function (result) {
                                result = result.data || result;
                                return result.length;
                            }

    But for this , you have to set serverpaging to true
    try this, and let me know how do you going with it?

    Thanks,
    Mangesh
  5. Arsene
    Arsene avatar
    7 posts
    Member since:
    Jan 2012

    Posted 30 Jan 2012 Link to this post

    Hi Mangesh,

    I did what you asked me. The pagination index is working.
    However I have all the data I have fetched from the database on the page instead of seeing them paginated.
  6. Answer
    Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 30 Jan 2012 Link to this post

    Hello Arsene,

    See the example bellow on how to implement client paging with remote binding:
    http://jsfiddle.net/FEHFB/

    Things to notice in this example is the implementation of the data and total functions of the DataSource.

    All the best,
    Nikolay Rusev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  7. Arsene
    Arsene avatar
    7 posts
    Member since:
    Jan 2012

    Posted 30 Jan 2012 Link to this post

    Hello,

    The pagination is working fine. Now Rusev can you please help me achieve edit on the page. What I wan is I would like to hide the record id in a hidden field, put a edit button on the grid for each row an when the user clicks on that button I can retrieve the row id through jquery and perform the edit.

    If you have any better way of doing it educate me.

    Thank you
  8. Arsene
    Arsene avatar
    7 posts
    Member since:
    Jan 2012

    Posted 30 Jan 2012 Link to this post

    I got it don. Thank you
  9. Mark
    Mark avatar
    2 posts
    Member since:
    Apr 2012

    Posted 26 Jan 2013 Link to this post

    Hi,
    how to write the php code while server paging is true?
    Thanks,
    Mark
Back to Top