Skip to content

Commit

Permalink
fix #1227
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Apr 24, 2017
1 parent aacb293 commit fec241d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/TableHeaderColumn.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ class TableHeaderColumn extends Component {

handleColumnClick = () => {
if (this.props.isOnlyHead || !this.props.dataSort) return;
const order = this.props.sort === Const.SORT_DESC ? Const.SORT_ASC : Const.SORT_DESC;
let { sort: order } = this.props;
if (!order && this.props.defaultASC) order = Const.SORT_ASC;
else order = this.props.sort === Const.SORT_DESC ? Const.SORT_ASC : Const.SORT_DESC;
this.props.onSort(order, this.props.dataField);
}

Expand Down Expand Up @@ -270,7 +272,8 @@ TableHeaderColumn.propTypes = {
tdAttr: PropTypes.object,
tdStyle: PropTypes.object,
thStyle: PropTypes.object,
keyValidator: PropTypes.bool
keyValidator: PropTypes.bool,
defaultASC: PropTypes.bool
};

TableHeaderColumn.defaultProps = {
Expand Down Expand Up @@ -305,7 +308,8 @@ TableHeaderColumn.defaultProps = {
tdAttr: undefined,
tdStyle: undefined,
thStyle: undefined,
keyValidator: false
keyValidator: false,
defaultASC: false
};

export default TableHeaderColumn;

0 comments on commit fec241d

Please sign in to comment.