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

Data Grid Pagination

8 Answers 1472 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Arsene
Top achievements
Rank 1
Arsene asked on 27 Jan 2012, 03:30 PM
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

8 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 27 Jan 2012, 05:40 PM
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!
0
Arsene
Top achievements
Rank 1
answered on 27 Jan 2012, 06:08 PM
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.
0
Mangesh
Top achievements
Rank 1
answered on 27 Jan 2012, 09:55 PM
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
0
Arsene
Top achievements
Rank 1
answered on 30 Jan 2012, 09:02 AM
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.
0
Accepted
Nikolay Rusev
Telerik team
answered on 30 Jan 2012, 10:54 AM
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!
0
Arsene
Top achievements
Rank 1
answered on 30 Jan 2012, 12:36 PM
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
0
Arsene
Top achievements
Rank 1
answered on 30 Jan 2012, 04:55 PM
I got it don. Thank you
0
Mark
Top achievements
Rank 1
answered on 27 Jan 2013, 05:36 AM
Hi,
how to write the php code while server paging is true?
Thanks,
Mark
Tags
Data Source
Asked by
Arsene
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Arsene
Top achievements
Rank 1
Mangesh
Top achievements
Rank 1
Mark
Top achievements
Rank 1
Share this question
or