Closed andy-yu-y closed 1 year ago
Found one history issue related to this: https://github.com/jbetancur/react-data-table-component/pull/590
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
issue still there
defaultSortAsc and defaultSortFieldId work differently as paginationDefaultPage. when path is changed, i use use-effect to refetch the table data, but defaultSortAsc and defaultSortFieldId wont changed under this condition, in the meanwhile paginationDefaultPage works fine.
I think there is bug about this, defaultSortAsc and defaultSortFieldId only works when user refresh the page. For paginationDefaultPage, it take effect when table data fetched everytime. Below is the code for your reference: <DataTable title={title} theme={window.THEME.palette.type} ........... paginationDefaultPage={pageRef.current} paginationPerPage={pageSizeRef.current} paginationRowsPerPageOptions={rowsPerPage} paginationComponentOptions={{ rowsPerPageText: 'Shows per page:', rangeSeparatorText: 'out of', }} ......... sortServer onSort={handleSort} defaultSortAsc={sortIndicatorRef.current} defaultSortField={sortByRef.current} sortIcon={ }
/>