HELP | Double click event on table

HELP | Double click event on table

TurksEmperorTurksEmperor Posts: 9Questions: 3Answers: 0

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

  • TurksEmperorTurksEmperor Posts: 9Questions: 3Answers: 0

    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

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794
    Answer ✓

    Try adding td to the selector, for example: .on( 'dblclick', 'tr td', function (). You can use a td as a row-selector so the rest of the code shouldn't need changed to get the clicked row data. You can use cell().data() to get the particular cell using the same td as the cell-selector.

    Kevin

  • TurksEmperorTurksEmperor Posts: 9Questions: 3Answers: 0

    Thanks to you, I have solved the problem. thank you very much. (Kevin)

Sign In or Register to comment.