0

I'm using angular and aggrid and I would like my grid to adapt in height in a mat expansion panel to take all the screen available space when opened. How can I do that, preferably in css?

It seems that aggrid is adapting to container and mat expansion to content.

I want also the text in orange to be fixed at the bottom of the panel and have the scrollbar only for the grid.

I made a plunker to help: https://plnkr.co/edit/Y0tJ1yoDb5LhDB8a

<div style="height: 500px; background-color:red; ">
  <mat-accordion multi displayMode="flat" style="margin: 10px;">
   <mat-expansion-panel expanded="true" class="mat-elevation-z1" style="background-color:blue;" >
      <mat-expansion-panel-header>
        <mat-panel-title>Panel 1</mat-panel-title>
      </mat-expansion-panel-header>
      text<br> text<br> text<br> text
    </mat-expansion-panel>
    <mat-expansion-panel expanded="true" class="mat-elevation-z1" style="background-color:green;">
      <mat-expansion-panel-header>
        <mat-panel-title>Panel 2</mat-panel-title>
      </mat-expansion-panel-header>
      text<br> text<br> text<br> text
    </mat-expansion-panel>
    <mat-expansion-panel expanded="true" class="mat-elevation-z1" style="background-color: white;"> 
     <mat-expansion-panel-header>
        <mat-panel-title>Panel aggrid</mat-panel-title>
      </mat-expansion-panel-header>
      <ag-grid-angular
        #agGrid
        style="height:100px"
        id="myGrid"
        class="ag-theme-alpine"
        [modules]="modules"
        [columnDefs]="columnDefs"
        [rowData]="rowData"
        (gridReady)="onGridReady($event)"
      ></ag-grid-angular>
      <div style="background-color: orange" >
        This text should always be visible when expanded. aggrid should adapt to content
      </div>
    </mat-expansion-panel>
  </mat-accordion>
 </div>

Thanks

AlixRoyere
  • 41
  • 4

2 Answers2

0

Well, with no solution, I finally have avoided the issue taking out the grid table of the mat expansion panel. Thus I can use flex css to adapt to the page available content

AlixRoyere
  • 41
  • 4
-1

check below one, domLayout set to autoHeight, mention inside ag-grid component

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 22 '22 at 18:45
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/33466701) – Insane Skull Dec 24 '22 at 09:06