1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
$(document).ready(function(){
$('#myTable').DataTable({
dom:'Bfrtip',
buttons:[
'copy',
'csv',
'excel',
'pdf',
'print',
],
select: true,
scrollY:415,
scrollX: true,
processing: true,
serverSide: true,
ajax: 'server_processing2.php',
columns:[
{data:"id_Client",name:"id_Client"},
{data:"nom_Client",name:"nom_Client"},
{data:"NIF_Client",name:"NIF_Client"},
{data:"adresse_Client",name:"adresse_Client"},
{data:"tel_Client",name:"tel_Client"},
{data:"email_Client",name:"email_Client"},
{
data:null,
orderable:false,
searchable:false,
render:function(data,display,dataRow,settings){
return '<button type="button" id="mybtn'+ dataRow.DT_RowId+'" '+'class="btn btn-primary mybtn" data-toggle="modal" data-target="myModal">Details</button>';
}
},
]
});
//Script que j'ai trouvé dans le forum de DataTables.net
$('#myTable body ').on('click', 'button', function (event) {
var row = $(this).closest("tr").get(0);
var aData = table.row(row).data();
$('#DTmyModal').modal('show');
event.stopImmediatePropagation();
});
}); |