Browse Source

Fix overflow current state in Table, close #2301

pull/2452/head
afc163 8 years ago
parent
commit
4b29e40089
  1. 12
      components/table/Table.jsx

12
components/table/Table.jsx

@ -552,6 +552,14 @@ export default class Table extends React.Component {
return column.key || column.dataIndex || index;
}
getMaxCurrent(total) {
const { current, pageSize } = this.state.pagination;
if ((current - 1) * pageSize >= total) {
return current - 1;
}
return current;
}
isSortColumn(column) {
const { sortColumn } = this.state;
if (!column || !sortColumn) {
@ -648,6 +656,7 @@ export default class Table extends React.Component {
onChange={this.handlePageChange}
total={total}
size={size}
current={this.getMaxCurrent(total)}
onShowSizeChange={this.handleShowSizeChange}
/> : null;
}
@ -681,8 +690,9 @@ export default class Table extends React.Component {
current = 1;
} else {
pageSize = state.pagination.pageSize;
current = state.pagination.current;
current = this.getMaxCurrent(state.pagination.total || data.length);
}
//
// ---
//

Loading…
Cancel
Save