State saving naming convention, easier way of changing name?

State saving naming convention, easier way of changing name?

JammySlayerJammySlayer Posts: 43Questions: 12Answers: 2

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

Answers

  • allanallan Posts: 64,947Questions: 1Answers: 10,758 Site admin
    Answer ✓

    You'd need to use stateSaveCallback to define your own custom name. There isn't currently a way to define just the name.

    Allan

This discussion has been closed.