Reputation: 12431
I have a Kendo grid. On that grid there is a pagination which has message.
pageable: {
messages: {
display: {2} - records found, displaying {0} to {1}
}
}
where,
{0} - first index of the record on that page
{1} - last index of the record on that page
{2} - total number of records which I want to specify in response
How will be the structure of the response that is what i want to know. I checked on grid documentation from Kendo - http://docs.kendoui.com/api/framework/datasource#methods-total. But could not find much help. Any help is greatly appreciated.
Upvotes: 1
Views: 3683
Reputation: 40917
In the request, KendoUI by default will be sending the following information:
And the data return should provide a total
.
Example: We have requested page
1 and pageSize: 5
. Our returned data should look like:
{
total: 300,
data : [
{ ... },
{ ... },
{ ... },
{ ... },
{ ... }
]
}
So the DataSource definition should be:
dataSource: {
transport : {
read: {
url : "..."
}
},
serverPaging: true,
pageSize : 10,
schema : {
model: {
id : "id",
fields: {
...
}
},
data : "data",
total: "total"
}
},
Upvotes: 2