DataTables Editor v2.5.2 getting issue after remove row (row selected) not remove
DataTables Editor v2.5.2 getting issue after remove row (row selected) not remove
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

AI Response (Cloud opus 4.6 thinking model)
This is because Editor v2.5.2 and Select 3.1.3 were developed somewhat independently by SpryMedia. The deselect() before remove() fix is missing from the official Editor v2.5.2 release — it's a compatibility gap, not something you misconfigured.
Why it's not there by default
Select 1.x/2.x tracked selections only via _select_selected flag on each row's aoData. When SSP redraws, aoData is rebuilt fresh from server — stale selections cleared automatically. No deselect() needed.
Select 3.x introduced _select_set (a persistent array of row IDs) to support cross-page selection persistence in SSP. This array is NOT cleared on redraw — that's intentional, so selections survive page changes.
Editor v2.5.2 was written/tested against the older Select behavior. Its remove() function just calls dt.rows().remove() without deselect() first, because with Select 1.x/2.x this was fine.
When you upgraded your DataTables bundle (which includes Select 3.1.3), Editor's remove() function was never updated to account for the new _select_set tracking.
In short
It's a bug/oversight in Editor v2.5.2 when paired with Select 3.x. SpryMedia will likely patch this in a future Editor release. Until then, your manual fix is the correct solution — it's exactly what the official fix would look like.
You can report this to SpryMedia at editor.datatables.net/forums referencing:
Editor v2.5.2 dataSource.remove() doesn't call deselect() before remove()
Select 3.1.3 _select_set retains stale IDs for deleted rows with serverSide: true
Manually I have fixed globally using AI in the file "datatables/dataTables.editor.js"
/*******************************************************************/
remove: function (identifier, fields, store) {
// No confirmation from the server
var that = this;
var dt = _dtApi(this.s.table);
var cancelled = store.cancelled;
if (cancelled.length === 0) {
// No rows were cancelled on the server-side, remove them all
dt.rows(identifier).deselect();
dt.rows(identifier).remove();
} else {
// One or more rows were cancelled, so we need to identify them
// and not remove those rows
var indexes_1 = [];
dt.rows(identifier).every(function () {
var id = dataSource$1.id.call(that, this.data());
if ($.inArray(id, cancelled) === -1) {
// Don't use remove here - it messes up the indexes
indexes_1.push(this.index());
}
});
dt.rows(indexes_1).deselect();
dt.rows(indexes_1).remove();
}
},
/****************************************************/
the Two Line change:
// No rows were cancelled on the server-side, remove them all
dt.rows(identifier).deselect();
dt.rows(indexes_1).deselect();
please suggest, the correct way
Replies
Hi,
Many thanks for letting me know about this error. I can see it happening in my own example. I will dig into it and get back to you. Good to hear you have a workaround at the moment.
Allan