Can state restore support named column identification?
Can state restore support named column identification?
Hi I'm using the state restore extension to persist and load states via ajax.
When persisting states I'm trying to avoid numerical indexes altogether as the ordering may change in the future or columns may come and go.
When loading states I'm getting an error from here: https://github.com/DataTables/DataTablesSrc/blob/0c820abf99a2a9f40d5f5df061fd9c4cbb607c10/js/core/core.sort.js#L44.
It seem it's trying to index aoColumns
with an object returned from my ajax call that is loaded via state restore into aaSorting
.
I'm not doing any data transformations here I'm just returning the structure that I was provided by state restore's ajax callback
This is what I'm provided in the callback and it's also what the ajax returns:
In short I guess what I'm asking is: Is it possible to use named columns with ajax callback state restore, is there an example I might have missed?
This question has an accepted answers - jump to answer
Answers
At the moment no, sorry. This is something that needs to be improved across the board in fact. Our columns are primarily index based.
Allan
Thanks Allan,
I appreciate the work you're doing regardless. I'll update the post if I end up working around it or potentially even upstream :^)
Hi Allan,
Apologies for the extra Q in a closed thread,
Is there any sort of callback I use to customise the ordering functionality?
eg. Intercept before the table is ordered and then map these textual keys to their current index if it exists?
Something like
stateLoadParams
but more specific to ordering?I'm not sure exactly what you are looking for. Here are a couple options to affect ordering:
columns.orderData
If you still need help please build a simple test case with an example of your data so we can see what you are wanting to do to offer suggestions.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin