2

I have this issue inside an Angular Material Expansion Panel. Part of the pagination dropdown is cut off. How can I make the dropdown overlap the end of the expansion panel? I tried z-index to no avail.

There are three panels inside a Material Accordion.

Material Expansion Accordeon with three Panels.

Cut off dropdown.

Here's the relevant code:

<mat-accordion class="example-headers-align" multi>
            <mat-expansion-panel hideToggle>
              <mat-expansion-panel-header>
                <mat-panel-title>
                Title
                </mat-panel-title>
              </mat-expansion-panel-header>
              <p-table
                #dt
                [columns]="cols"
                [value]="tableDataSummary"
                [paginator]="false"
                scrollable="true"
                sortMode="multiple"
                [resizableColumns]="true"
                [rowHover]="true"
                [rows]="10"
                scrollable="true"
                resizableColumns="true"
                [rowsPerPageOptions]="[10,100]"
                appendTo="body"
                [paginator]="true"
              >
                <ng-template pTemplate="header" let-columns>
                  <tr>
                    <th pSortableColumn="col" *ngFor="let col of columns">
                      {{col.header}}
                    </th>
                  </tr>
                  <tr>
                    <th
                      *ngFor="let col of columns"
                      [ngSwitch]="col.field"
                      [pSortableColumn]="col.field"
                    >
                      <p-sortIcon [field]="'col.field'"></p-sortIcon>
                    </th>
                  </tr>
                </ng-template>
                <ng-template pTemplate="body" let-rowData let-columns="columns">
                  <tr [pSelectableRow]="rowData">
                    <td
                      *ngFor="let col of columns"
                      style="line-break: anywhere;"
                    >
                      <span
                        *ngIf="col.field === 'TR' || col.field === 'TwR' || col.field === 'FT'; else elseBlock"
                        [ngClass]="rowData[col.field] > 0.10 ? 'red' : null"
                      >
                        {{ rowData[col.field] | percent:'1.0-2' }}
                      </span>
                      <ng-template #elseBlock>
                        {{ rowData[col.field] }}
                      </ng-template>
                    </td>
                  </tr>
                </ng-template>
                <ng-template pTemplate="paginatorleft" let-state>
                  Showing {{(state.page * state.rows) + 1}} to {{state.rows *
                  (state.page + 1)}} of {{state.totalRecords}}
                </ng-template>
              </p-table>
            </mat-expansion-panel>

Thank you!


Since some people are looking at this question, the problem was, I believe, the card I used to put the table into, not the expansion panel itself. Angular Material Cards try to contain their content and have no overflow.

mneumann
  • 713
  • 2
  • 9
  • 42

1 Answers1

4

This it's a common problem with Modals/Dialogs Accordions and so on... I solve this problem adding into parent container CSS property:

overflow: inherit

For example in Angular Material expansion:

.mat-accordion>.mat-expansion-panel-spacing {
    overflow: inherit;
}

...and that solve my problem and parent div is expanding based on drop downs and other html elements with dynamic height.

Carnaru Valentin
  • 1,690
  • 17
  • 27