jquery datatables custom ajax client -


i have custom javascript client works remote api using ajax.

suppose myapiclient below:

var myapiclient = function() {    this.invoke = function (config, callback) {      // ...    } } 

how can configure jquery datatables can use myapiclient rather built-in ajax working jquery datatables provides internally?

that is, suppose loading remote data, need call client way:

var client = new myapiclient();  client.invoke({ url: '/api/app/v1/some-entity/all', function(result, err) {      // ...   } }); 

thank already

use ajax option define function retrieve data through own ajax call.

as function, making ajax call left allowing complete control of ajax request. indeed, if desired, method other ajax used obtain required data, such web storage or firebase database.

when data has been obtained data source, second parameter (callback here) should called single parameter passed in - data use draw table.

for example:

$('#example').datatable( {   "ajax": function (data, callback, settings) {      var client = new myapiclient();      client.invoke({ url: '/api/app/v1/some-entity/all', function(result, err){             // pass data jquery datatables            callback(result);          }      });   } }); 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -