0

I work on a JSF 1.2 application with Richfaces 3.3. I have a popup which contains a rich:extendedDataTable. When I click a row in a table I want to enable or disable a button, and I use a4j:support event="onRowClick".

Here is some code:

<h:form>
    <rich:panel id="main">
        <a4j:commandButton id="completed" value="Completed" 
        rendered="#{bean.completedCase}" />

        <a4j:commandButton  value="Open"
                oncomplete="#{rich:component('popupId')}.show(...)">
        </a4j:commandButton>

        <rich:modalPanel id="popupId">
            <a4j:region>

                <rich:extendedDataTable id="source" value="#{bean.sourceItems}" 
                    var="sourceItem" selectionMode="single" >
                    <a4j:support event="onRowClick" eventsQueue="pickQueue" reRender="copy" >
                        <f:setPropertyActionListener value="#{sourceItem}"
                            target="#{bean.sourceSelection}" />
                    </a4j:support>
                    ....
                </rich:extendedDataTable>           

                <a4j:commandButton id="copy" value="Copy" />
            </a4j:region>

            <a4j:commandButton value="Ok" reRender="completed"
                    oncomplete="#{rich:component('popupId')}.hide();return false;">
            </a4j:commandButton>

        </rich:modalPanel>
    </rich:panel>
</h:form>

The problem is that when I click a row, then in the backend are called some methods that are use to render a button: rendered="#{bean.completedCase}", but the button is not on the popup, but on the page beyond the popup. Any idea why there are called other methods than the ones used for the table?

Alina Danila
  • 1,683
  • 1
  • 24
  • 60

2 Answers2

0

Try using ajaxsingle="true" on your a4j:support tag. Since your are using h:form when the onrowclick fire a request ,all of the components inside the h:form will be processed on the server during update model phase.

Hope this helps.

Ellie Fabrero
  • 791
  • 2
  • 16
  • 41
0

Its not advisable to have nested <h:form>s but we can have multiple <h:form>s ,try modifying your code in such a way that the <h:commandButton> are in one h:form and the <h:modalPanel> is in another form

Hope this helps. u can also give a try with <a4j:form> for modalPanel

Mango
  • 650
  • 2
  • 16
  • 38