Voglio eliminare la riga da datatable. Ecco il codice dati che uso:jQuery Datatables: come eliminare la riga
var aSelected = [];
oTable = $('.itemPublished').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bServerSide": true,
"bProcessing": true,
"sAjaxSource": "/item/datatable",
"bDeferRender": true,
"iDisplayLength":20,
"aLengthMenu": [[10, 20, 50, 75, 100, 150], [10, 20, 50, 75, 100, 150]],
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 2, 3, 4 ] },
{ "sClass": "left", "aTargets": [ 1 ] }
],
"fnRowCallback": function(nRow, aData, iDisplayIndex) {
if (jQuery.inArray(aData.DT_RowId, aSelected) !== -1) {
$(nRow).addClass('row_selected');
}
$(nRow).addClass('gradeA');
return nRow;
}
});
Volevo testare un evento per eliminare una riga dal datatable. L'evento è attivato da un pulsante che si trova all'esterno della tabella dei datatables. Ho provato a fare questo:
$('.test').live('click', function() {
oTable.fnDeleteRow(0);
});
Per verificare se è possibile eliminare la prima riga dalla tabella, ma non è così e né produrre alcun errore. Dove sto andando male?
http://stackoverflow.com/a/8254752/617373 – Daniel