Skip to content

Commit

Permalink
a workaround for fix same field cell sorting #372
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Mar 30, 2016
1 parent f2e629c commit 16d8488
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/TableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ class TableHeader extends Component {
const { sortIndicator, children, sortName, sortOrder, onSort } = this.props;
if (Array.isArray(children)) {
for (let i = 0; i < children.length; i++) {
const field = children[i].props.dataField;
const sort = field === sortName ? sortOrder : undefined;
const { dataField, dataSort } = children[i].props;
const sort = (dataSort && dataField === sortName) ? sortOrder : undefined;
this.props.children[i] =
React.cloneElement(children[i],
{ key: i, onSort, sort, sortIndicator });
}
} else {
const field = children.props.dataField;
const sort = field === sortName ? sortOrder : undefined;
const { dataField, dataSort } = children.props;
const sort = (dataSort && dataField === sortName) ? sortOrder : undefined;
this.props.children =
React.cloneElement(children,
{ key: 0, onSort, sort, sortIndicator });
Expand Down

0 comments on commit 16d8488

Please sign in to comment.