From eff8722fa2169dd3e7f939ea5105a1365b3c2173 Mon Sep 17 00:00:00 2001 From: tofulm Date: Mon, 4 Apr 2022 23:04:26 +0200 Subject: [PATCH] Ajoute la possibilite de filtrer via les urls les selects, cf doc --- README.md | 7 +++++++ inclure/gamutable.html | 2 ++ js/gamutable.es6.js | 12 ++++++++++++ js/gamutable.js | 11 +++++++++++ 4 files changed, 32 insertions(+) diff --git a/README.md b/README.md index 54f75e3..78bfde8 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,14 @@ Choisir entre la version minifiée de vuejs (sans le debug) ou la version de dev includespip="#ENV{includespip}" // pour ajouter un code html dans la ligne au dessus du tableau nomBlocAjaxReload="nom bloc a recharger à la fin du chargement des donnees" env + filtreselect='[(#ENV{filtrerselect}|rawurldecode)]' }> + +[(#SET{filtrerselect,#ARRAY{ + 0,#ARRAY{champ,secteur,valeurs,Le chat}, + 1,#ARRAY{champ,voie,valeurs,Turlut man} + }|json_encode|rawurlencode})] + aaaa ``` - **url_sort_asc** et **url_sort_desc** => surcharge possible des icones de tri de colonnes diff --git a/inclure/gamutable.html b/inclure/gamutable.html index 618339c..6cceff5 100644 --- a/inclure/gamutable.html +++ b/inclure/gamutable.html @@ -24,6 +24,7 @@ ref="montableau" filtrer="#ENV{filtrer}" _id="#ENV{_id}" + filtreselect='[(#ENV{filtrerselect}|rawurldecode)]' > @@ -49,6 +50,7 @@ filtrer="#ENV{filtrer}" affichage_id="#ENV{_id}" _id="#ENV{_id}" + filtreselect='[(#ENV{a}|rawurldecode)]' > diff --git a/js/gamutable.es6.js b/js/gamutable.es6.js index 61dd014..8044859 100644 --- a/js/gamutable.es6.js +++ b/js/gamutable.es6.js @@ -204,6 +204,9 @@ let monTableau = { _id: { type: String, }, + filtreselect: { + type: String, + }, }, data: function () { return { @@ -488,6 +491,15 @@ let monTableau = { Vue.nextTick(() => { this.chargement = false; + + if (this.filtreselect) { + let Tfiltres = recupJson(this.filtreselect); + Tfiltres.forEach((col) => { + this.filtreColSelected[col.champ].push(col.valeurs); + }); + this.filtreColModif++; + } + if (parseInt(this._id) > 0) { let _id = parseInt(this._id); let parPage = parseInt(this.parPage); diff --git a/js/gamutable.js b/js/gamutable.js index 5882ecc..47322d5 100644 --- a/js/gamutable.js +++ b/js/gamutable.js @@ -254,6 +254,9 @@ var monTableau = { }, _id: { type: String + }, + filtreselect: { + type: String } }, data: function data() { @@ -565,6 +568,14 @@ var monTableau = { Vue.nextTick(function () { _this4.chargement = false; + if (_this4.filtreselect) { + var Tfiltres = recupJson(_this4.filtreselect); + Tfiltres.forEach(function (col) { + _this4.filtreColSelected[col.champ].push(col.valeurs); + }); + _this4.filtreColModif++; + } + if (parseInt(_this4._id) > 0) { var _id = parseInt(_this4._id);