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

274
Views
Expand only one table row at a time Ant Design React

I'm unable to achieve that, I have attached the code below please let me know what's wrong here?

before adding expandedRowKeys and onExpand it was expanding all tables rows but after implementing it, it doesn't even open one row

<Table
    rowkey="id"
    size="small"
    columns={groupsPackageColumns}
    dataSource={roomPackages}
    className="taglist-table"
    expandable={{
        expandedRowRender: (record) => (
            <Table
                rowKey="id"
                columns={nestedTagsColumn}
                dataSource={record.tags}
                className="ant-table-container"
            />
        ),                    
        expandedRowKeys: activeExpRow,
        onExpand: (expanded, record) => {
            const keys = [];
            if (expanded) {
               keys.push(record.id); 
            }
            setActiveExpRow(keys);
        },
    }}
                        
/>
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I am not sure about your roomPackages's data structure. But it should contain key property. and push record.keyinstead of record.id If dataSource data doesn't include key property, you will get below error. enter image description here

So, we need to modify the data as it includes key property. I made the working Codesandbox.

https://codesandbox.io/s/expandable-row-antd-4-17-4-forked-41rd3?file=/index.js

about 4 years ago · Santiago Trujillo Report
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!