Commit 8dccc90b authored by Mat's avatar Mat

hop

parent 6b3d5c8a
...@@ -93,18 +93,17 @@ ...@@ -93,18 +93,17 @@
let table = document.querySelector('table#maintab.membres'); let table = document.querySelector('table#maintab.membres');
let tbody = table.querySelector('tbody'); let tbody = table.querySelector('tbody');
function reloadTableMembre()
/* /*
* Recharge la table * Recharge la table
*/ */
function reloadTableMembre(paginate = null)
{ {
let membreURL = Routing.generate('api_membre_read_paginate', { if (paginate === null) {
'step' : step, let paginate = { 'step': 10, 'page': 1, 'col': 'id', 'order': 'ASC' };
'start' : page, }
'column' : col,
'order' : order let membreURL = Routing.generate('api_membre_read_paginate', paginate);
});
tbody.innerHTML = null; tbody.innerHTML = null;
AJAX('GET', membreURL, function(request) AJAX('GET', membreURL, function(request)
...@@ -240,16 +239,16 @@ ...@@ -240,16 +239,16 @@
form); form);
}); });
let stepform = document.querySelector('form#pagination select');
stepform.addEventListener('change', function(e) {
/* /*
* Définir le pas de la pagination * Définir le pas de la pagination
*/ */
let stepform = document.querySelector('form#pagination select');
stepform.addEventListener('change', function(e)
{
step = this.value; step = this.value;
reloadTableMembre({ 'step': step });
console.log('change step='+ step); console.log('change step='+ step);
console.log();
}); });
/* /*
...@@ -259,9 +258,18 @@ ...@@ -259,9 +258,18 @@
let columns = document.querySelectorAll('th[scope="col"] a.btn-sort'); let columns = document.querySelectorAll('th[scope="col"] a.btn-sort');
columns.forEach(function(column) columns.forEach(function(column)
{ {
let col = column.getAttribute('id'); let col = column.getAttribute('id');
column.addEventListener('click', function(e) column.addEventListener('click', function(e)
{ {
reloadTableMembre({ 'col': col, 'order': order });
let a = column.parentNode;
let b = document.createElement('i');
b.classList.add('fas', 'fa-caret-' + (order === 'DESC') ? 'down' : 'up');
a.appendChild(b);
console.log(a);
console.log('toggle id='+ col+ ' order='+ order); console.log('toggle id='+ col+ ' order='+ order);
order = (order === 'ASC') ? 'DESC' : 'ASC'; order = (order === 'ASC') ? 'DESC' : 'ASC';
}); });
......
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