Redraw table after removing all rows

Redraw table after removing all rows

kayengkayeng Posts: 4Questions: 1Answers: 0

Hi,

I am currently migrating my code to work with the new api instead of the deprecated one.

I used to call $('#example').dataTable().fnClearTable(true); to remove all rows from the table.
According to the migration guide, fnClearTable can be replaced with a call to clear().
Hence I used $('#example').DataTable().clear();
However, this doesn't redraw the table after all table rows have been removed.

Is this as designed? What can I do to force a redraw of the table?

Cheers,
Kaye.

Answers

  • kayengkayeng Posts: 4Questions: 1Answers: 0

    Silly me. I have answered my own question. Just call $('#example').DataTable().clear().draw() to force redraw of table.

This discussion has been closed.