How to Resolve missing table headers in grid generation
How to Resolve missing table headers in grid generation
SkildLobster
Posts: 1Questions: 0Answers: 0
I ran into an issue where the following error was being thrown when trying to update a Data Tables grid with a new grid and a new set of data:
Exception calling dataTable: TypeError: nThs[i - iCorrector] is undefined
I was loading the Data Tables grid to an empty table on click. The first action I performed when clicking my query button was to empty the said table using [code]$('#myTable').empty();[/code] and then reload the Data Tables grid to the same table. The problem is that when Data Tables loads the grid it wraps the table with certain divs as well. So when I emptied the table and tried to load another grid it threw the previous error when the new grid I was loading had more columns than the previous grid that had been loaded.
To solve the problem I created an empty div and appended the empty table to the div, then loaded the Data Tables grid to the table. On click I emptied the div, rinse and repeat, everything worked fine. I tried messing with fnDestroy or fnClearTable without success.
I hope this might help someone who runs into the same issue.
Exception calling dataTable: TypeError: nThs[i - iCorrector] is undefined
I was loading the Data Tables grid to an empty table on click. The first action I performed when clicking my query button was to empty the said table using [code]$('#myTable').empty();[/code] and then reload the Data Tables grid to the same table. The problem is that when Data Tables loads the grid it wraps the table with certain divs as well. So when I emptied the table and tried to load another grid it threw the previous error when the new grid I was loading had more columns than the previous grid that had been loaded.
To solve the problem I created an empty div and appended the empty table to the div, then loaded the Data Tables grid to the table. On click I emptied the div, rinse and repeat, everything worked fine. I tried messing with fnDestroy or fnClearTable without success.
I hope this might help someone who runs into the same issue.
This discussion has been closed.