Commit 8dccc90b authored by Mat's avatar Mat

hop

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