Dynamically adding columns and rows - table is loading but data not displaying
Dynamically adding columns and rows - table is loading but data not displaying
Link to test case: https://live.datatables.net/zagakesu/11/edit?html,console,output
Debugger code (debug.datatables.net)**: https://debug.datatables.net/ixukem (the table in question is marketing-report-grid-new)
Error messages shown: No error, data is not displaying
Description of problem: all of the data i'm mapping matches the amout of columns and rows. It seems to load, it says "Showing 1 to 4 of 4 entries" at the bottom but for some reason the Datatable is not being drawn. In the test case I have a dummy data file in the function but in the real use case the number of columns will change based on how many source values are selected (google, email...etc).
This question has an accepted answers - jump to answer
Answers
Using the browser's console you will see this Javascript error:
I added the Datatables.js and .css and now the Datatable initializes.
https://live.datatables.net/nicofuma/1/edit
If you are changing the number of columns then you will need to use
destroy()
and reinitialize the Datatable after the new HTML table has been built. You may need to useDataTable.isDataTable()
to determine if the Datatable has been initialized before usingdestroy()
and reinitializing. If this doesn't help then please update the test case to show the issue you are having.Kevin