correction de la recup du localstorage, avec la nouvelle orgainisation du filtrage
This commit is contained in:
parent
445ef37c51
commit
07e0af8704
2 changed files with 38 additions and 31 deletions
|
@ -303,7 +303,7 @@ let monTableau = {
|
||||||
header: this.header,
|
header: this.header,
|
||||||
crayons: this.crayons,
|
crayons: this.crayons,
|
||||||
classes: this.classes,
|
classes: this.classes,
|
||||||
filtreCol: this.filtreCol,
|
filtreCol: this.filtreColType,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
...this.table,
|
...this.table,
|
||||||
|
@ -360,21 +360,22 @@ let monTableau = {
|
||||||
if (config.classes !== undefined) {
|
if (config.classes !== undefined) {
|
||||||
this.classes = config.classes;
|
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;
|
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) {
|
if (data.length && data[0].search) {
|
||||||
this.champ_search = 'search';
|
this.champ_search = 'search';
|
||||||
}
|
}
|
||||||
|
|
|
@ -345,7 +345,7 @@ var monTableau = {
|
||||||
header: this.header,
|
header: this.header,
|
||||||
crayons: this.crayons,
|
crayons: this.crayons,
|
||||||
classes: this.classes,
|
classes: this.classes,
|
||||||
filtreCol: this.filtreCol
|
filtreCol: this.filtreColType
|
||||||
}].concat(_toConsumableArray(this.table));
|
}].concat(_toConsumableArray(this.table));
|
||||||
localStorage.setItem(this.nameLocalStorage, JSON.stringify($table));
|
localStorage.setItem(this.nameLocalStorage, JSON.stringify($table));
|
||||||
},
|
},
|
||||||
|
@ -411,24 +411,30 @@ var monTableau = {
|
||||||
|
|
||||||
if (config.classes !== undefined) {
|
if (config.classes !== undefined) {
|
||||||
this.classes = config.classes;
|
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;
|
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) {
|
if (data.length && data[0].search) {
|
||||||
this.champ_search = 'search';
|
this.champ_search = 'search';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue