clear().draw() not removing rows from table
clear().draw() not removing rows from table
CesarD
Posts: 13Questions: 3Answers: 0
I have the following example: http://live.datatables.net/rezivoma/1/edit
But it can't clear the table when it runs the instruction table.clear().draw()
Am I missing anything? According to the clear() api documentation (https://datatables.net/reference/api/clear()), it's supposed to remove all rows from table...
Thanks in advance.
This question has accepted answers - jump to:
This discussion has been closed.
Answers
It will remove all rows on the client-side, but you have:
DataTables on the client-side doesn't know anything about your server-side data store, so you need to delete the data at the server and then call
draw()
. Theclear()
method is useless when server-side processing is enabled.I've committed a change to the documentation to state this fact.
Allan
Oh, ok, cause I have my datatable with deferLoading = 0 to prevent showing any record on the datatable initialization, so I wanted to clear the table when resetting the search criteria, thus I wanted to clear the datatable too. So, there's no way to clear the datatable records in any way if server-side is enabled and deferLoading = 0 ?
Thanks!
That is correct. If the search criteria changes, then an Ajax request to the server is required for the new information to be displayed.
Allan