Skip to content

Commit

Permalink
correct default sort direction - fixes #139
Browse files Browse the repository at this point in the history
  • Loading branch information
uap-universe committed Oct 23, 2023
1 parent c43a639 commit d1cce09
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This document lists the changes introduced by this fork.
## Version 3.1.0

* The `strict` setting for `list` default filters is no longer overriding a custom provided filter function
* Fix that the default sort direction for all columns is `asc` instead of "no sort"

## Version 3.0.0

Expand Down
1 change: 1 addition & 0 deletions projects/angular2-smart-table/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This document lists the changes introduced by this fork.
## Version 3.1.0

* The `strict` setting for `list` default filters is no longer overriding a custom provided filter function
* Fix that the default sort direction for all columns is `asc` instead of "no sort"

## Version 3.0.0

Expand Down
4 changes: 1 addition & 3 deletions projects/angular2-smart-table/src/lib/lib/data-set/column.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export class Column {
isEditable: boolean;
isAddable: boolean;
isFilterable?: boolean = false;
sortDirection: ISortDirection;
defaultSortDirection: ISortDirection;
editor: EditorSettings;
filter: FilterSettings;
Expand Down Expand Up @@ -66,8 +65,7 @@ export class Column {
this.isEditable = this.settings.isEditable ?? true;
this.isAddable = this.settings.isAddable ?? true;

this.defaultSortDirection = this.settings.sortDirection ?? 'asc';
this.sortDirection = this.defaultSortDirection;
this.defaultSortDirection = this.settings.sortDirection ?? null;

this.compareFunction = this.settings.compareFunction;
this.valuePrepareFunction = this.settings.valuePrepareFunction;
Expand Down
2 changes: 1 addition & 1 deletion projects/angular2-smart-table/src/lib/lib/grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ export class Grid {

getInitialSort(): ISortConfig | null {
for (const column of this.getColumns()) {
if (column.isSortable && column.defaultSortDirection) {
if (column.isSortable && column.defaultSortDirection !== null) {
return {
field: column.id,
direction: column.defaultSortDirection,
Expand Down

0 comments on commit d1cce09

Please sign in to comment.