2

I have bootstrap datatable and i am dynamically binding values using thymeleaf. since one of my column is radio button. How do i ensure that only one row or one radio button selected when user submits the form. currently its allowing user to select multiple radio buttons/rows at same time. Is there any such this option readily available in bootstrap datatable itself. I am using datatables-1.10.9

<table id="testTable" class="table table-striped table-bordered">
    <thead>
    <tr>
        <th scope="col">Select</th>
        <th scope="col">BookingId</th>
        <th scope="col">Source</th>
        <th scope="col">Destination</th>
        <th scope="col">Trip Start Date</th>
        <th scope="col">Status</th>
    </tr>
    </thead>
    <tbody>
    <tr data-th-each="booking : ${mybookings}">
        <td><input typr="radio" th:value="${booking.id}"></input></td>
        <td data-th-text="${booking.source}"></td>
        <td data-th-text="${booking.destination}"></td>
        <td data-th-text="${booking.tripStartTime}"></td>
        <td data-th-text="${booking.statusMaster.statusName}"></td>
    </tr>
    </tbody>
</table>
Mahozad
  • 18,032
  • 13
  • 118
  • 133
Shravan Ramamurthy
  • 3,896
  • 5
  • 30
  • 44

1 Answers1

1

This has been answered in another post where they add a name attribute to the radio button so only one button is selected for each group of buttons:

[how to set that only one radio button can be checked

Community
  • 1
  • 1
Sathya
  • 41
  • 3