Correct order of things

Correct order of things

tdktdk Posts: 32Questions: 16Answers: 0
edited December 2016 in Free community support

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

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    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() or column().search() to set the filters?

    Allan

This discussion has been closed.