mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 05:05:48 +08:00
revert Table page return 1 after sort (#20507)
close #16978 close #17770 close #17648 close #18099 close #17075 close #19369
This commit is contained in:
parent
670bd4bf5b
commit
df8f34309f
@ -868,7 +868,6 @@ class Table<T> extends React.Component<InternalTableProps<T>, TableState<T>> {
|
||||
};
|
||||
|
||||
toggleSortOrder(column: ColumnProps<T>) {
|
||||
const pagination = { ...this.state.pagination };
|
||||
const sortDirections = column.sortDirections || (this.props.sortDirections as SortOrder[]);
|
||||
const { sortOrder, sortColumn } = this.state;
|
||||
// 只同时允许一列进行排序,否则会导致排序顺序的逻辑问题
|
||||
@ -883,14 +882,7 @@ class Table<T> extends React.Component<InternalTableProps<T>, TableState<T>> {
|
||||
newSortOrder = sortDirections[0];
|
||||
}
|
||||
|
||||
if (this.props.pagination) {
|
||||
// Reset current prop
|
||||
pagination.current = 1;
|
||||
pagination.onChange!(pagination.current);
|
||||
}
|
||||
|
||||
const newState = {
|
||||
pagination,
|
||||
sortOrder: newSortOrder,
|
||||
sortColumn: newSortOrder ? column : null,
|
||||
};
|
||||
|
@ -613,6 +613,7 @@ describe('Table.sorter', () => {
|
||||
createTable({
|
||||
pagination: {
|
||||
pageSize: 2,
|
||||
defaultCurrent: 2,
|
||||
onChange: onPageChange,
|
||||
},
|
||||
onChange,
|
||||
@ -620,8 +621,8 @@ describe('Table.sorter', () => {
|
||||
);
|
||||
|
||||
wrapper.find('.ant-table-column-sorters').simulate('click');
|
||||
expect(onChange.mock.calls[0][0].current).toBe(1);
|
||||
expect(onPageChange.mock.calls[0][0]).toBe(1);
|
||||
expect(onChange.mock.calls[0][0].current).toBe(2);
|
||||
expect(onPageChange).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should support onHeaderCell in sort column', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user