【发布时间】:2016-07-25 13:33:43
【问题描述】:
如何将width 应用于table 列以避免在其中未找到结果时更改列width。 table 中的列也可以动态隐藏,因此我无法在 th 元素上设置固定宽度。
<table>
<thead>
<tr>
<th>col1</th>
<th>col2 <i>Filter:</i> <input type="text" ng-model="searchText"></th>
<th ng-hide="hideCol3">col3 <button ng-click="hideCol3 = !hideCol3">Hide column</button></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="d in data | filter: searchText">
<td>{{d.col1}}</td>
<td>{{d.col2}}</td>
<td ng-hide="hideCol3">{{d.col3}}</td>
</tr>
</tbody>
</table>
表格中的列可能是hidden。因此,例如,如果我转到plunker 示例,隐藏col3,并搜索不存在的文本,让我们说'abc' 表列宽度更改的width。
我希望表格在隐藏某些列时调整宽度(现在正在这样做),但是当我过滤并且没有结果时,我不想改变列宽
【问题讨论】: