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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| <script>
var timeoutId;
var datatable_etudiants;
$(document).ready( function () {
init_datatables();
update_students();
});
</script>
<div id="collapseetudiants">
<div class="row" style="margin:0;">
<div class="table-responsive">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<table id="datatable_etudiants" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th>Nom</th>
<th>Prenom</th>
<th>Adresse</th>
<th>ville</th>
</tr>
</thead>
<tbody></tbody>
</table>
<span class="text-right col-lg-12 col-md-12 col-sm-12 col-xs-12">Retour en haut</span>
</div>
</div>
</div>
</div>
<script>
function init_datatables() {
datatable_etudiants = $('#datatable_etudiants').DataTable({
searching: false,
responsive: true,
processing: true,
paging: false,
columnDefs: [
{ "width": "20%", "targets": 0 },
{ "width": "15%", "targets": 1 },
{ "width": "30%", "targets": 2 },
{ "width": "40%", "targets": 3 }
],
language: {
url: "/cdn/js/datatables/1.10.16/french.json",
emptyTable : "Chargement des donnée en cours, veuillez patienter ..."
}
});
new $.fn.dataTable.FixedHeader(datatable_etudiants);
}
function update_students(){
$.get("myActionController1",{},function(data){
datatable_etudiants.clear();
$.each(data.students,function(i,student){
$.when($.get("myActionController2/" + student.idStudent,{},function(d){
(data.students[i]).news = d;
})).done(function(){
add_row_students(datatable_suspicions, data.students[i]);
});
});
});
}
function add_row_students(e, data) {
e.row.add( [
data.nom,
data.prenom,
data.adr,
data.news
] ).draw();
}
</script> |
Partager