Próbuję utworzyć tabelę elastyczną, która zawiera dane wejściowe formularza dla kilku kolumn. Z tego, co rozumiem, tabele reagujące kurczą się, aż kolumny nie mogą już iść dalej, a następnie dodaje rolkę. Jednak kolumny kurczą się do punktu, w którym nie widzę wartości w polu wejściowym, więc potrzebuję sposobu narzucenia minimalnej szerokości na tych kolumnach zamiast określenia jej przez długość tekstu nagłówka kolumny.Tabela reagowania rozruchowego z wprowadzeniem formularza o szerokości min.
Próbowałem dodać min-width: "10%" lub "150px" do wszystkich elementów w kolumnie, ale to nie zadziałało. Oto moja konfiguracja:
<form class="form-horizontal">
<div class="table-responsive">
<table class="table table-bordered table-striped table-highlight">
<thead>
<th>Name</th>
<th>Date</th>
<th>Cost</th>
<th>Billing Type</th>
<th>Tax</th>
<th>Other Col</th>
<th>Other Col</th>
<th>Other Col</th>
<th>Total</th>
</thead>
<tbody>
<tr>
<td><input type="text" class="form-control" value="Some Long Name Here"/></td>
<td><input type="text" class="form-control" value="13-Jul-2015"/></td>
<td><input type="text" class="form-control" value="$12355.12"/></td>
<td>
<select class="form-control">
<option>Monthly</option>
<option>Yearly</option>
</select>
</td>
<td><input type="text" class="form-control" value="another long value"/></td>
<td><input type="text" class="form-control" value="some val"/></td>
<td><input type="text" class="form-control" value="some val"/></td>
<td><input type="text" class="form-control" value="some val"/></td>
<td>$505.79</td>
</tr>
</tbody>
</table>
</div>
</form>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<form class="form-horizontal">
<div class="table-responsive">
<table class="table table-bordered table-striped table-highlight">
<thead>
<th>Name</th>
<th>Date</th>
<th>Cost</th>
<th>Billing Type</th>
<th>Tax</th>
<th>Other Col</th>
<th>Other Col</th>
<th>Other Col</th>
<th>Total</th>
</thead>
<tbody>
<tr>
<td><input type="text" class="form-control" value="Some Long Name Here" /></td>
<td><input type="text" class="form-control" value="13-Jul-2015" /></td>
<td><input type="text" class="form-control" value="$12355.12" /></td>
<td>
<select class="form-control">
<option>Monthly</option>
<option>Yearly</option>
</select>
</td>
<td><input type="text" class="form-control" value="another long value" /></td>
<td><input type="text" class="form-control" value="some val" /></td>
<td><input type="text" class="form-control" value="some val" /></td>
<td><input type="text" class="form-control" value="some val" /></td>
<td>$505.79</td>
</tr>
</tbody>
</table>
</div>
</form>
Jak widać, niektóre wartości pól są odcięte gdy stół kurczy. Każda pomoc jest doceniana.
Edytuj: Chciałbym jak, aby nadal używać tabel ze względu na zachowanie starszego kodu. Jestem jednak otwarty na wszelkie rozwiązania, jeśli zajdzie taka potrzeba.
Jeśli używasz DataTables, dlaczego używanie Bootstrap? – isherwood
ponieważ datatables to wtyczka js, bootstrap to framework css/js. DT jest wymagany tylko w przypadku niewielkiego elementu mojej witryny. – robarelli
'Form-control' wymusza to zachowanie, wierzę, że twój problem dotyczy' ' –