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

344
Views
React-Bootstrap Table with dynamic Content - Form over Radio Buttons in Rows not working

In my React App I request data from an API and store it in state:

const [entities, setEntities] = useState([]);

in my useEffect hook I get the Data from the API - basicly I have the following example array as my entities:

 ["@Organization", "@City", "@Immobilie", "@Currency", "@Test"]

Now I want to display all entities in a table and have a radio button in each row to select ONE entity.
I'm using React-Bootstrap to build the Table

<Table striped bordered style={{ color: "#4d4d4d" }}>
                                <thead>
                                    <tr>
                                        <th>Entities</th>
                                    </tr>
                                </thead>
                                <tbody>                                        
                                    {entities.map(entity => <tr key={entity} style={{ color: "#4d4d4d" }}>
                                        <td>
                                            <Row>
                                                <Col>
                                                <Form.Check 
                                                    type="radio"
                                                    label={entity}/>                                                        
                                                </Col>
                                            </Row>
                                        </td>
                                    </tr>)}
                                </tbody>
                            </Table>

In the <tbody> I map every entry of the entities array to a Table Element. But Now I can click the Radio Button in each tablerow, without deselecting the others.
I tried to wrap a <Form> element around the Table, but nothing changes.
If I wrap the <Form> around the <tbody> the <tbody> doesnt get populated with tablerows.
When I put the <Form> inside the <Table> element the whole table doesn't render anymore.

How can I group the radio Buttons so only one is selectable in this dynamicly build table?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Thanks to The KNVBs comment I added a name attribute to my Form.Check element

<Form.Check 
  type="radio"
  name="entitySelection"                                                        
  label={entity} />

Now only one tablerow-radio Button is selectable

about 4 years ago · Juan Pablo Isaza 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!