angular-datatables icon indicating copy to clipboard operation
angular-datatables copied to clipboard

Question v0.4.3: how to post process ajax data before feeding to the table

Open nemcuon opened this issue 10 years ago • 1 comments

Dear all,

For version v0.4.3 I have the following question:

In the following code, data is retrieved from the url 'url/to/serverside' and is fed directly to the datatable. But what if I want to change that data (enhance or change structure) before feeding to the datatable, then how can I do it ?

.withOption('ajax', { url: 'url/to/serverside', type: 'GET' } .withOption('serverSide', true)

  1. One thought: I can build a function using another library to retrieve ajax data. If that function, named getAjaxReturnPromise(), returns a promise then I could use DTOptionsBuilder.fromFnPromise(function(){ return getAjaxReturnPromise().then(function(rawData){ // post process this rawData rawData = postProcess(rawData); return rawData; } })

  2. But is there some other way ?

nemcuon avatar May 30 '16 04:05 nemcuon

I've followed the link http://codepen.io/l-lin/pen/Gpgxqo?editors=101, and it works Thanks

nemcuon avatar May 30 '16 12:05 nemcuon