mne*_*ann 2 html angular-material primeng-datatable
我在 Angular Material 扩展面板中遇到了这个问题。部分分页下拉菜单被切断。如何使下拉菜单与扩展面板的末端重叠?我尝试z-index过但没有成功。
Material Accordion 内部包含三个面板。
这是相关代码:
<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>
Run Code Online (Sandbox Code Playgroud)
谢谢你!
既然有人在看这个问题,我相信问题出在我用来放入桌子的卡上,而不是扩展面板本身。Angular Material 卡尝试包含其内容并且不会溢出。
这是模态/对话框手风琴等的常见问题...我通过添加到父容器 CSS 属性中解决了这个问题:
overflow: inherit
Run Code Online (Sandbox Code Playgroud)
例如在 Angular Material 扩展中:
.mat-accordion>.mat-expansion-panel-spacing {
overflow: inherit;
}
Run Code Online (Sandbox Code Playgroud)
...这解决了我的问题,父 div 正在根据下拉菜单和其他具有动态高度的 html 元素进行扩展。