fix pagination change bug in Table

This commit is contained in:
afc163 2016-06-12 18:12:23 +08:00
parent a69b7b70a1
commit 9961605c5a

View File

@ -101,9 +101,15 @@ export default class Table extends React.Component {
componentWillReceiveProps(nextProps) {
if (('pagination' in nextProps) && nextProps.pagination !== false) {
this.setState(previousState => ({
pagination: { ...defaultPagination, ...previousState.pagination, ...nextProps.pagination },
}));
this.setState(previousState => {
const newPagination = {
...defaultPagination,
...previousState.pagination,
...nextProps.pagination,
};
newPagination.current = newPagination.current || 1;
return { pagination: newPagination };
});
}
// dataSource
if ('dataSource' in nextProps &&