Editor 1.5.1 upgrade with legacy data format returns error on editing.
Editor 1.5.1 upgrade with legacy data format returns error on editing.
We're using our own server-side code for data edits, so after upgrading to the newest Editor we chose to stick with the legacy data format (we don't need multi-row editing.) I got it to work OK, but am having trouble when editing an existing row. The data saves on the back end, but the front end won't update the row. I get this error in the console:
Uncaught TypeError: row.any is not a function
At first this was because I wasn't sending back the ID of the edited row correctly. Now it's able to identify and get the correct row, but when it tests the row by using .any(), it fails. Here is the relevant section of dataTables.editor.js, around line 5845. What should I do?
// The identifier can select one or more rows, but the data will
// refer to just a single row. We need to determine which row from
// the set is the one to operator on.
var idFn = DataTable.ext.oApi._fnGetObjectDataFn( this.s.idSrc );
var rowId = idFn( data );
var row;
// Find the row to edit - attempt to do an id look up first for speed
row = dt.row( '#'+rowId );
// If not found, then we need to do it the slow way
if ( ! row.any() ) {
row = dt.row( function ( rowIdx, rowData, rowNode ) {
return rowId === idFn( rowData );
} );
}
Answers
Ah, I think this is fixed. I had upgraded the editor but not the core DataTables. I was using 1.10.6; updating to 1.10.9 seems to have fixed the issue.
Hi,
Good to hear you've got this working now. Yes, the
any()
method was introduced in DataTables 1.10.7 and Editor 1.5 uses it.Regards,
Allan