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);
|
sessionStorage.setItem('nbItems', this.parPage);
|
||||||
},
|
},
|
||||||
table() {
|
table() {
|
||||||
|
this.saveHeader();
|
||||||
let $table = [];
|
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;
|
$table = this.table;
|
||||||
localforage.setItem(this.nameLocalStorage, JSON.stringify($table));
|
localforage.setItem(this.nameLocalStorage, JSON.stringify($table));
|
||||||
},
|
},
|
||||||
|
@ -421,6 +413,19 @@ let monTableau = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
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) {
|
hanldeSearchInput(event, head) {
|
||||||
this.searchInputHead = head;
|
this.searchInputHead = head;
|
||||||
this.searchInputVal = event.target.value;
|
this.searchInputVal = event.target.value;
|
||||||
|
@ -637,6 +642,8 @@ let monTableau = {
|
||||||
this.triOrders.push(sens);
|
this.triOrders.push(sens);
|
||||||
}
|
}
|
||||||
this.table = orderBy(this.table, this.triProps, this.triOrders, this.champ_search);
|
this.table = orderBy(this.table, this.triProps, this.triOrders, this.champ_search);
|
||||||
|
this.ordreCol[col] = sens;
|
||||||
|
this.saveHeader();
|
||||||
},
|
},
|
||||||
ordreActif(col, sens) {
|
ordreActif(col, sens) {
|
||||||
const i = this.triProps.indexOf(col);
|
const i = this.triProps.indexOf(col);
|
||||||
|
@ -650,6 +657,7 @@ let monTableau = {
|
||||||
this.table = orderBy(this.table, ['id'], '', this.champ_search);
|
this.table = orderBy(this.table, ['id'], '', this.champ_search);
|
||||||
this.triOrders = [];
|
this.triOrders = [];
|
||||||
this.triProps = [];
|
this.triProps = [];
|
||||||
|
this.ordreCol = [];
|
||||||
},
|
},
|
||||||
selectLigne(id, col) {
|
selectLigne(id, col) {
|
||||||
if (col === 'id' && parseInt(id)) {
|
if (col === 'id' && parseInt(id)) {
|
||||||
|
|
|
@ -418,15 +418,8 @@ var monTableau = {
|
||||||
sessionStorage.setItem('nbItems', this.parPage);
|
sessionStorage.setItem('nbItems', this.parPage);
|
||||||
},
|
},
|
||||||
table: function table() {
|
table: function table() {
|
||||||
|
this.saveHeader();
|
||||||
var $table = [];
|
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;
|
$table = this.table;
|
||||||
localforage.setItem(this.nameLocalStorage, JSON.stringify($table));
|
localforage.setItem(this.nameLocalStorage, JSON.stringify($table));
|
||||||
},
|
},
|
||||||
|
@ -484,6 +477,21 @@ var monTableau = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
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) {
|
hanldeSearchInput: function hanldeSearchInput(event, head) {
|
||||||
this.searchInputHead = head;
|
this.searchInputHead = head;
|
||||||
this.searchInputVal = event.target.value;
|
this.searchInputVal = event.target.value;
|
||||||
|
@ -740,6 +748,8 @@ var monTableau = {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.table = orderBy(this.table, this.triProps, this.triOrders, this.champ_search);
|
this.table = orderBy(this.table, this.triProps, this.triOrders, this.champ_search);
|
||||||
|
this.ordreCol[col] = sens;
|
||||||
|
this.saveHeader();
|
||||||
},
|
},
|
||||||
ordreActif: function ordreActif(col, sens) {
|
ordreActif: function ordreActif(col, sens) {
|
||||||
var i = this.triProps.indexOf(col);
|
var i = this.triProps.indexOf(col);
|
||||||
|
@ -754,6 +764,7 @@ var monTableau = {
|
||||||
this.table = orderBy(this.table, ['id'], '', this.champ_search);
|
this.table = orderBy(this.table, ['id'], '', this.champ_search);
|
||||||
this.triOrders = [];
|
this.triOrders = [];
|
||||||
this.triProps = [];
|
this.triProps = [];
|
||||||
|
this.ordreCol = [];
|
||||||
},
|
},
|
||||||
selectLigne: function selectLigne(id, col) {
|
selectLigne: function selectLigne(id, col) {
|
||||||
if (col === 'id' && parseInt(id)) {
|
if (col === 'id' && parseInt(id)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue