Richfaces modal panel and a4j:keepAlive

Posted by mykola on Stack Overflow See other posts from Stack Overflow or by mykola
Published on 2010-04-05T13:26:37Z Indexed on 2010/05/25 14:01 UTC
Read the original article Hit count: 393

Filed under:
|
|
|
|

Hello!

I've got unexpected problems with richfaces (3.3.2) modal panel. When i try to open it, browser opens two panels instead of one: one is in the center, another is in the upper left corner. Besides, no fading happens. Also i have three modes: view, edit, new - and when i open my panel it should show either "Create new..." or "Edit..." in the header and actually it shows but not in the header as the latter isn't rendered at all though it should, because i set proper mode in action before opening this modal panel. Besides it works fine on all other pages i've made and there are tens of such pages in my application. I can't understand what's wrong here. The only way to fix it is to remove <a4j:keepAlive/> from the page that is very strange, imho.

I'm not sure if code will be usefull here as it works fine everywhere in my application but this only case. So if you put it on your page it will probably work without problems. My only question is: are there any hidden or rare problems in interaction of these two elements (<rich:modalPanel> and <a4j:keepAlive>)? Or shall i spent another two or three days searching for some wrong comma, parenthesis or whatever in my code? :)

For most curious. Panel itself:

<!-- there's no outer form -->
    <rich:modalPanel id="panel" autosized="true" minWidth="300" minHeight="200">
        <f:facet name="header">
            <h:panelGroup id="panelHeader">
            <h:outputText value="#{msg.new_smth}" rendered="#{MbSmth.newMode}"/>
            <h:outputText value="#{msg.edit_smth}" rendered="#{MbSmth.editMode}"/>
            </h:panelGroup>
        </f:facet>
        <h:panelGroup id="panelDiv">
            <h:form >
                <!-- fields and buttons -->
            </h:form>
        </h:panelGroup>
    </rich:modalPanel>

One of the buttons that open panel:

<a4j:commandButton id="addBtn"
            reRender="panelHeader, panelDiv"
            value="#{form.add}"
        oncomplete="#{rich:component('panel')}.show()"
            action="#{MbSmth.add}"
            image="create.gif"/>

Action invoked on button click:

public void add() {
    curMode = NEW_MODE; // initial mode is VIEW_MODE
    newSmth = new Smth();
}

Mode check:

public boolean isNewMode() {
    return curMode == NEW_MODE;
}

public boolean isEditMode() {
    return curMode == EDIT_MODE;
}

© Stack Overflow or respective owner

Related posts about jsf

Related posts about richfaces