Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mat-cell height not fill parent

I'm using angular mat-table.

My problem is that mat-cell height is always 14px (inside content size), but I want to fix the mat-row height:

      <mat-table #table [dataSource]="dataSource">

      <ng-container matColumnDef="NAME">

        <mat-header-cell fxFlex="100%" class="my-mat-header" *matHeaderCellDef> 
          {{'NAME' | translate}} 
        </mat-header-cell>

        <mat-cell fxFlex="100%" class="my-mat-cell" *matCellDef="let element">
          {{ element.name }}
        </mat-cell>

      </ng-container>

      <mat-header-row *matHeaderRowDef="displayedColumns" class="my-mat-header-row"></mat-header-row>
      <mat-row *matRowDef="let row; columns: displayedColumns;" class="my-mat-row"></mat-row>
    </mat-table>

    .my-mat-row {
       min-height: 100%;
       border-bottom: none;
       padding: 5px 0;
    }

   .my-mat-cell {
     color: black;
     cursor: pointer;
     min-height: 100%;
   }

mat-row height is 50px, but mat-cell is only 14px.

how can it fill the parent height?

like image 267
cucuru Avatar asked Mar 12 '18 11:03

cucuru


1 Answers

As matTable rows are flex container you should use this :

 .my-mat-row {
   ....
   align-items: stretch;
   ....
 }

This way all cell will stretch to take full height

like image 68
Pierre Mallet Avatar answered Nov 18 '22 23:11

Pierre Mallet