fix(sort.js): 修复使用排序功能时,更新数据不生效bug

This commit is contained in:
huyueb 2017-12-28 10:29:01 +08:00
parent 247d0b862c
commit b63541c144
1 changed files with 9 additions and 0 deletions

View File

@ -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) {