Sunday, 16 June 2019

Show hide a row based on a value in the row

I am trying to hide and show based on the td value in the row in my angular 7 application. In the below example, there are three rows with the following headers.

Component

public ColumnNames: string[] = ['Legal Class Name', 'Last Edited' , 'Legal Class ID'];

If you notice in the code , I am trying to hide a row based on following condition. What I am looking for is that the row should be hidden based on the value in Last Edited row. So I need to show ColumnNames[2] if the value is true in Last Edited

<ng-container *ngIf="c != ColumnNames[2]">

html

<table class="fundClassesTable table-striped" border="1">
  <tr *ngFor="let c of ColumnNames">
    <ng-container *ngIf="c != ColumnNames[2]">
      <th class="tableItem bold"></th>
      <ng-container *ngFor="let f of data">

        <ng-container>        
          <td class="tableItem" *ngIf="c == ColumnNames[0]"></td>
          <td class="tableItem" *ngIf="c == ColumnNames[1]"></td>
          <td class="tableItem" *ngIf="c == ColumnNames[2]"></td>
        </ng-container>

      </ng-container>
    </ng-container>
  </tr>
</table>



from Show hide a row based on a value in the row

No comments:

Post a Comment