can't get data from row without using editor
can't get data from row without using editor
Hello
Row are displayed correctly.
I just want get row data content on click but I can't.
...
$(document).ready(function() {
var table = $('#donnees').DataTable( {
ajax: "getdata.php?T=menu",
dom: "t",
pageLength: -1,
ordering: false,
columns: [ {data: 'Libelle'} ]
});
$('#donnees').on( 'click','tbody', function () {
var d = table.rows($(this)).data();
} );
});
....
<body class="dataTables">
<div class="container">
<table id="donnees" class="display" style="width:50%">
<thead>
<tr style="text-align:left">
<th></th><th></th>
</tr>
</thead>
</table>
</div>
</body>
</html>
Does somebody have an idea please ?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You need to adjust your selector a bit to something like this:
$('#donnees').on( 'click','tbody tr', function () {
Notice the
tr
in the selector. Basically$(this)
was thetbody
but you want it to be the row.Kevin
Thanks a lot... I did try many way but never find that.
