petite amelioration sur le tri
This commit is contained in:
parent
c51cc5463e
commit
4d9d56e255
2 changed files with 36 additions and 17 deletions
|
@ -369,16 +369,8 @@ let monTableau = {
|
|||
sessionStorage.setItem('nbItems', this.parPage);
|
||||
},
|
||||
table() {
|
||||
this.saveHeader();
|
||||
let $table = [];
|
||||
let $header = {
|
||||
header: this.header,
|
||||
crayons: this.crayons,
|
||||
classes: this.classes,
|
||||
filtreCol: this.filtreColType,
|
||||
ordreCol: this.ordreCol,
|
||||
};
|
||||
localStorage.setItem('header_' + this.nameLocalStorage, JSON.stringify($header));
|
||||
|
||||
$table = this.table;
|
||||
localforage.setItem(this.nameLocalStorage, JSON.stringify($table));
|
||||
},
|
||||
|
@ -421,6 +413,19 @@ let monTableau = {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
saveHeader() {
|
||||
let $header = {
|
||||
header: this.header,
|
||||
crayons: this.crayons,
|
||||
classes: this.classes,
|
||||
filtreCol: this.filtreColType,
|
||||
ordreCol: this.ordreCol,
|
||||
};
|
||||
if (!localStorage.getItem('header_' + this.nameLocalStorage)) {
|
||||
localStorage.setItem('headerJson_' + this.nameLocalStorage, JSON.stringify($header));
|
||||
}
|
||||
localStorage.setItem('header_' + this.nameLocalStorage, JSON.stringify($header));
|
||||
},
|
||||
hanldeSearchInput(event, head) {
|
||||
this.searchInputHead = head;
|
||||
this.searchInputVal = event.target.value;
|
||||
|
@ -637,6 +642,8 @@ let monTableau = {
|
|||
this.triOrders.push(sens);
|
||||
}
|
||||
this.table = orderBy(this.table, this.triProps, this.triOrders, this.champ_search);
|
||||
this.ordreCol[col] = sens;
|
||||
this.saveHeader();
|
||||
},
|
||||
ordreActif(col, sens) {
|
||||
const i = this.triProps.indexOf(col);
|
||||
|
@ -650,6 +657,7 @@ let monTableau = {
|
|||
this.table = orderBy(this.table, ['id'], '', this.champ_search);
|
||||
this.triOrders = [];
|
||||
this.triProps = [];
|
||||
this.ordreCol = [];
|
||||
},
|
||||
selectLigne(id, col) {
|
||||
if (col === 'id' && parseInt(id)) {
|
||||
|
|
|
@ -418,15 +418,8 @@ var monTableau = {
|
|||
sessionStorage.setItem('nbItems', this.parPage);
|
||||
},
|
||||
table: function table() {
|
||||
this.saveHeader();
|
||||
var $table = [];
|
||||
var $header = {
|
||||
header: this.header,
|
||||
crayons: this.crayons,
|
||||
classes: this.classes,
|
||||
filtreCol: this.filtreColType,
|
||||
ordreCol: this.ordreCol
|
||||
};
|
||||
localStorage.setItem('header_' + this.nameLocalStorage, JSON.stringify($header));
|
||||
$table = this.table;
|
||||
localforage.setItem(this.nameLocalStorage, JSON.stringify($table));
|
||||
},
|
||||
|
@ -484,6 +477,21 @@ var monTableau = {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
saveHeader: function saveHeader() {
|
||||
var $header = {
|
||||
header: this.header,
|
||||
crayons: this.crayons,
|
||||
classes: this.classes,
|
||||
filtreCol: this.filtreColType,
|
||||
ordreCol: this.ordreCol
|
||||
};
|
||||
|
||||
if (!localStorage.getItem('header_' + this.nameLocalStorage)) {
|
||||
localStorage.setItem('headerJson_' + this.nameLocalStorage, JSON.stringify($header));
|
||||
}
|
||||
|
||||
localStorage.setItem('header_' + this.nameLocalStorage, JSON.stringify($header));
|
||||
},
|
||||
hanldeSearchInput: function hanldeSearchInput(event, head) {
|
||||
this.searchInputHead = head;
|
||||
this.searchInputVal = event.target.value;
|
||||
|
@ -740,6 +748,8 @@ var monTableau = {
|
|||
}
|
||||
|
||||
this.table = orderBy(this.table, this.triProps, this.triOrders, this.champ_search);
|
||||
this.ordreCol[col] = sens;
|
||||
this.saveHeader();
|
||||
},
|
||||
ordreActif: function ordreActif(col, sens) {
|
||||
var i = this.triProps.indexOf(col);
|
||||
|
@ -754,6 +764,7 @@ var monTableau = {
|
|||
this.table = orderBy(this.table, ['id'], '', this.champ_search);
|
||||
this.triOrders = [];
|
||||
this.triProps = [];
|
||||
this.ordreCol = [];
|
||||
},
|
||||
selectLigne: function selectLigne(id, col) {
|
||||
if (col === 'id' && parseInt(id)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue