PrimeNG p-table scrollable scrollHeight 最后一行 p-dropdown 向上打开

PrimeNG p-table scrollable scrollHeight last row p-dropdown to open upwards

使用以下配置:

"@angular/cli": "^7.3.9", "primeng": "7.0.5",

我有一个使用 PrimeNG 的 <p-table> 的页面,它是 scrollable 并且 scrollHeight 设置为 100%。这个 table 包裹在一个固定高度为 300px.

div

已创建 Stackblitz:https://stackblitz.com/edit/angular-ejdubg

每一行都有一个 p-dropdown。在顶部的行中,当打开下拉菜单时,它向下打开,这是 acceptable,但是当打开最后一行的下拉菜单时,它也向下打开,但应该向上打开,这是 p-dropdown 的默认行为。

任何建议这里可能是错误的。

您需要在 p-dropdown

上添加 appendTo="body"
<th *ngFor="let col of columns" [ngSwitch]="col.field">
                <p-dropdown appendTo="body" [options]="brands"></p-dropdown>
            </th>