1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-12-02 14:24:11 +01:00

Dev update: Use $.extend to copy arrays and objects for the state savings, as we don't want plug-ins to be able to muck around with the DataTables internals by mistake (even with the slice, the objects in the arrays maintain their references)

This commit is contained in:
Allan Jardine 2012-01-02 19:59:52 +00:00
parent a4c7ac222a
commit 9809d71161
2 changed files with 12 additions and 12 deletions

View File

@ -4235,15 +4235,15 @@
}
/* Store the interesting variables */
var i, iLen;
var i, iLen, bInfinite=oSettings.oScroll.bInfinite;
var oState = {
"iCreate": new Date().getTime(),
"iStart": (oSettings.oScroll.bInfinite ? 0 : oSettings._iDisplayStart),
"iEnd": (oSettings.oScroll.bInfinite ? oSettings._iDisplayLength : oSettings._iDisplayEnd),
"iStart": (bInfinite ? 0 : oSettings._iDisplayStart),
"iEnd": (bInfinite ? oSettings._iDisplayLength : oSettings._iDisplayEnd),
"iLength": oSettings._iDisplayLength,
"aaSorting": oSettings.aaSorting.slice(),
"oSearch": oSettings.oPreviousSearch.sSearch,
"aoSearchCols": oSettings.aoPreSearchCols.slice(),
"aaSorting": $.extend( true, [], oSettings.aaSorting ),
"oSearch": $.extend( true, {}, oSettings.oPreviousSearch ),
"aoSearchCols": $.extend( true, [], oSettings.aoPreSearchCols ),
"abVisCols": []
};

View File

@ -13,15 +13,15 @@ function _fnSaveState ( oSettings )
}
/* Store the interesting variables */
var i, iLen;
var i, iLen, bInfinite=oSettings.oScroll.bInfinite;
var oState = {
"iCreate": new Date().getTime(),
"iStart": (oSettings.oScroll.bInfinite ? 0 : oSettings._iDisplayStart),
"iEnd": (oSettings.oScroll.bInfinite ? oSettings._iDisplayLength : oSettings._iDisplayEnd),
"iStart": (bInfinite ? 0 : oSettings._iDisplayStart),
"iEnd": (bInfinite ? oSettings._iDisplayLength : oSettings._iDisplayEnd),
"iLength": oSettings._iDisplayLength,
"aaSorting": oSettings.aaSorting.slice(),
"oSearch": oSettings.oPreviousSearch.sSearch,
"aoSearchCols": oSettings.aoPreSearchCols.slice(),
"aaSorting": $.extend( true, [], oSettings.aaSorting ),
"oSearch": $.extend( true, {}, oSettings.oPreviousSearch ),
"aoSearchCols": $.extend( true, [], oSettings.aoPreSearchCols ),
"abVisCols": []
};