Commit 23e28278 authored by Mat's avatar Mat

améliorations diverses

parent 0b22d46f
......@@ -129,6 +129,7 @@
function reloadTableMembre(paginate)
{
console.log(paginate);
tbody.innerHTML = null;
let membreURL = Routing.generate('api_membre_read_paginate', paginate);
......@@ -200,6 +201,7 @@
let membreId = this.dataset.membreId;
let r = confirm('Effacer le membre n°' + membreId
+ '\nCette action n\'est pas réversible. Souhaitez-vous continuer ?\n');
if (r === true) {
submitURL = Routing.generate('api_membre_delete', {'id': membreId });
AJAX('DELETE', submitURL, function()
......@@ -227,17 +229,17 @@
let total = json.length;
let perPage = paginate.step;
//console.log('parPage:' + perPage + ' total:' + total);
//console.log('total:' + total + ' parPage:' + perPage);
if (total > perPage)
{
let nbPages = total % perPage;
let nbPages = Math.ceil(total / perPage);
//console.log(nbPages + ' pages');
currentPage = paginate.page;
//console.log('page courante: '+ currentPage);
for (var i = 1; i <= nbPages; i++)
for (let i = 1; i <= nbPages; i++)
{
//console.log(i);
let pageItem = document.createElement('li');
pageItem.classList.add('page-item', (i === currentPage) ? 'active' : null);
......@@ -245,15 +247,16 @@
let pageItemChild = document.createElement((i === currentPage) ? 'span' : 'a');
pageItemChild.classList.add('page-link');
pageItemChild.textContent = i;
if (i !== currentPage) {
paginate.page = i;
if (i !== currentPage)
{
pageItemChild.addEventListener('click', function(e)
{
console.log(paginate);
console.log('click:' + i);
paginate.page = i;
reloadTableMembre(paginate);
});
}
pageItem.appendChild(pageItemChild);
pageNav.appendChild(pageItem);
}
......@@ -326,7 +329,8 @@
stepform.addEventListener('change', function(e)
{
step = (this.value === '-1') ? 10 : this.value;
paginate.step = step;
paginate.step = parseInt(step);
paginate.page = 1;
reloadTableMembre(paginate);
});
......@@ -350,7 +354,6 @@
paginate.column = col;
paginate.order = (paginate.order === 'ASC') ? 'DESC' : 'ASC';
console.log(paginate);
reloadTableMembre(paginate);
let th = this.parentNode;
......
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