Unwanted repeated calls to function handling row clicks
Unwanted repeated calls to function handling row clicks
bugbuster
Posts: 2Questions: 0Answers: 0
I am having an issue while using datatables 1.9.3 here at the office.
my function to handle a clicked row is as follows :
function update_row_data(row_number)
{
\$(document).ready(function() {
oTable = \$('#tracking_table').dataTable();
oTable.\$('tr').click( function () {
var row_index = oTable.fnGetPosition(this);
alert("You clicked on row [" + row_index + "]");
var rowdata = oTable.fnGetData(this);
var count = rowdata.length;
alert("number of columns in row data array are " + count);
var lastcell = rowdata[count-1];
alert("value of last cell in row is : " + lastcell);
oTable.fnUpdate( [ rowdata[0] , rowdata[1] , rowdata[2] , rowdata[3] , rowdata[4] , rowd
ata[5] , rowdata[6] , rowdata[7] , rowdata[8] , 'my updated descr' ] , this); // update row
} );
} );
}
I am finding that when i click on a 2nd row to update its data that 2nd row is processed twice and if I click on a 3rd row it is processed 3 times. How can I "clear out" the queue/list of "clicked events" inside my click handling function ? Or is there a better way to not have duplicate calls to the click handling function ?
Thanks.
my function to handle a clicked row is as follows :
function update_row_data(row_number)
{
\$(document).ready(function() {
oTable = \$('#tracking_table').dataTable();
oTable.\$('tr').click( function () {
var row_index = oTable.fnGetPosition(this);
alert("You clicked on row [" + row_index + "]");
var rowdata = oTable.fnGetData(this);
var count = rowdata.length;
alert("number of columns in row data array are " + count);
var lastcell = rowdata[count-1];
alert("value of last cell in row is : " + lastcell);
oTable.fnUpdate( [ rowdata[0] , rowdata[1] , rowdata[2] , rowdata[3] , rowdata[4] , rowd
ata[5] , rowdata[6] , rowdata[7] , rowdata[8] , 'my updated descr' ] , this); // update row
} );
} );
}
I am finding that when i click on a 2nd row to update its data that 2nd row is processed twice and if I click on a 3rd row it is processed 3 times. How can I "clear out" the queue/list of "clicked events" inside my click handling function ? Or is there a better way to not have duplicate calls to the click handling function ?
Thanks.
This discussion has been closed.
Replies
Here is the "onclick=" specification I used :
The browser is internet explorer 8 running on a windows 7 laptop. The web server is Apache running on a linux server.