开发者

Richfaces poupPanel is shown before action execution

开发者 https://www.devze.com 2023-04-08 10:08 出处:网络
I have JSF 2.0 form that looks like this <h:form id=\"formId\"> . . . <a4j:commandButton action=\"#{bean.myAction}\" value=\"foo\"oncomplete=\"#{rich:component(\'popup\')}.show();\" />

I have JSF 2.0 form that looks like this

<h:form id="formId">
.
.
.
       <a4j:commandButton action="#{bean.myAction}" value="foo"  oncomplete="#{rich:component('popup')}.show();" />
</form>
 <rich:popupPanel id="popup" modal="false" autosized="true"
                              resizeable="false">

                <h:form id="form2">
                    <h:panelGrid columns="1" >     开发者_C百科          
                            <h:outputText id="idText" value="#{bean.message}" />
                        <h:commandButton action="#" onclick="#{rich:component('popup')}.hide(); return false;" value="ok"/>
                    </h:panelGrid>
                    </h:form>

            </rich:popupPanel>

and bean method

 public String action(){
    message = "Some message";
    return "";
}

Clicking the button both "action" and popup show are executed, but looks like calling the popup was executed first. I get message from bean constructor not the changed one. Do you have any idea how to delay popup show action (it is already under the oncomplete attribute)? Is there any usual pattern that can fit here (action dynamically changes content of popup panel, popup should be like outcome message). Or maybe there is a way to invoke popup show from java code(for example from bean.action)? Thanks


You need to re-render the <rich:popupPanel>s content first, otherwise it is still showing the content from the first time it was rendered. You're namely redisplaying already-rendered-but-hidden-by-CSS content by JavaScript.

<a4j:commandButton render=":popup:form2" ... />
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号