correction de la recup du localstorage, avec la nouvelle orgainisation du filtrage

This commit is contained in:
Christophe 2021-01-25 20:39:15 +01:00
parent 445ef37c51
commit 07e0af8704
2 changed files with 38 additions and 31 deletions

View file

@ -303,7 +303,7 @@ let monTableau = {
header: this.header,
crayons: this.crayons,
classes: this.classes,
filtreCol: this.filtreCol,
filtreCol: this.filtreColType,
},
],
...this.table,
@ -360,21 +360,22 @@ 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 (config.filtreCol !== undefined) {
this.filtreColType = config.filtreCol;
Object.keys(this.filtreColType).forEach((col) => {
let Tval = [''];
this.table.forEach((t) => {
let valCol = t.html[col];
if (Tval.indexOf(valCol) === -1) {
Tval.push(valCol);
}
});
this.filtreCol.push(col);
this.filtreColVal[col] = Tval;
this.filtreColSelected[col] = [];
});
}
if (data.length && data[0].search) {
this.champ_search = 'search';
}

View file

@ -345,7 +345,7 @@ var monTableau = {
header: this.header,
crayons: this.crayons,
classes: this.classes,
filtreCol: this.filtreCol
filtreCol: this.filtreColType
}].concat(_toConsumableArray(this.table));
localStorage.setItem(this.nameLocalStorage, JSON.stringify($table));
},
@ -411,24 +411,30 @@ var 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 (config.filtreCol !== undefined) {
this.filtreColType = config.filtreCol;
Object.keys(this.filtreColType).forEach(function (col) {
var Tval = [''];
_this4.table.forEach(function (t) {
var valCol = t.html[col];
if (Tval.indexOf(valCol) === -1) {
Tval.push(valCol);
}
});
_this4.filtreCol.push(col);
_this4.filtreColVal[col] = Tval;
_this4.filtreColSelected[col] = [];
});
}
if (data.length && data[0].search) {
this.champ_search = 'search';
}