p:selectOneMenu dropdown part scrolls and does not stay in position

后端 未结 3 1553
长情又很酷
长情又很酷 2020-12-02 00:24

I am using PrimeFaces 5.0.5 with GlassFish server 3.1.2.2.

I added a selectonemenu inside a which is then included in another XHTML

3条回答
  •  悲&欢浪女
    2020-12-02 00:35

    The thing is that these floating divs are created with absolute positioning, and when you have layouts or dialogs or things that break the flow of the page, these p:selectOneMenu "panels" stay in the same absolute position even though you scroll the layout or container, because they are attached to the body by default.

    So one way to solve this would be to attach them to themselves so the absolute panel appears next to the select in the flow of the page and doesn't move with those "inside scrollings":

    
        
        
        
        
    
    

    Using the attribute appendTo:

    Appends the overlay to the element defined by search expression. Defaults to document body.

    If you are using it inside a dialog, the panel could be cut by the dialog height, because it's styled with overflow: hidden. So another solution would be to apply position: fixed, you can do that with:

    panelStyle="position: fixed;"
    

提交回复
热议问题