diff --git a/inclure/gamutable.html b/inclure/gamutable.html
index 82203c0..ee21066 100644
--- a/inclure/gamutable.html
+++ b/inclure/gamutable.html
@@ -14,6 +14,7 @@
urlvuebloc="[(#ENV{urlvuebloc})]"
url_sort_asc="#ENV{sort_asc,#GET{sort_asc}}"
url_sort_desc="#ENV{sort_desc,#GET{sort_desc}}"
+ filtrecolmulti="#ENV{filtrecolmulti,non}"
ref="montableau"
>
@@ -32,6 +33,7 @@
urlvuebloc="[(#ENV{urlvuebloc_deux})]"
url_sort_asc="[(#ENV{sort_asc,#GET{sort_asc}})]"
url_sort_desc="[(#ENV{sort_desc,#GET{sort_desc}})]"
+ filtrecolmulti="[(#ENV{filtrecolmulti,non})]"
ref="montableau"
>
diff --git a/js/gamutable.es6.js b/js/gamutable.es6.js
index fff1a03..46a6105 100644
--- a/js/gamutable.es6.js
+++ b/js/gamutable.es6.js
@@ -179,6 +179,9 @@ let monTableau = {
type: String,
default: 'tableau',
},
+ filtrecolmulti: {
+ type: String,
+ },
},
data: function () {
return {
@@ -236,8 +239,11 @@ let monTableau = {
Object.keys(this.filtreColSelected).forEach((colName) => {
if (rsearch) {
let colValue = this.filtreColSelected[colName];
- if (colValue) {
- if (ligne.search[colName] !== colValue) {
+ if (!Array.isArray(colValue)) {
+ colValue = [colValue];
+ }
+ if (colValue.filter((w) => w.length > 0).length) {
+ if (colValue.filter((w) => w.length > 0).indexOf(ligne.search[colName]) === -1) {
rsearch = false;
}
}
@@ -273,21 +279,26 @@ let monTableau = {
localStorage.setItem(this.nameLocalStorage, JSON.stringify($table));
},
tableau() {
- this.filtreCol.forEach((col) => {
- let Tval = [''];
- this.tableau.forEach((t) => {
- let valCol = t.search[col];
- if (Tval.indexOf(valCol) === -1) {
- Tval.push(valCol);
- this.filtreColValOk = true;
- }
- });
- this.filtreColVal[col] = Tval;
- });
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ // Si on veut filtrer la liste des options dynamique en fonction
+ // du tri du tableau
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ //this.filtreCol.forEach((col) => {
+ //let Tval = [''];
+ //this.tableau.forEach((t) => {
+ //let valCol = t.search[col];
+ //if (Tval.indexOf(valCol) === -1) {
+ //Tval.push(valCol);
+ //this.filtreColValOk = true;
+ //}
+ //});
+ //this.filtreColVal[col] = Tval;
+ //});
},
},
methods: {
selectValCol() {
+ //console.log(this.filtreColSelected);
this.filtreColModif++;
},
calculer_nameLocalStorage() {
@@ -346,6 +357,16 @@ let monTableau = {
}
if (config.filtreCol !== undefined) {
this.filtreCol = config.filtreCol;
+ this.filtreCol.forEach((col) => {
+ let Tval = [''];
+ this.table.forEach((t) => {
+ let valCol = t.search[col];
+ if (Tval.indexOf(valCol) === -1) {
+ Tval.push(valCol);
+ }
+ });
+ this.filtreColVal[col] = Tval;
+ });
}
Vue.nextTick(() => {
this.chargement = false;
@@ -512,7 +533,16 @@ let monTableau = {
- |