h:commandButton action not working inside a h:datatable.
- by Chris
I'm stuck with this piece of jsf code that I don't understand why it's working when used outside a datatable and doesn't inside a datatable...
<h:dataTable id="myTable" rendered="true" value="#{bean.selectedItemsList}" var="items">
<h:column>
<h:commandButton action="#{bean.removeItemFromList}" image="/resources/images/deleterow.gif">
<f:actionListener binding="#{bean.actionListenerImpl}" type="com.mycorp.ActionListenerImpl"/>
</h:commandButton>
</h:column>
<h:column>
<h:outputText value="#{items}" />
</h:column>
</h:dataTable>
I read around the net to put value="#{items}" inside the action listener so the action can get the items in the row like this:
<f:actionListener value="#{items}" binding="#{bean.actionListenerImpl}" type="com.mycorp.ActionListenerImpl"/>
But it's doesn't work either.
Bu if I do the action outside the data table everything work fine.
<h:commandButton action="#{bean.removeItemFromList}" image="/resources/images/deleterow.gif">
<f:actionListener binding="#{bean.actionListenerImpl}" type="com.mycorp.ActionListenerImpl"/>
</h:commandButton>
Side note I also tried a4j:commandButton and didn't so I guess my problem is probably the actionlistener or how the bean handling it.