REST Service and HTTP headers

REST Service and HTTP headers

radar1975radar1975 Posts: 2Questions: 1Answers: 0

Hi, let say i have a REST service that return a [{....}] and that the collection count is in the Http header X-Collection-Count ... i'm unable to use the response header instead of the of iTotalRecords and iTotalDisplayRecords for pagination purpose.

It is impossible to use
dataSrc: function(data) {
}
Since headers are not available. I would have been able to change data and add iTotalRecords and iTotalDisplayRecords comming from Http header instead.

Using tatables.js version 10.10.10 and serverSide:true

Temporary i had to change line 2772 and 2773 of jquery.dataTables.js for
var recordsTotal = settings.jqXHR.getResponseHeader("X-Collection-Count");
var recordsFiltered = settings.jqXHR.getResponseHeader("X-Collection-Count");

Thanks

Answers

  • allanallan Posts: 61,734Questions: 1Answers: 10,110 Site admin

    xhr will provide access to the Ajax request.

    Allan

  • radar1975radar1975 Posts: 2Questions: 1Answers: 0

    so this will be available next release ?

    Thanks for the quick response

  • allanallan Posts: 61,734Questions: 1Answers: 10,110 Site admin

    Its in the current release. That event has been present since 1.10.0.

    Allan

This discussion has been closed.