Help needed to implement Pipelining

Help needed to implement Pipelining

marshalpatelmarshalpatel Posts: 1Questions: 1Answers: 0

Hi,

I am trying to configure a datatable(1.9.x) with the following configurations:

$(document).ready(function() {
  var reportTable;
  return reportTable = $('#reportTable').dataTable({
    bFilter: false,
    bSort: true,
    iDisplayLength: 9,
    bLengthChange: false,
    bServerSide: true,
    bProcessing: true,
    sAjaxSource: $.fn.dataTable.pipeline({
      url: 'reports/report-data.json',
      pages: 5
    }),
    oLanguage: {
      sProcessing: '',
      aaSorting: [["0", 'desc']]
    },
    aoColumns: [
      {
        mDataProp: "aaaa"
      }, {
        mDataProp: "bbbb",
        
      }, {
        mDataProp: "cccc",
        
      }, {
        mDataProp: "dddd",
        
      }
    ]
  });
});

My requirement is as follows:

My server is exposed to an API which returns a fixed number of records, let us say 100, in JSON format for every API call.

Let us say my page size is 10. That makes 10 pages on client side for single API call.

In nutshell, the API returns a batch or page of 100 records to the Server. These 100 records are further divided into 10 pages on the client-side.

Now if I want to access the 11th page on the client, I should trigger the API call from the server and fetch the next batch of 100 records.

Fetching is done on the basis of a token. Every API call returns a token in JSON format. This token is an Identifier and signifies that there are still more records after this batch. The last batch will not have this token as output.

I have a feeling that I need to do something similar to the Pipelining method explained here: https://datatables.net/examples/server_side/pipeline.html

However, I can't wrap my head around it. I tried to use the pipeline function as is but was not successful in retrieving the records.

Any help is appreciated.

Thanks
Marshal

This discussion has been closed.