There's a datatable with a h:selectOneMenu in each row. I want to be able to retrieve the value selected in the selectOneMenu in the bean. I'm using richfaces a4j:support tag to make AJAX calls to the backing bean. You can see the code below:
DataTable header:
<t:dataTable id="datatable" var="row" value="#{myBean.dataTableRows}">
SelectOneMenu with A4j:
<h:selectOneMenu id="type" label="Type:" styleClass="tamanho80"
value="#{datatableHolder.selectedValue}" converter="comboConverter" immediate="true" >
<f:selectItem itemValue="#{null}" itemLabel="" />
<t:selectItems var="tp"
itemValue="#{tp}" itemLabel="#{tp.nome}"
value="#{row.comboTypeValues}" />
<f:attribute name="row" value="#{row}"/>
<a4j:support event="onchange" reRender="parent" actionListener="${myBean.executeAjax}" immediate="true" ajaxSingle="true" />
</h:selectOneMenu>
The Backing Bean method to be executed:
public void executeAjax(ActionEvent event){
ValueHolder comboBox = (ValueHolder) event.getComponent().getParent();
comboBox .getValue();
}
- comboBox .getValue() is returning NULL, even when I select a value.
PS:
This question has been identified as a possible duplicated of this question, but it's not. My question uses a dataTable and doesn't use binding for each element. Also, I'm using JSF 1.1 and RichFaces 3.3.3.