TypeError: headerCells[i] is undefined (when re-creating table)

TypeError: headerCells[i] is undefined (when re-creating table)

jal_freziejal_frezie Posts: 2Questions: 1Answers: 0

Hi, I am trying to use datatable to display some results from a model. The results are picked up by ajax and I am building an array of objects with the data I need to display. The user selects variables from a diagram which causes columns to be added to the table.
The first time the table is displayed, all is well. (it only has one row initially). Then I add a second variable and re-create it (as the only way to add a column). ...but now the table only has the first heading, and the navigation options are not displayed.
The JS console includes the error in the subject line, jquery.dataTables.js line 3965

I have put together an illustration of the problem at jsfiddle.net/mj88y/ -- the first call to datatable is commented out, to show that the data displays correctly if there is only one call. If you uncomment the first call and run it again, the problem will occur.
Any ideas what is going on?

Answers

This discussion has been closed.