需要根据行索引隐藏 ngx-datatable 的行
Need to hide row of ngx-datatable based on row index
我有一个数据table,我在其中显示分支数据,但需要隐藏索引为 0 的项目。
<ngx-datatable
class="data-table table-responsive task-list-table"
[rows]="branches"
[loadingIndicator]="loadingIndicator"
[columnMode]="'force'"
[headerHeight]="50"
[footerHeight]="50"
[limit]="10"
[rowHeight]="66"
[reorderable]="reorderable">
<ngx-datatable-column name="Branch Office Name">
<ng-template let-rowIndex="rowIndex" *ngIf="rowIndex != 0" let-
branch="row" ngx-datatable-cell-template>
{{branch['name']}}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column name="Parent Branch">
<ng-template let-rowIndex="rowIndex" *ngIf="rowIndex != 0" let-
branch="row" ngx-datatable-cell-template>
{{branch['parentOrganizationName']}}
</ng-template>
</ngx-datatable-column>
</ngx-datatable>
我试着用 *ngIf 指令来做,但它不起作用。
我该如何解决?
尝试用 span 包装要显示的数据,然后在 span 标签内使用 ngIf:
<ngx-datatable
class="data-table table-responsive task-list-table"
[rows]="branches"
[loadingIndicator]="loadingIndicator"
[columnMode]="'force'"
[headerHeight]="50"
[footerHeight]="50"
[limit]="10"
[rowHeight]="66"
[reorderable]="reorderable">
<ngx-datatable-column name="Branch Office Name">
<ng-template let-rowIndex="rowIndex" let-
branch="row" ngx-datatable-cell-template>
<span *ngIf="rowIndex != 0">
{{branch['name']}}
</span>
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column name="Parent Branch">
<ng-template let-rowIndex="rowIndex" let-
branch="row" ngx-datatable-cell-template>
<span *ngIf="rowIndex != 0">
{{branch['parentOrganizationName']}}
</span>
</ng-template>
</ngx-datatable-column>
</ngx-datatable>
我有一个数据table,我在其中显示分支数据,但需要隐藏索引为 0 的项目。
<ngx-datatable
class="data-table table-responsive task-list-table"
[rows]="branches"
[loadingIndicator]="loadingIndicator"
[columnMode]="'force'"
[headerHeight]="50"
[footerHeight]="50"
[limit]="10"
[rowHeight]="66"
[reorderable]="reorderable">
<ngx-datatable-column name="Branch Office Name">
<ng-template let-rowIndex="rowIndex" *ngIf="rowIndex != 0" let-
branch="row" ngx-datatable-cell-template>
{{branch['name']}}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column name="Parent Branch">
<ng-template let-rowIndex="rowIndex" *ngIf="rowIndex != 0" let-
branch="row" ngx-datatable-cell-template>
{{branch['parentOrganizationName']}}
</ng-template>
</ngx-datatable-column>
</ngx-datatable>
我试着用 *ngIf 指令来做,但它不起作用。 我该如何解决?
尝试用 span 包装要显示的数据,然后在 span 标签内使用 ngIf:
<ngx-datatable
class="data-table table-responsive task-list-table"
[rows]="branches"
[loadingIndicator]="loadingIndicator"
[columnMode]="'force'"
[headerHeight]="50"
[footerHeight]="50"
[limit]="10"
[rowHeight]="66"
[reorderable]="reorderable">
<ngx-datatable-column name="Branch Office Name">
<ng-template let-rowIndex="rowIndex" let-
branch="row" ngx-datatable-cell-template>
<span *ngIf="rowIndex != 0">
{{branch['name']}}
</span>
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column name="Parent Branch">
<ng-template let-rowIndex="rowIndex" let-
branch="row" ngx-datatable-cell-template>
<span *ngIf="rowIndex != 0">
{{branch['parentOrganizationName']}}
</span>
</ng-template>
</ngx-datatable-column>
</ngx-datatable>