how I must process the event of doubleclick

how I must process the event of doubleclick

izumovizumov Posts: 178Questions: 14Answers: 0

have a programm code
$(document).ready(function() {
$('#clients').DataTable( {
scrollY: true,
scrollX:true,

    "processing": true,
    "bPaginate": true,
    "bSort": true,
    "serverSide": true,
    "autoWidth":true,
    // "ajax": "proc.php"
    "ajax": "server_processingclients.php"
} );
$('#clients tbody').on('dblclick', 'tr', function () {
    var data = table.row( this ).data();
    alert( 'You clicked on '+data[0]+'\'s row' );

but I get an error
Uncaught ReferenceError: table is not defined
at HTMLTableRowElement.<anonymous> (scriptdatatableclients3.js:15)
at HTMLTableSectionElement.dispatch (jquery-3.3.1.min.js:2)
at HTMLTableSectionElement.y.handle (jquery-3.3.1.min.js:2)
how to me to remove her and how to get access to data of cell for example the first column of this line?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,144Questions: 26Answers: 4,918
    Answer ✓

    You need to declare the table variable and you will want it to contain the Datatables API. Try doing this:
    var table = $('#clients').DataTable( {

    More info about using the Datatable API:
    https://datatables.net/manual/api#Accessing-the-API

    Kevin

  • izumovizumov Posts: 178Questions: 14Answers: 0

    it then what is necessary. A code began to work properly. Thank you very much for a help

This discussion has been closed.