简体   繁体   English

除了 appendTo="body" 之外,如何避免 p-dropdown 在 body 滚动时关闭

[英]How to avoid p-dropdown from closing on body scroll apart from appendTo="body"

I am using Angular version 12 and PrimeNG version 12 for my project.我正在为我的项目使用 Angular 版本 12 和 PrimeNG 版本 12。 For the same I am using primeng dropdown which gets closed on scrolling the body.同样,我正在使用 primeng 下拉菜单,它在滚动主体时关闭。 Using appendTo="body" doesn't close the dropdown on scroll but moves the dropdown panel with it.使用 appendTo="body" 不会关闭滚动时的下拉菜单,而是会移动下拉面板。 Many people have faced this issue but I haven't found any workaround for it still.很多人都遇到过这个问题,但我还没有找到任何解决方法。

<div class="customScroll">
  <p-dropdown
    filter="true"
    [options]="options" 
    [(ngModel)]="model" 
    (onChange)="filterTable()"
    [style]="{'width': '100%', 'margin-top': '10px', 'font-family': 'Roboto Regular'}"
  >
  </p-dropdown>
</div>

I did a lot of research around it but didn't found anything.我围绕它做了很多研究,但没有发现任何东西。

But this issue is fixed in the latest release of ngPrime which is 14.0.0但是这个问题在 ngPrime 的最新版本 14.0.0 中得到了修复

you need to use appendTo="body" property of PrimeNG dropdown您需要使用 PrimeNG 下拉列表的appendTo="body"属性

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

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