Skip to content

Commit 4a8609a

Browse files
author
dtbuild
committed
0f7829eed7913b9828d8e3233d4979e7275b3ec5 Fix: If a state is loaded with a column index as a string, it would fail to restore the order.
https://datatables.net/forums/discussion/81318/ Sync to source repo @0f7829eed7913b9828d8e3233d4979e7275b3ec5
1 parent 37f0e93 commit 4a8609a

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

datatables.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
],
1212
"src-repo": "http://github.com/DataTables/DataTablesSrc",
1313
"last-tag": "2.3.3",
14-
"last-sync": "82910e1d58f4693abafab402eda74e131dbb7fd3"
14+
"last-sync": "0f7829eed7913b9828d8e3233d4979e7275b3ec5"
1515
}

js/dataTables.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6395,12 +6395,12 @@
63956395
if ( s.order !== undefined ) {
63966396
settings.aaSorting = [];
63976397
$.each( s.order, function ( i, col ) {
6398-
var set = [ col[0], col[1] ];
6398+
var set = [ _isNumber(col[0]) ? parseInt(col[0]) : col[0], col[1] ];
63996399

64006400
// A column name was stored and should be used for restore
6401-
if (typeof col[0] === 'string') {
6401+
if (typeof set[0] === 'string') {
64026402
// Find the name from the current list of column names
6403-
var idx = currentNames.indexOf(col[0]);
6403+
var idx = currentNames.indexOf(set[0]);
64046404

64056405
if (idx < 0) {
64066406
// If the column was not found ignore it and continue

js/dataTables.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/dataTables.min.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

js/dataTables.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6360,12 +6360,12 @@ function _fnImplementState ( settings, s, callback) {
63606360
if ( s.order !== undefined ) {
63616361
settings.aaSorting = [];
63626362
$.each( s.order, function ( i, col ) {
6363-
var set = [ col[0], col[1] ];
6363+
var set = [ _isNumber(col[0]) ? parseInt(col[0]) : col[0], col[1] ];
63646364

63656365
// A column name was stored and should be used for restore
6366-
if (typeof col[0] === 'string') {
6366+
if (typeof set[0] === 'string') {
63676367
// Find the name from the current list of column names
6368-
var idx = currentNames.indexOf(col[0]);
6368+
var idx = currentNames.indexOf(set[0]);
63696369

63706370
if (idx < 0) {
63716371
// If the column was not found ignore it and continue

0 commit comments

Comments
 (0)