Production: al filtrar persiste el orden

This commit is contained in:
Daniel Herrero 2017-11-28 09:24:59 +01:00
parent 09d788faaa
commit 005c8072b9
1 changed files with 6 additions and 3 deletions

View File

@ -13,6 +13,8 @@ export class ProductionTable {
},
model: []
};
this.filteredField = null;
this.filteredReverse = null;
}
get checkAll() {
return this._checkAll;
@ -21,7 +23,7 @@ export class ProductionTable {
this._checkAll = value;
}
set tickets(value) {
this._tickets = value;
this._tickets = this.filteredField ? this.$filter('orderBy')(value, this.filteredField, this.filteredReverse) : value;
this.totalFilter = this._tickets.length;
this.pageTable.filter.page = 1;
this.pageTickets();
@ -30,8 +32,9 @@ export class ProductionTable {
return this._tickets;
}
onOrder(field, order) {
let reverse = order === 'DESC';
this.tickets = this.$filter('orderBy')(this.tickets, field, reverse);
this.filteredField = field;
this.filteredReverse = order === 'DESC';
this.tickets = this.tickets; // call tickets setter
}
pageTickets() {
let init = (this.pageTable.filter.page - 1) * this.itemsDisplayedInList;