Deleting a single row from multiple datatables

Deleting a single row from multiple datatables

gopalmergopalmer Posts: 2Questions: 0Answers: 0
edited May 2011 in General
Hi,

I have three datatables on one page and I need to be able to select one row on only one of the tables at a time and delete it. I've been using the following code from the examples, but using a class for the three tables.

[code]
var oTable;
var giRedraw = false;

$(document).ready(function() {
/* Add a click handler to the rows - this could be used as a callback */
$(".datatable tbody").click(function(event) {
$(oTable.fnSettings().aoData).each(function (){
$(this.nTr).removeClass('row_selected');
});
$(event.target.parentNode).addClass('row_selected');
});

/* Add a click handler for the delete row */
$('#delete').click( function() {
var anSelected = fnGetSelected( oTable );
oTable.fnDeleteRow( anSelected[0] );
} );

/* Init the table */
oTable = $('.datatable').dataTable( );
} );


/* Get the rows which are currently selected */
function fnGetSelected( oTableLocal )
{
var aReturn = new Array();
var aTrs = oTableLocal.fnGetNodes();

for ( var i=0 ; i

Replies

  • gopalmergopalmer Posts: 2Questions: 0Answers: 0
    Can anybody help me with this?
This discussion has been closed.