Skip to content

Commit 3e83d1d

Browse files
committedSep 23, 2021
1be97b106ca9b87308ca4fba2e8d8abf795c9213 dev: Stop calling save state when loading a state
Jira Issue DD-2301 01d171892df647431a6f7e6d3acc13e29a46ed0d dev: More resetting of flags from previous commit Jira Issue DD-2301 Sync to source repo @01d171892df647431a6f7e6d3acc13e29a46ed0d
1 parent 5047dd5 commit 3e83d1d

File tree

3 files changed

+80
-68
lines changed

3 files changed

+80
-68
lines changed
 

‎datatables.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
],
1010
"src-repo": "http://github.com/DataTables/DataTablesSrc",
1111
"last-tag": "1.11.2",
12-
"last-sync": "1eddf57e55486c9e69581f14f77a2c3cd58b43f4"
12+
"last-sync": "01d171892df647431a6f7e6d3acc13e29a46ed0d"
1313
}

‎js/jquery.dataTables.js

+11
Original file line numberDiff line numberDiff line change
@@ -6382,6 +6382,11 @@
63826382
*/
63836383
function _fnSaveState ( settings )
63846384
{
6385+
if (settings._bLoadingState) {
6386+
console.log(settings._bLoadingState)
6387+
return;
6388+
}
6389+
63856390
/* Store the interesting variables */
63866391
var state = {
63876392
time: +new Date(),
@@ -6438,12 +6443,14 @@
64386443
function _fnImplementState ( settings, s, callback) {
64396444
var i, ien;
64406445
var columns = settings.aoColumns;
6446+
settings._bLoadingState = true;
64416447

64426448
// When StateRestore was introduced the state could now be implemented at any time
64436449
// Not just initialisation. To do this an api instance is required in some places
64446450
var api = settings._bInitComplete ? new DataTable.Api(settings) : null;
64456451

64466452
if ( ! s || ! s.time ) {
6453+
settings._bLoadingState = false;
64476454
callback();
64486455
return;
64496456
}
@@ -6452,19 +6459,22 @@
64526459
// cancelling of loading by returning false
64536460
var abStateLoad = _fnCallbackFire( settings, 'aoStateLoadParams', 'stateLoadParams', [settings, s] );
64546461
if ( $.inArray( false, abStateLoad ) !== -1 ) {
6462+
settings._bLoadingState = false;
64556463
callback();
64566464
return;
64576465
}
64586466

64596467
// Reject old data
64606468
var duration = settings.iStateDuration;
64616469
if ( duration > 0 && s.time < +new Date() - (duration*1000) ) {
6470+
settings._bLoadingState = false;
64626471
callback();
64636472
return;
64646473
}
64656474

64666475
// Number of columns have changed - all bets are off, no restore of settings
64676476
if ( s.columns && columns.length !== s.columns.length ) {
6477+
settings._bLoadingState = false;
64686478
callback();
64696479
return;
64706480
}
@@ -6529,6 +6539,7 @@
65296539
}
65306540
}
65316541

6542+
settings._bLoadingState = false;
65326543
_fnCallbackFire( settings, 'aoStateLoaded', 'stateLoaded', [settings, s] );
65336544
callback();
65346545
};

‎js/jquery.dataTables.min.js

+68-67
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.