How to redraw datatable with new ajax request url
How to redraw datatable with new ajax request url

I have a server side datatable that gets it data from a certain ajax URL. Now, I have a certain situation where I want to filter the datatables using columns that doe snot exist. So I cannot just search for the value in a column. I have a ajax request that I fire on custom filter and I have the data that is in the format required for the server side datatable. How, do I draw the datatable using this new data ?
I tried doing :
tblData.clear().rows().add(data).draw()
but I got:
assignedData.js:129 Uncaught TypeError: tblData.clear(...).rows(...).add is not a function
I guess this method is not available for server side datatable?
Answers
The API to add rows is
rows.add()
, notice no()
after rows. UsingtblData.clear().rows.add(data).draw()
may work with server side to show the rows but it these rows will be removed on the next draw(), ie, search sort, etc.A better option might be to pass additional parameters using the
-ajax.data
option. See the second and third examples of how to do this.Kevin