vnTable toggle order only on active field

This commit is contained in:
Joan Sanchez 2018-06-29 08:41:53 +02:00
parent 9527b839df
commit 6450aa8f34
1 changed files with 7 additions and 2 deletions

View File

@ -2,6 +2,7 @@ import ngModule from '../../module';
export default class Th {
constructor($element) {
this._order = 'ASC';
this.column = $element[0];
}
@ -19,7 +20,6 @@ export default class Th {
set order(order) {
this._order = order;
this.table.setOrder(this.field, order);
}
@ -49,7 +49,12 @@ export default class Th {
onToggleOrder() {
if (!this.field) return;
this.toggleOrder();
if (this.table.field == this.field) {
this.toggleOrder();
} else {
this.table.setOrder(this.field, this.order);
}
this.updateArrow();
this.table.applyFilter(this.field, this.order);