Dynamically adding columns and rows - table is loading but data not displaying

Dynamically adding columns and rows - table is loading but data not displaying

lightstudioslightstudios Posts: 9Questions: 3Answers: 0
edited February 8 in Free community support

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

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951
    edited February 8 Answer ✓

    Using the browser's console you will see this Javascript error:

    Uncaught TypeError: $(...).DataTable is not a function

    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 use DataTable.isDataTable() to determine if the Datatable has been initialized before using destroy() and reinitializing. If this doesn't help then please update the test case to show the issue you are having.

    Kevin

Sign In or Register to comment.