After updating DataTables and ColReorder: TypeError: g.aoColumns[a.aaSorting[f][0]] is undefined
After updating DataTables and ColReorder: TypeError: g.aoColumns[a.aaSorting[f][0]] is undefined
Hello
I just downloaded the latest versions of DataTables and ColReorder (primarily to make use of the new html5 data- attribute for sorting).
After doing so, I am getting this error: "TypeError: g.aoColumns[a.aaSorting[f][0]] is undefined" referencing ColReorder.js.
I have tried with a variety of options, and have set up various minimal test tables and run into the problem in all of my cases (so long as ColReorder is called).
This stops the ColReorder, and anything called after it, not to work.
Debug info here: http://debug.datatables.net/ixuwih
Any tips? I am stuck.
thanks!
This question has an accepted answers - jump to answer
Answers
on further investigation, it appears to happen only when state save is set to true.
State save is a required feature, however, so I can't just turn it off.
This is the bit relevant to bStateSave:
Is there anything that needs to change here, with the latest version?
Can you link to a test case showing the problem?
You don't need
fnStateSave
etc in 1.10 now as it useslocalStorage
by default :-)Allan
Sorry, I thought the debug link would suffice for the test case.
I am trying to rebuild my code in the new manner right now, and will put together a test case from that (currently, my code is built by a couple of dynamic methods that make it a little complex to pull a static example from).
thanks.
On another note - with the new stateSave method, how do I access the saved state in order to remove it?
Ok, I have a test version here: http://jsfiddle.net/jlbriggs/Swa7f/
But it doesn't appear to be doing the stateSave, or it is not retrieving the state save, so it is not showing the error.
On the other hand, on my server, it appears to be saving and retrieving the state, even when I tell it not to....?
The state appears to work okay for me in your link. If I have it page to show records 46 to 60 of 63 and then click the JSFiddle Run button to rerun the script the page is restored. Is that not happening for you?
Allan
Apologies - the stateSave is working for me on fiddle. I must have been doing something to negate it previously. The issue with it saving on my server despite being set false was a fluke as well.
I am still trying to get the initial problem to duplicate in the fiddle, as I still have not fixed it on my server.
I still can't seem to reproduce the problem on the example version.
However, I have narrowed it down a little after updating my code to work with the new methods.
If the user does not sort, filter, or otherwise alter the table, every time it loads it will be fine.
after that event, when the page is loaded again, every thing is fine until the next time the state changes and needs to be reloaded....
I know that doesn't give you what you need to solve my problem, but if anyone has any tips on where I can focus given this information, I would appreciate it.
thanks,
Jamie
Hi Jamie,
First suggestion would be to use the unminified version of DataTables and ColReorder. What line does it break on when that is the case?
Also, can you confirm that the number of columns is not changing?
Allan
AH, yes, meant to include that.
Line 739 of ColReorder, which is this bit:
I am using the ColVis extension as well, but this problem appears without columns being hidden, so yes - the number of columns stays consistent.
Anyone have any further thoughts on this?
I am at a loss...
newly discovered: when the page does load and initialize error free, the same error as posted above appears if I enter any text into the global table filter input (though it does not occur when using the individual column filters).
Ok, so it appears that this must be a known issue?
Solution: download this Git commit: https://github.com/DataTables/DataTables/commit/77343b72cb035e1ceba387335136f010282c0940
Or, link to the CDN using the nightly builds of the core DataTables file.
I have download the commit, and so far everything appears to be working properly for me.
Hi,
Sorry for the delay in being able to reply. Excellent to hear that the fix in the nightly is working for you. Planning to release 1.10.1 with it, and several other fixes next week.
Allan