State saving naming convention, easier way of changing name?
State saving naming convention, easier way of changing name?

I'm looking to change the name of the param used for state saving, it doesn't appear there is an easy way of doing this, be nice if there was a stateSaveName:
or similar that would overrule the 'settings.sInstance' or similar. I assume the following is the best way of doing it with minimum impact to the normal datatables way of working?:
stateSaveCallback: function(settings,data){
try {
return JSON.parse(
(settings.iStateDuration === -1 ? sessionStorage : localStorage).getItem(
'DataTables_' + (stateSaveName?stateSaveName + "_":"") +settings.sInstance+'_'+location.pathname
)
);
} catch (e) {}
},
With stateSaveName
being declared outside of datatables.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You'd need to use
stateSaveCallback
to define your own custom name. There isn't currently a way to define just the name.Allan