Tag Archives: BaasBox

SERVER SIDE PROCESSING USING BAASBOX AND DATATABLES


via Server Side processing using BaasBox and Datatables | BAASBOX.

Since version 0.8.2, BaasBox has been using server side pagination, sorting and filtering in its embedded console to show documents, files and users.
Before that version, it loaded all the data and then pagination occurred in the browser. This was obviously good for small sets of data but it was a great pain in case of large record sets.
The embedded console uses the popular JQuery Datatables legacy (v.1.9) plugin that supports server side processing.

When Datatables are set to use server side processing, the server is expected to support its protocol to retrieve data. This protocol involves filter parameters, paging related variables, sorting, and so on. But BaasBox has its own APIs to retrieve data, therefore a conversion between the formats of the two components, both client and server, was necessary.
Fortunately Datatables allow to override the function used to call the server, in order to customize the logic behind the calls to the server.
Let’s see how.

As stated in the Datatables documentation, the function to override isfnServerData() and it has three parameters: sSource, aoData, fnCallback.
sSource is the fired event, aoData is an array of data that describe the table andfnCallback is a reference to a function that will process the retrieved data.