Initially a button is disabled, and I want it to get enabled when I select a row in the datatable, but the listener is not working and I can't find the problem...
This is how the xhtml file looks like:
<h:form id="form" class="formulario">
...
<p:dataTable value="#{queryBean.offs}" var="offer" selection="#{queryBean.oferta}" rowKey="#{offer.offerNumber}" tableStyle="width:auto" >
<f:facet name="header">Ofertas disponibles</f:facet>
<p:ajax event="rowSelect" listener="#{queryBean.rowSelected}" />
...
</p:dataTable>
<center><br/>
<h:commandButton id="botonReserva" value="Reservar" disabled="true" >
<p:ajax process="form" update="form" resetValues="true" />
</h:commandButton>
...
</center>
</h:form>
And this is the bean's listener
...
public void rowSelected(SelectEvent selectEvent) {
System.out.println("Working");
//Not printing anything
}
...
I know I'm not updating the button but it is because it doesn't work, so first I want to know how to solve this. After I solve the problem I would know how to enable the button.
What could be the problem?
SOLUTION: It was because I was using a datatable with radio buttons, and I should have used event="rowSelectRadio"
instead of event="rowSelect"