Correct order of things
Correct order of things
Scenario 1:-
1. Display DT with default filter.
2. Apply additional filter
3. Display results
4. Clear the filters and go back to step 1
Scenario 2:
1. Display DT with default filter.
2. Apply additional filter
3. No results returned
4. Clear the filters and go back to step 1
What should be the correct order of calls to the API to cater for the two scenarios as there seems to be number of combinations available i.e. destroy clear empty re-initialise etc.
e.g. If I do this
table.clear();
$('#demotable').empty();
table = $(tableName).DataTable({...});
The DT is not displayed.
I'm also using dynamic column creation.
Answers
If you are going to destroy the table, you probably want to call
destroy()
before you do the empty.However, you do you need to that? Can you not just use
search()
orcolumn().search()
to set the filters?Allan