我願意隱藏用戶視圖中的某些列(實際來自索引6列下面的示例),但仍想讓它們在DOM中使搜索訪問值。角度數據表隱藏列
我用DTColumnDefBuilder
:
$scope.dtColumnDefsTabs = [
DTColumnDefBuilder.newColumnDef(0).notSortable(),
DTColumnDefBuilder.newColumnDef(1),
DTColumnDefBuilder.newColumnDef(2).withOption('orderDataType', 'content-categories'),
DTColumnDefBuilder.newColumnDef(3).withOption('orderDataType', 'markers'),
DTColumnDefBuilder.newColumnDef(4).notSortable(),
DTColumnDefBuilder.newColumnDef(5).notSortable().withClass('no-background-image'),
DTColumnDefBuilder.newColumnDef(6).withOption('visible', 'false')
];
在<thead>
HTML我定義空<td>
:
<th></th>
而在<tbody>
添加數據:
<td>{{ entry.device.device }}</td>
所以我嘗試了所有的可能性我可以找到:
DTColumnDefBuilder.newColumnDef(6).withOption('visible', 'false')
DTColumnDefBuilder.newColumnDef(6).withOption('visible', false)
$scope.dtColumnDefsTabs[6].visible = false;
DTColumnDefBuilder.newColumnDef(6).notVisible()
沒有工作,列仍然顯示。
PS從(ID = 0)至(ID = 5)中的所有列充滿整個表格的寬度(每<td>
有一個CSS width
設置)
PPS我不想responsive: true
選項以在列。
創建jsfiddle或在SO上創建完整的示例。 – vittore
你看過ng-show指令嗎? – epitka
@epitka'ng-show'完成了這個訣竅。你能否讓你評論一個答案?我想接受它 –