on utilise vue select pour les tetes de colonnes

This commit is contained in:
Christophe 2021-01-24 22:35:22 +01:00
parent d507f4136f
commit e9f70ec13e
2 changed files with 50 additions and 30 deletions

View file

@ -190,7 +190,7 @@ let monTableau = {
crayons: [],
classes: [],
filtreCol: [],
filtreColSelected: [],
filtreColSelected: { gestionnaire: [] },
filtreColModif: 0,
filtreColVal: {},
search: '',
@ -239,6 +239,7 @@ let monTableau = {
return false;
}
Object.keys(this.filtreColSelected).forEach((colName) => {
console.log('coucou');
if (rsearch) {
let colValue = this.filtreColSelected[colName];
if (!Array.isArray(colValue)) {
@ -341,6 +342,20 @@ let monTableau = {
if (config.classes !== undefined) {
this.classes = config.classes;
}
if (config.filtreCol !== undefined) {
this.filtreCol = config.filtreCol;
this.filtreCol.forEach((col) => {
let Tval = [''];
this.table.forEach((t) => {
let valCol = t.html[col];
if (Tval.indexOf(valCol) === -1) {
Tval.push(valCol);
}
});
this.filtreColVal[col] = Tval;
this.filtreColSelected[col] = [];
});
}
this.table = data;
if (data.length && data[0].search) {
this.champ_search = 'search';
@ -384,6 +399,7 @@ let monTableau = {
}
});
this.filtreColVal[col] = Tval;
this.filtreColSelected[col] = [];
});
}
Vue.nextTick(() => {
@ -487,15 +503,6 @@ let monTableau = {
},
template: `
<div class="gamutable">
<div>
<vue-select
v-model="model"
:options="options"
hide-selected
multiple
taggable
></vue-select>
</div>
<div class="gamutable--surTable">
<select id="parPage" v-model="parPageSelect">
<option v-for="v in tparpage" :key="v">{{v}}</option>
@ -560,24 +567,14 @@ let monTableau = {
<tr v-if="filtreCol.length" class="filtreColonne">
<th v-for="(label,head,i) in header" :key="'filtreCol_'+i">
<div v-if="filtreCol.indexOf(head) !== -1" :id="'filtreCol_'+head">
<select class="filtrerCol" v-model="filtreColSelected[head]" v-if="filtrecolmulti !== 'non'" multiple>
<option
v-for="(option,j) in filtreColVal[head]"
:value="option"
@click="selectValCol"
>
{{j === 0 ? "Tous" : option}}
</option>
</select>
<select class="filtrerCol" v-model="filtreColSelected[head]" v-else>
<option
v-for="(option,j) in filtreColVal[head]"
:value="option"
@click="selectValCol"
>
{{j === 0 ? "Tous" : option}}
</option>
</select>
<vue-select
v-model="filtreColSelected[head]"
:options="filtreColVal[head]"
hide-selected
multiple
taggable
@selected="selectValCol"
></vue-select>
</div>
</th>
</tr>

File diff suppressed because one or more lines are too long