2016-01-23 78 views
2

我有bootstrap数据表,我动态绑定值使用thymeleaf。因为我的专栏之一是单选按钮。我如何确保用户提交表单时只选择一行或一个单选按钮。目前它允许用户同时选择多个单选按钮/行。引导数据表本身是否有这样的选项? 我使用数据表-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> 

回答