HELP | Double click event on table
HELP | Double click event on table
TurksEmperor
Posts: 9Questions: 3Answers: 0
in General
Hello Masters;
Is there a way to get the **ID Number **of that row when I double-click on any row in the table?
The format of the table is as in the link below.
http://live.datatables.net/miwopudo/1/edit
Thank you very much for your help..
-Emre SAĞLAM-
This question has an accepted answers - jump to answer
Answers
This is how I solved the problem.
$(document).ready( function () {
var table = $('#example').DataTable();
$('#example tbody').on( 'dblclick', 'tr', function () {
var id = table.row( this ).data();
alert(id["0"]);
} );
} );
I have only one question left. I am currently getting the ID information with the alert, is there a way to get the information of the cell I clicked in addition?
example 4, Accountant
Try adding
td
to the selector, for example:.on( 'dblclick', 'tr td', function ()
. You can use atd
as arow-selector
so the rest of the code shouldn't need changed to get the clicked row data. You can usecell().data()
to get the particular cell using the sametd
as thecell-selector
.Kevin
Thanks to you, I have solved the problem. thank you very much. (Kevin)