Loading different data sets not working

Loading different data sets not working

idratherbecodingidratherbecoding Posts: 2Questions: 1Answers: 0

Hello All,

I need help figuring out how to load datasets with different data sets. When I initially load my page I'm returning data from ajax with four data fields. This works as intended but when the user requests to see another result set from the UI, then another ajax request is sent which returns another array with six data fields. This leads to an error because the header and columns no longer match.

I've linked the test case here: live.datatables.net/rotimedi/11/edit?js,console,output
In the test case there is no error displayed in the console but you can see that the data sets are being returned based on user selection, but the DataTable does not redraw itself.

Here's the actual error from my UI's console
jquery.dataTables.js:5603 Uncaught TypeError: Cannot read properties of undefined (reading 'style') at _fnCalculateColumnWidths (jquery.dataTables.js:5603) at _fnInitialise (jquery.dataTables.js:4717) at loadedInit (jquery.dataTables.js:1294) at HTMLTableElement.<anonymous> (jquery.dataTables.js:1306) at Function.each (jquery.js:385) at jQuery.fn.init.each (jquery.js:207) at jQuery.fn.init.DataTable [as dataTable] (jquery.dataTables.js:869) at jQuery.fn.init.$.fn.DataTable (jquery.dataTables.js:15161) at getData (sd-overview.js?v=CjJ8EHxjpT816hAXiaGcnPxoXPACyA2rmb2po1KZ3cc:140) at HTMLButtonElement.<anonymous> (sd-overview.js?v=CjJ8EHxjpT816hAXiaGcnPxoXPACyA2rmb2po1KZ3cc:192)

Further, drill down into the function _fnCalculateColumnWidths(oSettings) the variables columns ** match **columnCount but the headerCells is still displaying the initial results.

How do I reintialize the table's header because .clear() and .destroy() do not have any affect?

This question has an accepted answers - jump to answer

Answers

Sign In or Register to comment.