forked from ScoDoc/ScoDoc
Table recap / jury: mémorise ordre de tri
This commit is contained in:
parent
b5138d3dfe
commit
01d28eac90
@ -9,6 +9,22 @@ $(function () {
|
||||
} else {
|
||||
hidden_colums = hidden_colums.concat(["recorded_code"]);
|
||||
}
|
||||
// Etat (tri des colonnes) de la table:
|
||||
|
||||
const url = new URL(document.URL);
|
||||
const formsemestre_id = url.searchParams.get("formsemestre_id");
|
||||
const order_info_key = JSON.stringify([url.pathname, formsemestre_id]);
|
||||
let order_info;
|
||||
if (formsemestre_id) {
|
||||
const x = localStorage.getItem(order_info_key);
|
||||
if (x) {
|
||||
try {
|
||||
order_info = JSON.parse(x);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Les boutons dépendent du mode BUT ou classique:
|
||||
let buttons = [
|
||||
{
|
||||
@ -169,7 +185,15 @@ $(function () {
|
||||
autoClose: true,
|
||||
buttons: buttons,
|
||||
},
|
||||
]
|
||||
],
|
||||
"drawCallback": function (settings) {
|
||||
// permet de conserver l'ordre de tri des colonnes
|
||||
let order_info = JSON.stringify($('table.table_recap').DataTable().order());
|
||||
if (formsemestre_id) {
|
||||
localStorage.setItem(order_info_key, order_info);
|
||||
}
|
||||
},
|
||||
"order": order_info,
|
||||
}
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user