[ 
https://issues.apache.org/jira/browse/MYFACES-1357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13112412#comment-13112412
 ] 

Ondrej Svetlik commented on MYFACES-1357:
-----------------------------------------

1. is your h:commandButton inside h:form?
2. to select the row value for an action, I usually use 
f:setPropertyActionListener

> commandButton inside datatable doesn't process action
> -----------------------------------------------------
>
>                 Key: MYFACES-1357
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1357
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to