TableTools + fnRowSelected + GetData
TableTools + fnRowSelected + GetData
robinagarcia
Posts: 3Questions: 0Answers: 0
I'm trying to get the values from a row with this syntax:
[code]"oTableTools": {
"sRowSelect": "single",
"fnRowSelected": function ( nodes ) {
$('tr').click( function () {
var data = oTable.fnGetData( this );
console.log(data);
// ... do something with the array / object of data for the row
} );
[/code]
this is the debug:
[code]
http://debug.datatables.net/atazab
[/code]
It actually works (partially). The first "click" after the table renders doesn't do anyting, the second one works, BUT if you click rapidly it starts to do the routines couple times at once. I'm missing something? How can i fix this? Sorry bothering with this trivial things.
EDIT: Solved with this:
[code]
$('#table_mecanico').delegate('tr', 'click', function(event){
alert("clicked");
var data = oTable.fnGetData( this );
console.log(data);
// ... do something with the array / object of data for the row
});
[/code]
[code]"oTableTools": {
"sRowSelect": "single",
"fnRowSelected": function ( nodes ) {
$('tr').click( function () {
var data = oTable.fnGetData( this );
console.log(data);
// ... do something with the array / object of data for the row
} );
[/code]
this is the debug:
[code]
http://debug.datatables.net/atazab
[/code]
It actually works (partially). The first "click" after the table renders doesn't do anyting, the second one works, BUT if you click rapidly it starts to do the routines couple times at once. I'm missing something? How can i fix this? Sorry bothering with this trivial things.
EDIT: Solved with this:
[code]
$('#table_mecanico').delegate('tr', 'click', function(event){
alert("clicked");
var data = oTable.fnGetData( this );
console.log(data);
// ... do something with the array / object of data for the row
});
[/code]
This discussion has been closed.