Multiple table functions
Multiple table functions
Kinda same as my other post... If repost, sorry for the repost but I kinda cant get it...
Table looks like this
Name
ImSuchANoob deleteMe
I tried using http://www.datatables.net/examples/api/select_single_row.html but when I do that on two tables say example1 and example2... and done this
[code]
var oTable1;
var oTable2;
var giRedraw = false;
$(document).ready(function() {
/* Add a click handler to the rows - this could be used as a callback */
$("#example1 tbody").click(function(event) {
$(oTable1.fnSettings().aoData).each(function (){
$(this.nTr).removeClass('row_selected');
});
$(event.target.parentNode).addClass('row_selected');
});
$("#example2 tbody").click(function(event) {
$(oTable2.fnSettings().aoData).each(function (){
$(this.nTr).removeClass('row_selected');
});
$(event.target.parentNode).addClass('row_selected');
});
/* Add a click handler for the delete row */
$('#deleteMe').click( function() {
var anSelected = fnGetSelected( oTable );
oTable1.fnDeleteRow( anSelected[0] );
} );
/* Init the table */
oTable1 = $('#example1').dataTable( );
oTable2 = $('#example2').dataTable( );
} );
/* Get the rows which are currently selected */
function fnGetSelected( oTableLocal )
{
var aReturn = new Array();
var aTrs = oTableLocal.fnGetNodes();
for ( var i=0 ; i
Table looks like this
Name
ImSuchANoob deleteMe
I tried using http://www.datatables.net/examples/api/select_single_row.html but when I do that on two tables say example1 and example2... and done this
[code]
var oTable1;
var oTable2;
var giRedraw = false;
$(document).ready(function() {
/* Add a click handler to the rows - this could be used as a callback */
$("#example1 tbody").click(function(event) {
$(oTable1.fnSettings().aoData).each(function (){
$(this.nTr).removeClass('row_selected');
});
$(event.target.parentNode).addClass('row_selected');
});
$("#example2 tbody").click(function(event) {
$(oTable2.fnSettings().aoData).each(function (){
$(this.nTr).removeClass('row_selected');
});
$(event.target.parentNode).addClass('row_selected');
});
/* Add a click handler for the delete row */
$('#deleteMe').click( function() {
var anSelected = fnGetSelected( oTable );
oTable1.fnDeleteRow( anSelected[0] );
} );
/* Init the table */
oTable1 = $('#example1').dataTable( );
oTable2 = $('#example2').dataTable( );
} );
/* Get the rows which are currently selected */
function fnGetSelected( oTableLocal )
{
var aReturn = new Array();
var aTrs = oTableLocal.fnGetNodes();
for ( var i=0 ; i
This discussion has been closed.