Trigger the change table content.
Trigger the change table content.
Hi all,
what is the best way to trigger the table redraw after action like filtering, sorting or showing different rows?
I'm using the jquery.dataTables version 1.7.6,
and, possibly, I don't want to modify the original plugin.
Thanks,
Antonio
what is the best way to trigger the table redraw after action like filtering, sorting or showing different rows?
I'm using the jquery.dataTables version 1.7.6,
and, possibly, I don't want to modify the original plugin.
Thanks,
Antonio
This discussion has been closed.
Replies
If I'm misunderstanding and you need to explicitly call a redraw function anyhow, you can call fnDraw(). So once your table is initialized, $('#myTable').dataTable().fnDraw() will get data according to the data source in the initialization and then redraw the table.
My application does polling, so regardless of sorting, filtering, etc., every 3 seconds I call fnDraw() on the table, which fetches the new data set and redraws the table.
and sorry if my question was not clear.
Indeed, I need to call a external javascript function after the content of table changes because of filtering or sorting action for example.
I know how to make it for filtering for example, but I'm looking for a common method to make it after the table is redraw because of change of table content.
The data are all in client side part.
You can hook into one of the callbacks: http://datatables.net/usage/callbacks
The obvious choice seems to be fnDrawCallback. Filter triggers an automatic draw, and in turn fnDrawCallback can call whatever external function you need.