diff --git a/components/table/Table.tsx b/components/table/Table.tsx index 3619a4d532..d230c83d81 100755 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -868,7 +868,6 @@ class Table extends React.Component, TableState> { }; toggleSortOrder(column: ColumnProps) { - 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 extends React.Component, TableState> { 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, }; diff --git a/components/table/__tests__/Table.sorter.test.js b/components/table/__tests__/Table.sorter.test.js index b8fe7d5146..d3c01d20e5 100644 --- a/components/table/__tests__/Table.sorter.test.js +++ b/components/table/__tests__/Table.sorter.test.js @@ -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', () => {