stateSave not working with a table that is generated in javascript
stateSave not working with a table that is generated in javascript
I have a table that is generated using a handlebars template after the page loads. I want to use stateSave on this table, but it doesn't seem to be working. I can't link to the page, but I copied and pasted just the DataTable code here: http://live.datatables.net/tuxamege/1/edit, where stateSave works fine. The only difference I can think of between the DataTables live table and the table on my page is that the table on my page is generated in javascript instead of hardcoded. Is that likely what the problem is? Is there some way I could use stateSave with this generated table?
Answers
OK, I figured it out. The problem was that some of the options in the load were being loaded as strings when they shouldn't have been. As far as I can tell, this is a bug. We've coded around it for now by doing JSON.parse on the individual options as well as the data in general in the stateLoadCallback. Our code now looks like this: