var oTable = $('#posGridView').dataTable( {
"bPaginate": false,
"bFilter": false,
"bSort": false,
"bInfo": false,
"oLanguage": {
"sZeroRecords": "",
"sEmptyTable": ""
}
} );
和
$("#posGridView tbody").click(function(event) {
$(oTable.fnSettings().aoData).each(function (){
$(this.nTr).removeClass('row_selected');
});
$(event.target.parentNode).addClass('row_selected');
});
上面的代码工作正常,当我选择 row 时,它会突出显示。但是当我按下 Delete Button 时,选择的行没有被删除。
$('#delete').click( function() {
var anSelected = fnGetSelected( oTable );
oTable.fnDeleteRow( anSelected[0] );
} );
当我发出警报(anSelected)时,我知道语句 var anSelected = fnGetSelected( oTable ); 不执行。