Skip to content

Commit

Permalink
fix(module:table): fix the missing of init table sort class (#781)
Browse files Browse the repository at this point in the history
close #771
  • Loading branch information
vthinkxie authored Dec 18, 2017
1 parent 12059ef commit b828025
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/components/table/nz-table-sort.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
EventEmitter,
Host,
Input,
OnInit,
Optional,
Output,
Renderer2,
Expand Down Expand Up @@ -39,24 +38,20 @@ export class NzTableSortComponent {

set nzValue(value: string) {
this._value = value;
if ((this._value !== 'ascend') && (this._value !== 'descend')) {
if (this.nzThDirective) {
if (this.nzThDirective) {
if ((this._value !== 'ascend') && (this._value !== 'descend')) {
this._renderer.removeClass(this.nzThDirective._el, 'ant-table-column-sort');
} else {
this._renderer.addClass(this.nzThDirective._el, 'ant-table-column-sort');
}
}
}

_setValue(value: string): void {
if (this.nzValue === value) {
this.nzValue = null;
if (this.nzThDirective) {
this._renderer.removeClass(this.nzThDirective._el, 'ant-table-column-sort');
}
} else {
this.nzValue = value;
if (this.nzThDirective) {
this._renderer.addClass(this.nzThDirective._el, 'ant-table-column-sort');
}
}
this.nzValueChange.emit(this.nzValue);
}
Expand Down

0 comments on commit b828025

Please sign in to comment.