p:commandButton rendered=condition(arg1) stops action events

UI Components for JSF
Post Reply
Marc
Posts: 3
Joined: 06 Dec 2010, 06:17

06 Dec 2010, 07:13

Hello guys,

Now I really need help, because just could not get anything to work in couple of days and now I finally found out why but dont know how to work around :shock: :

if I have a commandbutton, outputPanel or another element and set either it's disabled or rendered attribute to a boolean function of my SessionScoped managed bean with parameters,
it uses the function, displays well, but there are no more actions or actionListener calls inside that element.

when the value of rendered or disabled attribute is just rendered="true" or disabled="#{disabled()}" everything works fine, but i have lots of buttons in my network editor datatable and I must hide many of them depending on the network status between the objects.

Backing Bean:

Code: Select all

@ManagedBean
@SessionScoped
public class NetworkEditorBean implements Serializable {
    public boolean connected(INetworkSource source, INetworkDestination dest) {
        if (source == null) {
            return false;
        }
        return source.connectedTo(dest);
   }
}
JSF:

Code: Select all


<p:dataTable var="connections" value="#{networkEditorBean.connections}" id="networkTable">

                <p:columns value="#{networkEditorBean.networkDestinations}"
                           var="networkDest" columnIndexVar="colIndex" id="columns">

<p:commandButton value="test"
                                             actionListener="#{networkEditorBean.connectionChanged}"
                                             id="testid"
                                             update="networkTable"
                                             rendered="#{(colIndex gt 1) and !networkEditorBean.connectionPossible(connections[colIndex], networkDest)}"
>
   <f:param value="#{connections[colIndex].getId().toString()}" name="sourceId"/>

</p:commandButton>

</p:columns>
</p:dataTable>
Probably a related issue:

if I use <f:setActionPropertyListener value="networkEditorBean.connectionPossible(connections[colIndex], networkDest)" target="booleanProperty"/> instead of <f:param>,
the function is called but both arguments are null. But above, the arguments are not null, the button is rendered/disabled depending on function and parameters, but no actions:(

I'm running this on primefaces 2.2RC2, glassfish 3.0.1 and mojarra 2.0.2

So did someone see this, that should be a common issue, but I also didn't find any information on this. :roll:

Many thanks for help!!

claudio
Posts: 4
Joined: 10 Jan 2011, 20:34

28 Jun 2011, 23:17

Did you solve de problem? I am also having it

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 35 guests