Skip to content

Commit 8490340

Browse files
author
dtbuild
committed
1c48c11ac0168d9598795641b4fc337a2233289e Fix: Don't modify the display array in -api row().remove() - it should wait for the next draw
This relates to DataTables/DataTablesSrc#269 and is fairly nuanced - it boils down to the fact that the display array should reflect what is shown in the table, and deleting a value from it will cause an index offset. The other option might be to make the element null, as happens with the master, but that would be a change in type and I'm not certain everything could handle that. The array will regenerate on the next draw, so it is properly in sync with what is drawn now. Sync to source repo @1c48c11ac0168d9598795641b4fc337a2233289e
1 parent 490d27b commit 8490340

5 files changed

+3
-13
lines changed

datatables.json

+1-1
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.0.4",
14-
"last-sync": "d04853a9ab4fb7e9f5b4acfc1fea81f5952116e8"
14+
"last-sync": "1c48c11ac0168d9598795641b4fc337a2233289e"
1515
}

js/dataTables.js

-5
Original file line numberDiff line numberDiff line change
@@ -7812,11 +7812,6 @@
78127812
settings.aiDisplayMaster.splice(idx, 1);
78137813
}
78147814

7815-
idx = settings.aiDisplay.indexOf(row);
7816-
if (idx !== -1) {
7817-
settings.aiDisplay.splice(idx, 1);
7818-
}
7819-
78207815
// For server-side processing tables - subtract the deleted row from the count
78217816
if ( settings._iRecordsDisplay > 0 ) {
78227817
settings._iRecordsDisplay--;

js/dataTables.min.js

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

js/dataTables.min.mjs

+1-1
Large diffs are not rendered by default.

js/dataTables.mjs

-5
Original file line numberDiff line numberDiff line change
@@ -7759,11 +7759,6 @@ _api_registerPlural( 'rows().remove()', 'row().remove()', function () {
77597759
settings.aiDisplayMaster.splice(idx, 1);
77607760
}
77617761

7762-
idx = settings.aiDisplay.indexOf(row);
7763-
if (idx !== -1) {
7764-
settings.aiDisplay.splice(idx, 1);
7765-
}
7766-
77677762
// For server-side processing tables - subtract the deleted row from the count
77687763
if ( settings._iRecordsDisplay > 0 ) {
77697764
settings._iRecordsDisplay--;

0 commit comments

Comments
 (0)