ajout de la gestion des col en checkbox
This commit is contained in:
parent
bec9d27f7e
commit
fdf26db329
3 changed files with 92 additions and 3 deletions
|
@ -238,6 +238,8 @@ let monTableau = {
|
|||
header: [],
|
||||
crayons: [],
|
||||
classes: [],
|
||||
checkbox: [],
|
||||
Tcheckbox: [],
|
||||
ordreCol: [],
|
||||
filtreCol: [],
|
||||
filtreColExist: false,
|
||||
|
@ -482,6 +484,12 @@ let monTableau = {
|
|||
if (config.classes !== undefined) {
|
||||
this.classes = config.classes;
|
||||
}
|
||||
if (config.checkbox !== undefined) {
|
||||
this.checkbox = config.checkbox;
|
||||
Object.keys(this.checkbox).forEach((head) => {
|
||||
this.Tcheckbox[head] = [];
|
||||
});
|
||||
}
|
||||
if (config.ordreCol !== undefined) {
|
||||
this.ordreCol = config.ordreCol;
|
||||
}
|
||||
|
@ -541,6 +549,12 @@ let monTableau = {
|
|||
} else {
|
||||
this.classes = [];
|
||||
}
|
||||
if (config.checkbox !== undefined) {
|
||||
this.checkbox = config.checkbox;
|
||||
Object.keys(this.checkbox).forEach((head) => {
|
||||
this.Tcheckbox[head] = [];
|
||||
});
|
||||
}
|
||||
if (config.ordreCol !== undefined) {
|
||||
this.ordreCol = config.ordreCol;
|
||||
} else {
|
||||
|
@ -781,6 +795,27 @@ let monTableau = {
|
|||
return 0;
|
||||
}
|
||||
},
|
||||
validerCheckboxCol(head) {
|
||||
let tableau = this.tableau;
|
||||
if (this.Tcheckbox[head] !== undefined && this.Tcheckbox[head].length) {
|
||||
this.Tcheckbox[head] = [];
|
||||
} else {
|
||||
this.Tcheckbox[head] = [];
|
||||
tableau.forEach((d) => {
|
||||
this.Tcheckbox[head].push(d.html.id);
|
||||
});
|
||||
}
|
||||
},
|
||||
checkboxValider(head, url) {
|
||||
let that = this;
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: { data: this.Tcheckbox[head] },
|
||||
type: 'POST',
|
||||
}).done(function () {
|
||||
that.chargerJson();
|
||||
});
|
||||
},
|
||||
},
|
||||
template: `
|
||||
<div class="gamutable">
|
||||
|
@ -877,6 +912,10 @@ let monTableau = {
|
|||
</tr>
|
||||
<tr v-if="filtreCol.length" class="filtreColonne">
|
||||
<th v-for="(label,head,i) in header" :key="'filtreCol_'+i">
|
||||
<div v-if="checkbox[head] !== undefined" :id="'filtreCol_'+head" :class="classes[head]">
|
||||
<input type="checkbox" @click.stop="validerCheckboxCol(head)" >
|
||||
<button @click.stop="checkboxValider(head, checkbox[head])">Valider</button>
|
||||
</div>
|
||||
<div v-if="filtreCol.indexOf(head) !== -1" :id="'filtreCol_'+head" :class="classes[head]">
|
||||
<vue-select
|
||||
v-if="filtreColType[head] === 'select'"
|
||||
|
@ -922,7 +961,15 @@ let monTableau = {
|
|||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="l in tableau" :key="l.html.id" :class="selectTr.indexOf(l.html.id) !== -1 ? 'select' : ''" >
|
||||
<td v-for="(td,name, i) in l.html" :key="'td_'+i" :class="[afficher_crayons(name,l.html.id), name, classes[name], l.classes !== undefined ? l.classes[name] : '']" v-html="td" @click="selectLigne(l.html.id,name)">
|
||||
<td v-for="(td,name, i) in l.html" :key="'td_'+i" :class="[afficher_crayons(name,l.html.id), name, classes[name], l.classes !== undefined ? l.classes[name] : '']" @click="selectLigne(l.html.id,name)">
|
||||
<div v-if="checkbox[name] !== undefined">
|
||||
<label v-if="td.split('-')[0] === 'dataid'">
|
||||
<input type='checkbox' v-model='Tcheckbox[name]' :value="td.split('-')[1]">
|
||||
</label>
|
||||
<div v-else v-html="td"></div>
|
||||
</div>
|
||||
<div v-else v-html="td"></div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,7 @@
|
|||
<paquet
|
||||
prefix="gamutable"
|
||||
categorie="outil"
|
||||
version="3.7.2"
|
||||
version="3.7.3"
|
||||
etat="dev"
|
||||
compatibilite="[3.2.0-dev;4.1.*]"
|
||||
logo="prive/themes/spip/images/gamutable-xx.svg"
|
||||
|
|
Loading…
Add table
Reference in a new issue