I am using Datatables to display tabular data in my Web application, and have configured it to make use of server-side processing, i.e. query the server via AJAX for filtered da
Finally did it after spending hours!
I will post the complete method here for everyone's help.
One needs to use fnServerParams
option, which allows adding custom parameters to be sent in the XMLHttpRequest sent to the server. For example:
Here is the coffescript I used:
jQuery ->
table = $('#logs').dataTable
bProcessing: true
bServerSide: true
sAjaxSource: $('#logs').data('source')
fnServerParams: (aoData) ->
applicationName = $("#applicationName").val()
aoData.push
name: "applicationName"
value: applicationName
return
$("#applicationName").on "change", ->
table.fnDraw()
return
My HTML file contains the input element with id applicationName
. Note the fnDraw()
element I used to enable redraw request whenever input value changes.