[ http://issues.apache.org/jira/browse/MYFACES-1357?page=comments#action_12419793 ]
Jose Luis Freire commented on MYFACES-1357: ------------------------------------------- Sorry. Forgot to say I'm using facelets 1.1.11. > commandButton inside datatable doesn't process action > ----------------------------------------------------- > > Key: MYFACES-1357 > URL: http://issues.apache.org/jira/browse/MYFACES-1357 > Project: MyFaces Core > Type: Bug > Versions: 1.1.3 > Environment: Windows XP SP2, JDK 1.5 Update 7, TomCat 5.5.17, MyFaces 1.1.3 > Reporter: Jose Luis Freire > > Consider a simple datatable: > <h:dataTable > value="#{userProfile.associations}" > var="association"> > <h:column> > <h:commandButton > action="#{userProfile.selecting}" value="#{association.entityCodeTo}" /> > </h:column> > <h:column> > <h:outputText > value="#{association.dateFrom}"></h:outputText> > </h:column> > </h:dataTable> > Now consider that the list returned by userProfile.associations is null (or > an empty ArrayList) in the first time it get's called (in ApplyRequestValues > phase), and is fully populated in the RenderResponse phase (because it > depends on settings populated in the UpdateModel phase). > When the commandButton is pressed, the method in the action > (userProfile.selecting) will not be called. > The only workaround is implementing the getAssociations like this: > public List<EntityAssociationData> getAssociations() { > if (business rule is populated) { > associationData = getAssociationsFromSystem(); > } else > if (associationData == null) { > /* We must always return a arraylist with at > least one element */ > associationData = new > ArrayList<EntityAssociationData>(); > EntityAssociationData entityAssociationData = > new EntityAssociationData(); > associationData.add(entityAssociationData); > } > } > We *really* need that bogus entry, so the ArrayList has a size > 0, or else > the userProfile.selecting() method will never be called. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
