Skip to content

Commit

Permalink
🐛 (Table): fix scrollToFirstRow
Browse files Browse the repository at this point in the history
fix table does not automatically scroll to the top when change page size
close ant-design#19464
  • Loading branch information
MrHeer committed Oct 28, 2019
1 parent ff382ab commit bdacbe4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions components/table/Table.tsx
Expand Up @@ -807,7 +807,7 @@ class Table<T> extends React.Component<InternalTableProps<T>, TableState<T>> {
current: this.state.pagination.current,
};
}
this.setState(newState, () => this.scrollToFirstRow());
this.setState(newState, this.scrollToFirstRow);

this.props.store.setState({
selectionDirty: false,
Expand All @@ -834,7 +834,7 @@ class Table<T> extends React.Component<InternalTableProps<T>, TableState<T>> {
pageSize,
current,
};
this.setState({ pagination: nextPagination });
this.setState({ pagination: nextPagination }, this.scrollToFirstRow);

const { onChange } = this.props;
if (onChange) {
Expand Down Expand Up @@ -878,7 +878,7 @@ class Table<T> extends React.Component<InternalTableProps<T>, TableState<T>> {

// Controlled
if (this.getSortOrderColumns().length === 0) {
this.setState(newState, () => this.scrollToFirstRow());
this.setState(newState, this.scrollToFirstRow);
}

const { onChange } = this.props;
Expand Down

0 comments on commit bdacbe4

Please sign in to comment.