Pivoting is overriding the order of the data received from server
What version of React-Table are you using? 6.8.1
Your bug may already be fixed in the latest release. Run yarn upgrade react-table!
Place your version here... 6.8.1
What bug are you experiencing, or what feature are you proposing?
I am using react-table version: 6.8.0, When I am pivoting a column, react table is overriding the order of the data received from the server and it happens on some of the instance only, it works great for some data and it doesn't on some.
if I remove prop pivoted by then it works just fine for all the data sets.
below how my table looks like:
<ReactTable
data={productData}
columns={columns(this)}
defaultPageSize={DEFAULT_PAGE_SIZE}
pageSizeOptions={PAGE_SIZE_OPTIONS}
className="-striped -highlight"
pivotBy={["id"]}
sortable={true}
filterable
manual
onFetchData={this.getProductList}
pages={pages}
loading={loading}
noDataText={productError || (loading ? "" : "Sorry there are no results matching your criteria")}
loadingText={<LoadingSpinner/>}
PaginationComponent={ReactTablePagination}
showPaginationTop={true}
showPaginationBottom={true}
showPageJump={false}
sorted={tableState.sorted}
page={tableState.page}
pageSize={tableState.pageSize}
expanded={tableState.expanded}
resized={tableState.resized}
filtered={tableState.filtered}
onSortedChange={sortedChanged}
onPageChange={pageChanged}
onPageSizeChange={pageSizeChanged}
onExpandedChange={expandedChanged}
onResizedChange={resizedChanged}
onFilteredChange={filteredChanged} />
NOTE: The pivotBy mechanism DOES change the sort order of the data so it can perform the grouping - there's not really much you can do about that.
However, I am not sure why you are pivoting by id (assuming that id is the Primary Key of your data).
Closing due to issue age. If this issue was a question, please ask it again on https://spectrum.chat/react-table. If you think this issue needs to be reopened or if it should be turned into a pull-request, please check the latest version of React-Table for the issue or feature once more and reopen or create a PR if appropriate. Thanks!