Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

116
Views
react-data-table-component - Columns which are sorted don't remain those rows if expanded with expandableRows

I'm having an issue in react-data-table-component where, after clicking on the column header to sort the rows, it fails to remain the same item getting clicked after sorting. See below. Once clicked, the row item immediately changes to another item. But I need it to remain the same item and not change to a completely new item:

Alt Text

Do you see how, after I sort the rows by clicking on the column header it correctly sorts the rows, but afterward, I click on the first row and it totally changes to another row item?

My code:

             <DataTable
                 title={ `Items` }
                 columns={ columns }
                 data={ filteredItems }
                 pagination
                 paginationResetDefaultPage={ resetPaginationToggle }
                 subHeader
                 onRowClicked={ handleRowClicked }
                 selectableRows
                 selectableRowsComponent={Checkbox} // Pass the function only
                 selectableRowsComponentProps={selectProps}
                 onSelectedRowsChange={ handleSelectedRows }
                 responsive
                 expandableRows
                 expandOnRowClicked
                 expandableRowsHideExpander
                 expandableRowsComponent={ <UpdateItemComponent data={ mainData } /> }
                 persistTableHead
             />

Perhaps it's something to do with resetPaginationToggle? I'm not sure.

How do I solve it so the row remains the same after sorting and then clicking on a row?

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!