Why won't ReactTable persist the sort method?

时间:2018-09-18 20:23:49

标签: reactjs react-table dexie

I've been using ReactTable for a while and it suits my needs very well. However, recently I've needed to move data to IndexedDB to support offline mode. I'm using Dexie to pull a page of data from IndexedDB at a time, and update the state with that data. The problem I've run into is the table doesn't seem to "persist" the current state of sorting. I get the initial sort values in my getPagedData method, and I sort the data as needed. Then I return the data and the table displays it as expected. However, the header cell doesn't show the visual sorting indicator (grey bar), and if I click it, the sorted property will have the same settings. If I use static data instead of Dexie, it works as expected. Can anyone explain what's going on? Am I somehow using the asynchronous call incorrectly?

Here's a CodeSandbox app demonstrating the issue:

https://codesandbox.io/s/l393x768oz

0 个答案:

没有答案