Dynamic columns keep old headings
Dynamic columns keep old headings
I am creating dynamically generated column headings by doing an ajax lookup for the field names that I want for a given query and making the header row inside
tags using the techniques on https://www.datatables.net/forums/discussion/29260/dynamic-column-headers-via-ajax. My server side query is also dynamic and correctly returns the data as arrays for the given query.
If I use the Chrome debugger I can put a breakpoint on and see that the new column headings are correctly written to the table in the browser. However, then I call datatables and the result is that the old column headings appear, but with the correct data for this query. I can't figure out what is going on inside of the datatables code, but I know that it has the correct data to work with from the server side and should not be keeping the old column headings.
I have used "destroy" on the call to dataTable() to no avail. I have also tried the jquery call empty() on the table id that contains the table rows and columns without success. How do I keep datatables from keeping the previous column headings?
Thanks.