Closed edwardanthony closed 1 year ago
I had the same problem and found out from a different issue that you could do this:
If the jsonresult is like this:
{
"totalCount" : 27,
"data" : ["data", "data" ..]
}
Then do this:
totalNumberLocator: function (response) {
return response.totalCount;
},
Full example:
$('#logs').pagination({
dataSource: url,
locator: 'userLogs',
alias: 'page',
pageSize: 10,
ajax: {
beforeSend: function() {
dataContainer.html('Loading logs..');
}
},
totalNumberLocator: function (response) {
return response.totalCount;
},
callback: function(data, pagination) {
// template method of yourself
var html = template(data);
dataContainer.html(html);
}
});
Hope this helps!
I tried to use a custom function for the data source. But the number of pages is always only one page.
I logged the pagination data, it shows that the
totalNumber
is always the same as thepageSize
which causing it to only have only one page.I tried to set the
totalNumber
variable manually. But it didn't work.