【问题标题】:how to make richfaces popup the popuppanel upwards如何让richfaces向上弹出popuppanel
【发布时间】:2015-11-12 15:14:13
【问题描述】:

该链接包含 Richfaces 4 弹出面板的示例: richfaces popuppanel example

代码如下:

<rich:toolbar height="26px" id="tb">
    <rich:toolbarGroup location="right">
        <h:outputLink value="#">
            <rich:componentControl event="click" operation="show" target="ls">
                <a4j:param name="event" value="event" noEscape="true" />
                <rich:hashParam>
                    <a4j:param noEscape="true" name="top"
                               value="jQuery(#{rich:element('tb')}).offset().top + jQuery(#{rich:element('tb')}).height()" />
                    <a4j:param noEscape="true" name="left"
                               value="jQuery(#{rich:element('tb')}).offset().left + jQuery(#{rich:element('tb')}).width() - p_width" />
                </rich:hashParam>
            </rich:componentControl>
            Search
        </h:outputLink>
    </rich:toolbarGroup>
</rich:toolbar>
<rich:popupPanel header="Enter Search Terms" id="ls" autosized="true" modal="false" moveable="false" resizeable="false" followByScroll="false" >
    <h:panelGrid columns="3">
        <h:outputText value="Search:" />
        <h:inputText />
        <h:outputLink onclick="#{rich:component('ls')}.hide(event); return false;" value="#">Search
        </h:outputLink>
    </h:panelGrid>
</rich:popupPanel>
<h:outputScript type="text/javascript" target="body">
    p_width = #{rich:component('ls')}.width();
</h:outputScript>

但弹出窗口出现在随机位置,即有时在栏下方,然后必须滚动,有时在上方。是否可以确保它在连接到栏时始终显示在栏的正上方?

【问题讨论】:

    标签: css jsf-2 position richfaces popuppanel


    【解决方案1】:

    topleft 参数设置面板的位置,将它们更改为您希望面板所在的位置,或直接调用方法:

    RichFaces.component('panelId').show(null, {top: "800px", left: "500px"})
    

    您正在使用示例中专门设置栏下方的面板的部分,因此当面板出现在该栏下方时应该不足为奇。

    【讨论】:

      猜你喜欢
      • 2023-03-27
      • 2014-02-04
      • 1970-01-01
      • 2011-06-16
      • 1970-01-01
      • 2012-04-02
      • 1970-01-01
      • 1970-01-01
      • 2015-11-30
      相关资源
      最近更新 更多