Result Pagination + BootstrapTable jQuery Server Side Examples

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.

  1. 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?
  2. 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?
  3. 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');
 })
 );
 });


Hi Arasan,

  1. When we make:
Backendless.Persistence.of(Restaurant).find(callback);

we get the object with property ‘totalObjects’ in the handler of response. This property is a total count of all objects what you need.
There are no recursive functions in examples. A response object contains only one chunk of data and a meta information about the number of all data.

2.I am not sure what do you want to ask.
As I understood you use Backendless JS SDK for server side.
You can write the express.js router which will handle the request of your Bootstrap-table, get from there paging options and make Backendless request.
Then it will wait for Backendles server response and convert response data to the format what can be handled by your Bootstrap-table and send data to the client.
Or you can use Backendless JS SDK on the client side and configure your Bootstrap-table to work with it.

  1. I’ve tried to make the same as you and I’ve not got an exception. Please, update your version of Backendless JS SDK.

Regards Ilya