Change settings in the runtime
Change settings in the runtime
I can get the settings object with fnSettings() function. Is there a way to set those settings in the runtime if I have this object stored/serialized somewhere. Something like this:
[code]
var settings = oTable.fnSettings();
...
oTable.fnSettings(settings);
[/code]
Thanks!
[code]
var settings = oTable.fnSettings();
...
oTable.fnSettings(settings);
[/code]
Thanks!
This discussion has been closed.
Replies
To do what you are looking for there, you need to make a deep copy of the settings object, and then copy it back over the in use settings object when you want to restore it. The key thing here is that objects are stored/passed by reference in Javascript (a bit like pointers in C).
So step 1: Deep copy settings object to a variable (i.e. using $.extend() )
Step 2: To restore - you'll need to write your object back over (ideally a return deep copy) the element of $.fn.dataTableSettings[] that you originally copied
Bit of a technical one this one...
The easier way would be to simply save the attributes you want (display start, search etc) and then restore them. Although you might still run into problems with the arrays which are used...
Regards,
Allan