Commit 9a6a2512 authored by JonathanMM's avatar JonathanMM

Passage en ajax de la liste des stations

parent 5df1a518
......@@ -90,7 +90,36 @@
$(document).ready( function () {
var dt = $('#stations').DataTable({
ajax: 'api.php?action=getDataConso&idConso={$idConso}',
columns: ['codeStr', 'name', 'dateOuverture', 'state', 'nbBike', 'nbEbike', 'nbFreeEDock'],
columns: [{
data: 'codeStr',
render: function(data, type, row, meta)
{
return '<a href="station.php?code='+row.code+'">'+data+'</a>';
}
},{
data: 'name'
},{
data: 'dateOuverture',
render: function(data, type, row, meta)
{
if(data == 'Non ouvert')
return data;
var date = new Date(data);
return putZero(date.getDate()) + '/' + putZero(date.getMonth()+1) + '/' + date.getFullYear();
}
},{
data: 'state'
},{
data: 'nbBike'
},{
data: 'nbEbike'
},{
data: 'nbFreeEDock',
render: function(data, type, row, meta)
{
return data+'/'+row.nbEDock;
}
}],
language: dtTraduction
});
filtreDataTable();
......
......@@ -274,4 +274,11 @@ var dtTraduction = {
"sSortAscending": ": activer pour trier la colonne par ordre croissant",
"sSortDescending": ": activer pour trier la colonne par ordre d&eacute;croissant"
}
};
\ No newline at end of file
};
function putZero(num)
{
if(num <= 9)
return '0'+num;
return num;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment