Skip to content

Commit

Permalink
don't default sort by to first column (#2653)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alanna Scott authored Apr 20, 2017
1 parent 938e13a commit 84fa0d1
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default class FilterableTable extends PureComponent {
.reduce((curr, next) => curr + next);

this.state = {
sortBy: props.orderedColumnKeys[0],
sortBy: null,
sortDirection: SortDirection.ASC,
fitted: false,
};
Expand Down Expand Up @@ -142,9 +142,11 @@ export default class FilterableTable extends PureComponent {
sortedAndFilteredList = this.list.filter(row => this.hasMatch(filterText, row));
}
// sort list
sortedAndFilteredList = sortedAndFilteredList
if (sortBy) {
sortedAndFilteredList = sortedAndFilteredList
.sortBy(item => item[sortBy])
.update(list => sortDirection === SortDirection.DESC ? list.reverse() : list);
}

const rowGetter = ({ index }) => this.getDatum(sortedAndFilteredList, index);

Expand Down

0 comments on commit 84fa0d1

Please sign in to comment.