user811602
user811602

Reputation: 1354

rich:modalPanel appearing for some seconds only

I have used rich:menuItem to display rich:modalpanel. Code of rich:menuItem is as follow:

<rich:menuItem>
    <a4j:commandLink
        value="Add Machine"
        oncomplete="#{rich:component('addMachinePanel')}.show()"
        reRender="addMachinePanel">
   </a4j:commandLink>
</rich:menuItem>

And rich:modalpanel code is

<rich:modalPanel id="addMachinePanel">
    <a4j:form>
        <a4j:commandButton value="Cancel"
            action="#{adminBean.cleanupMachineToEdit}"
            onclick="#{rich:component('addMachinePanel')}.hide(); return false;" />
    </a4j:form>
</rich:modalPanel>

With above piece of code, rich:modalpanel is appearing for one or two seconds and again disappear. Please help me to find out the issue.

Thanks

Upvotes: 1

Views: 1047

Answers (1)

Ken Chan
Ken Chan

Reputation: 90567

By default , the submitMode attribute for the rich:menuItem is server , which will submit the form and completely refreshes the page.

You can change the submitMode to the ajax to performs an ajax form submission. Only the elements specified with the reRender attribute will be refreshed instead of whole page.

Or , you can change it to none (for richfaces 3.X) or client (for richface 4.0) such that there are no form submission.

<rich:menuItem submitMode="ajax">
    <a4j:commandLink
        value="Add Machine"
        oncomplete="#{rich:component('addMachinePanel')}.show()"
        reRender="addMachinePanel">
   </a4j:commandLink>
</rich:menuItem>

Upvotes: 3

Related Questions