How to update datatable with rowReorder.update set to false
How to update datatable with rowReorder.update set to false
Oxyxy
Posts: 5Questions: 2Answers: 0
Hi,
I have a server side process, so on row-reorder I set the option "update" to false. When I get error from ajax call, it works fine. I just redraw my datatable and it's ok. But when I try to mannually update data inside my datatable I have a hard time :-(
My code
var datatable = $('#mydatatable').DataTable( {
rowReorder: {update: false}
} );
datatable.on( 'row-reorder', function ( e, details, edit ) {
for (i = 0; i < details.length ; i++) {
var row = datatable.row(details[i].node);
var rowData = row.data();
var datatableRow = datatable.rows(i);
var datatableRowData = datatable.rows(i).data();
// I got 7 columns
datatableRowData[0] = rowData[0];
datatableRowData[1] = rowData[1];
datatableRowData[2] = rowData[2];
datatableRowData[3] = rowData[3];
datatableRowData[4] = rowData[4];
datatableRowData[5] = rowData[5];
datatableRowData[6] = rowData[6];
datatableRow.invalidate();
}
datatable.draw(false);
} );
I try to take example on source from dataTables.rowReorder.js (1.1.0) but I can see that I'm missing some functions...
if ( this.c.update ) {
for ( i=0, ien=fullDiff.length ; i<ien ; i++ ) {
var row = dt.row( fullDiff[i].node );
var rowData = row.data();
setDataFn( rowData, fullDiff[i].newData );
// Invalidate the cell that has the same data source as the dataSrc
dt.columns().every( function () {
if ( this.dataSrc() === dataSrc ) {
dt.cell( fullDiff[i].node, this.index() ).invalidate( 'data' );
}
} );
}
dt.draw( false );
}
Thanks in advance ;-)
Oxyxy
This discussion has been closed.
Answers
Hi everyone,
I didn't find any solution to my issue so I go through another path :-)
Update for rowreorder is set true, When I got an ajax call error I use NotifyJs to notify user.
I hope that it would be useful ;-)
Oxyxy