【问题标题】:Equivalent of RichFaces 4 <rich:popupPanel> for RichFaces 3RichFaces 3 的 RichFaces 4 <rich:popupPanel> 等效项
【发布时间】:2013-12-19 08:17:14
【问题描述】:

我在 RichFaces 4 中寻找类似 @​​987654321@ 的内容,但随后在 RichFaces 3 中寻找。我在文档中没有找到类似的内容。只有&lt;rich:modalPanel&gt; 不适合我的需要,因为在表格中显示我的数据模型时出现问题。选择不起作用,它总是返回未选择的行。如果我将表格组件放在&lt;rich:panel&gt;&lt;rich:togglePanel&gt; 中,则可以正常工作。

RichFaces 3 中有没有除&lt;rich:modalPanel&gt; 之外的弹窗?

【问题讨论】:

    标签: jsf richfaces popuppanel


    【解决方案1】:

    我没有 50 声望在评论中询问你更多细节,所以我会直接回答,希望这就是你要问的。

    我认为您的意思是您的问题是 ModalPanel 的内容没有动态重新呈现。但为此,您可以使用ajaxRendered="true" 将表格(或要更新的组件)包装在&lt;a4j:outputPanel&gt;

    设置ajaxRendered="true" 将导致&lt;a4j:outputPanel&gt; 随页面的每个Ajax 响应而更新,即使请求组件未明确列出也是如此。这又可以被任何请求组件上的特定属性覆盖。

    http://docs.jboss.org/richfaces/latest_4_0_X/Component_Reference/en-US/html/chap-Component_Reference-Containers.html#sect-Component_Reference-Containers-a4joutputPanel

    在我的代码中,我有类似的内容:

    <a4j:commandLink id="timelineBtn" action="#{timelineBean.doGenerateLog}"
        oncomplete="Richfaces.showModalPanel('timelinePnl');return false;"
        value="#{labels['timeline.button.lbl']}"/> 
    

    打开modalPanel:

    <rich:modalPanel style="width:800;height:600;" id="timelinePnl">
    
    <a4j:outputPanel id="dataPanel" ajaxRendered="true">
    <!-- your components to be updated go here -->
    </a4j:outputPanel>
    
    </rich:modalPanel>
    

    所以每次我打开 modalPanel 时,我的内容都会使用我的 timelineBean.doGenerateLog 方法的结果进行更新。

    【讨论】:

    • 确实是一个可行的解决方案,只是想补充一点,通常不希望在每个 ajax 请求上呈现面板内容(尤其是与面板无关的请求,如字段 ajax 验证等) .对于这种情况,我建议在单击按钮/链接时显式重新渲染面板 (reRender="modalPanelId"),并且不要执行 ajaxRendered="true"。
    • +1 这对于简单的任务来说也是一个更好的解决方案。取决于他想做的事情的复杂性。所以我也会参考'limitRender="true"',以防他只想重新渲染一些特定的组件,而不是所有有'ajaxRendered="true"'的人都欢呼
    猜你喜欢
    • 2021-06-23
    • 2012-10-01
    • 2011-10-17
    • 2012-06-05
    • 2012-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多