G
G
GrimJack2017-10-06 18:51:37
JavaScript
GrimJack, 2017-10-06 18:51:37

How to reload dataTables?

I use this plugin https://datatables.net inside a vuejs project
The problem is the following:
Data is generated dynamically (and there is no way to pull it through ajax built into DT) before DT is returned. The first time everything works fine, but if I reshape the data and want to update the view (call the create process with the new data), I get an error

DataTables warning: table id=data_table - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3

I can't figure out how to redraw this thing. (both data and columns are dynamically formed).
I tried to move the DT to a separate vue component and recreate the component when the data needs to be updated (via v-if), but this does not help, since the created() method is no longer called (I can’t figure out why)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2017-10-06
@GrimJack

And why did you decide that "update view" means reinitializing the table? Brad. Delete old data ( clear method ), add new data (add method ) .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question