Hello Team -
I’m trying to build an admin page to feed master data using Express JS. I followed this link https://backendless.com/feature-17-data-paging-or-how-to-efficiently-load-large-data-sets-in-a-mobile-app/ to implement pagination but struck with few questions.
- Looks like the example recursively finds all the results and sends it to the client. Is it possible to just get the total count and let the client call next page as needed?
- I use a jQuery bootstraptable (http://bootstrap-table.wenzhixin.net.cn/) to display the results and this supports server side pagination. Is there examples on how to perform server side pagination?
- I tried to implement the example as provided but i get the following error.
/backendless.js:387
throw new Error('Use Async type of request using Backendless with NodeJS. Add Backendless.Async(successCallback, errorCallback) as last argument');
^
Error: Use Async type of request using Backendless with NodeJS. Add Backendless.Async(successCallback, errorCallback) as last argument
addressRouter.route('/listAll')
.all(function (req, res, next) {
next();
})
.get(function (req, res){
Backendless.Persistence.of( 'Address' ).find(
new Backendless.Async(function(results) {
var nextPage = results._nextPage;
while(nextPage) {
console.log('inside while loop');
results = results.nextPage();
nextPage = results._nextPage;
}
}, function(err) {
console.log('failed to fetch address with message - ' + err.message);
console.log('failed to fetch address with error code - ' + err.statusCode);
res.render('404');
})
);
});