Go to next row in table that is filtered and sorted?

I have a table with an action button that opens a modal so the user can dive deeper into a selected row. Lets say we have rows 1,2,3,4. Currently if the user is inside row 1 and wants to go to row 2, they have to exit the modal and then select row 2. I would like to put a "Next" button in the modal that just changes out the modal's data to row2.

I can do this if the user doesn't sort the original table by just adding 1 to the table.displayedData.index. BUT the displayedData doesn't sort when the user sorts a column in the table. So if the user sorted the table to be rows 4,3,2,1 the displayedData still shows rows 1,2,3,4

Is there a simple way to get what index the next visible row in the table is?

Hey @szabon

Sorry for such a late reply here!

Not sure if this is something you're still looking into. We do have a ticket open relative to this issue but there's no timeline for it yet. In the meantime, I can offer a workaround where you create a temporary state that holds the sorted indices of your table and navigate that way. I've included some screenshots below, let me know if they help!


sorted_table_navigation.json