Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

Sort by fixes #225

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/reactable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1181,9 +1181,9 @@ window.ReactDOM["default"] = window.ReactDOM;
}, {
key: 'updateCurrentSort',
value: function updateCurrentSort(sortBy) {
if (sortBy !== false && sortBy.column !== this.state.currentSort.column && sortBy.direction !== this.state.currentSort.direction) {
if (sortBy !== false && (sortBy.column !== this.state.currentSort.column || sortBy.direction !== this.state.currentSort.direction)) {

this.setState({ currentSort: this.getCurrentSort(sortBy) });
this.state.currentSort = this.getCurrentSort(sortBy);
}
}
}, {
Expand Down
4 changes: 2 additions & 2 deletions lib/reactable/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ var Table = (function (_React$Component) {
}, {
key: 'updateCurrentSort',
value: function updateCurrentSort(sortBy) {
if (sortBy !== false && sortBy.column !== this.state.currentSort.column && sortBy.direction !== this.state.currentSort.direction) {
if (sortBy !== false && (sortBy.column !== this.state.currentSort.column || sortBy.direction !== this.state.currentSort.direction)) {

this.setState({ currentSort: this.getCurrentSort(sortBy) });
this.state.currentSort = this.getCurrentSort(sortBy);
}
}
}, {
Expand Down
6 changes: 3 additions & 3 deletions src/reactable/table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ export class Table extends React.Component {

updateCurrentSort(sortBy) {
if (sortBy !== false &&
sortBy.column !== this.state.currentSort.column &&
sortBy.direction !== this.state.currentSort.direction) {
(sortBy.column !== this.state.currentSort.column ||
sortBy.direction !== this.state.currentSort.direction)) {

this.setState({ currentSort: this.getCurrentSort(sortBy) });
this.state.currentSort = this.getCurrentSort(sortBy)
}
}

Expand Down