fix(sort.js): 修复使用排序功能时,更新数据不生效bug
This commit is contained in:
parent
247d0b862c
commit
b63541c144
|
@ -14,6 +14,15 @@ export default function sort(Table) {
|
||||||
data: this.props.data
|
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) => {
|
toggleSortOrder = (order, column) => {
|
||||||
let { sortOrder, data, oldData } = this.state;
|
let { sortOrder, data, oldData } = this.state;
|
||||||
let ascend_sort = function(key) {
|
let ascend_sort = function(key) {
|
||||||
|
|
Loading…
Reference in New Issue