I want to handle server-side sorting, filtering, and pagination separately in my antd table. So whenever pagination is changed it should not call the sorting and filtering function. similarly for both for sorting and filtering. In the antd documentation for Table, they have used onChange prop which will be called whenever sorting, filtering or pagination is changed. https://ant.design/components/table/#components-table-demo-ajax
To handle pagination alone I've used Pagination's onChange prop. But here when pagination is changed it's calling sorting and filtering function and also when sorting and filtering is changed it calls the pagination function.
I'm not sure how to achieve this functionality. Can anyone please help me with this.
Example antd code for the table
const handlePagination = page => {
//This should be called only when pagination changes
dispatch(PaginateData(page));
};
const handleSortFilter= params=> {
//This should be called only when pagination or sorting is called.
dispatch(SortFilterData(params));
};
<Table
rowSelection={rowSelection}
onChange={handleSortFilter}
rowKey={record => record.id}
columns={columns}
dataSource={data}
loading={tableActionInProgress}
pagination={{
onChange: handlePagination,
pageSize: dataPerPage,
total: CountData
}}
/>
Update In the the antd table documentation for ajax requests (https://ant.design/components/table/#components-table-demo-ajax) I could see that whenever we change sort or filter it changes the page back to 1. Is there anything I need to change in the code so that whenever filter or sorting is changed it should not set the page parameter to 1.
Why I need to perform this is because when the user changes the filter or sorting in a specific page it should not take him back to the first page instead if I get in which page (page number) the user tried to filter or sort, so that I can send the page number in the request and filter/sort accordingly to the page in the backend and send the response back. Is there any option not to set the page back to 1 if sorting or filtering is applied on the antd table.