Skip to content

Commit

Permalink
fix(sort.js): 修复使用排序功能时,更新数据不生效bug
Browse files Browse the repository at this point in the history
  • Loading branch information
HuYuee committed Dec 28, 2017
1 parent 247d0b8 commit b63541c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib/sort.js
Expand Up @@ -14,6 +14,15 @@ export default function sort(Table) {
data: this.props.data
};
}
componentWillReceiveProps(nextProps){
if(nextProps.data !== this.props.data){
this.setState({
sortOrder: "",
data: nextProps.data,
oldData: nextProps.data.concat(),
});
}
}
toggleSortOrder = (order, column) => {
let { sortOrder, data, oldData } = this.state;
let ascend_sort = function(key) {
Expand Down

0 comments on commit b63541c

Please sign in to comment.