javascript - Need to hide row of ngx-datatable based on row index - Stack Overflow

I have an data table where I show data of branches, but need to hide the item with the index of 0.<n

I have an data table where I show data of branches, but need to hide the item with the index of 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>

I tried do it with *ngIf directive but it doesn't work. How can I solve this?

I have an data table where I show data of branches, but need to hide the item with the index of 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>

I tried do it with *ngIf directive but it doesn't work. How can I solve this?

Share Improve this question edited Nov 5, 2019 at 12:06 Hovhannes Gevorgyan asked Apr 26, 2018 at 10:01 Hovhannes GevorgyanHovhannes Gevorgyan 5521 gold badge8 silver badges25 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

Try wrapping the data to be displayed with a span, then use the ngIf inside the span tag:

<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>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744719866a4589846.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信