简体   繁体   中英

How to expand Angular Material Tab to show Angular Grid data?

I am using Angular 8 and want to show Angular Grid inside Angular Material Tab in following manner:-

<mat-tab-group>
        <mat-tab label="Request Flow">
            <div class="div-main">
                <ag-grid-angular class="ag-theme-balham grid-dimensions" [pagination]="true"
                    [gridOptions]="reqDetailGridOptions" [rowData]="reqDetailRowData" [columnDefs]="reqDetailColDef"
                    [getRowHeight]="getRowHeight" [paginationPageSize]=50 (gridReady)="onGridReady($event)">
                </ag-grid-angular>
                <br />                
                <button class="button-internal">Add Subrequest</button>
            </div>
        </mat-tab>
    </mat-tab-group>

The issue is that even if data present in Angular Grid then also Angular Material Tab is not expanding to make Angular Grid visible. It is showing like below:-

在此处输入图像描述

However when I put Angular Grid outside Angular Material Tab then the grid is showing its full data.

I tried to use "dynamicHeight" property of "mat-tab-group" but it is of no use.

Please help here.

Below steps worked for me:-

  1. Added [dynamicHeight] = "true" to mat-tab-group.
  2. Added following CSS:-

    .mat-tab-group{ height: 100%; }.mat-tab-body-wrapper { flex-grow: 1; }

    .mat-tab-body { display: flex;important: flex-direction; column; }

This worked for me:

::ng-deep.mat-tab-body-wrapper { 
    flex-grow: 1; 
}

you have to override mat-tab-body-wrapper style with::ng-deep

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM