trouble deleting rows by id
trouble deleting rows by id
Can't seem to remove rows by their ID.
[code]
$.each( selected, function( index, value ) {
DT.fnDeleteRow( document.getElementById( '"'+value+'"' ) );
console.log('"'+value+'"');
});
DT.fnDraw();
[/code]
selected is an array... I have verified with console log that value is in the format "187421" where exists in the current table's display.
DT is the variable I set = to my table.
[code]
var DT = $('#sample_1').dataTable({
... table stuff
});
[/code]
[code]
$.each( selected, function( index, value ) {
DT.fnDeleteRow( document.getElementById( '"'+value+'"' ) );
console.log('"'+value+'"');
});
DT.fnDraw();
[/code]
selected is an array... I have verified with console log that value is in the format "187421" where exists in the current table's display.
DT is the variable I set = to my table.
[code]
var DT = $('#sample_1').dataTable({
... table stuff
});
[/code]
This discussion has been closed.
Replies
console.log(value); = 187422
console.log(something); =
which are both valid, however, the row is not removed from the table.
[code]
$.each( selected, function( index, value ) {
var something = document.getElementById(value)
$('#sample_1').dataTable().fnDeleteRow(something, null, false);
console.log(something);
console.log(value);
});
$('#sample_1').dataTable().fnDraw();
[/code]
Are you using server-side processing perhaps? fnDeleteRow is a client-side function, so will have no effect on server-side processing tables, since the data is at the server.
Allan