我有一个似乎适应给定列中最长文本字符串的表。我在每一行都有选择标签,这些标签似乎弄乱了显示。表格中添加了一个额外的列,并且右侧的边框未显示。如果我缩小选择标签的大小,表格格式正确,但我希望表格符合下一列中最大选择标签和最大按钮的大小。谢谢。这是代码:
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>Position</th>
<th>Allocation</th>
<th>Action</th>
</tr>
</thead>
<% position_map = @cabinet.cabinet_position_map %>
<% @cabinet.cabinet_type.usize.downto(1) do |i| %>
<tr>
<td>Slot: <%= i %></td>
<% if position_map[i].nil? %>
<% cabinet_device_selection = @cabinet.devices_to_fit(position_map, i) %>
<% @selection_list = [ "Power", "I/O", "Interface", "Unusable", "Other", "Missing", "Reserve" ] %>
<% cabinet_device_selection.each do |device| %>
<% @selection_list << device.name %>
<% end %>
<% if position_map[i].nil? %>
<%= form_tag( {:controller => :cabinets, :action => :update_device_position, :position => i , :id => @cabinet.id } , { :method => 'get', :class => "form-search" }) do %>
<td>
<%= select_tag :position_name, options_for_select(@selection_list) %>
</td>
<td>
<%= hidden_field_tag 'position', i %>
<%= submit_tag "Add" , :class => "btn" %>
</td>
<% end %>
<% end %>
<% else %>
<% position_map[i].each do |cabinet_item| %>
<td>
<%= cabinet_item.name %>
</td>
<td>
<%= link_to "Remove", { :controller => :cabinets, :action => :remove_cabinet_position, :id => @cabinet.id, :position => i}, :class => "btn btn-danger" %>
</td>
<% end %>
<% end %>
</tr>
<% end %>
</table>
这是输出的样子: