简体   繁体   English

PrimeNG p-table 可滚动 scrollHeight 最后一行 p-dropdown 向上打开

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

Using following config:使用以下配置:

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

I have a page that uses PrimeNG's <p-table> which is scrollable and has a scrollHeight set to 100%.我有一个使用 PrimeNG 的<p-table>的页面,它是scrollable的,并且scrollHeight设置为 100%。 This table is wrapped within a div that has fixed height of 300px .该表包含在一个固定高度为300pxdiv中。

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

Every row has a p-dropdown .每行都有一个p-dropdown In top rows when dropdown is opened, it opens downwards which is acceptable but when dropdown in the last row is opened, it open downwards too but should open upwards which is the default behavior of the p-dropdown .在打开下拉菜单时的顶行中,它向下打开,这是可以接受的,但是当打开最后一行中的下拉菜单时,它也向下打开,但应该向上打开,这是p-dropdown的默认行为。

Any suggestions what could be wrong here.任何建议这里可能有什么问题。

You need to add appendTo="body" on p-dropdown您需要在 p-dropdown 添加 appendTo="body"

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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