table.row(this).data on click of the row is now working the second time
table.row(this).data on click of the row is now working the second time
srinivasj2016
Posts: 2Questions: 1Answers: 1
Hi,
please find my code :
var weekTable = $('#jobs').DataTable({
"data": data.data, // Please assume data is defined
"columnDefs": [{
"targets": [2],
"visible": true
//"searchable": false
}]
});
$('#jobs tbody').on('click', 'tr', function (i,val) {
console.log(weekTable.row( this ).data());
});
I could only fetch the data only for the first time.
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Could you link to a test page showing the issue (per the forum rules). The code you have above looks like it should work for all rows in the table as far as I can see.
Allan
Sorry Allan for not linking the page. Actually, adding $('#jobs tbody').on('click', 'tr', function (i,val) { // code });
worked for me. Now I am getting row data on every click. I see more of the issue on the way jquery is been used & not the datatable. Thank you very much for the quick response.