[richfaces-issues] [JBoss JIRA] (RF-11410) CommandButton in ExtendedDataTable; Action for commandButton is executed twice.

Brian Leathem (Updated) (JIRA) jira-events at lists.jboss.org
Mon Nov 14 17:22:40 EST 2011


     [ https://issues.jboss.org/browse/RF-11410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian Leathem updated RF-11410:
-------------------------------

    Fix Version/s: 4.2.0.Tracking
                       (was: 4.1.0.Tracking)

    
> CommandButton in ExtendedDataTable; Action for commandButton is executed twice.
> -------------------------------------------------------------------------------
>
>                 Key: RF-11410
>                 URL: https://issues.jboss.org/browse/RF-11410
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component-tables
>    Affects Versions: 4.1.0.Milestone1
>         Environment: java 1.6.0_26
> glassfish 3.1
> Mojarra 2.1.0 (FCS 2.1.0-b11)
> Seam Faces 3.0.1.Final
>            Reporter: Florian Schoedel
>             Fix For: 4.2.0.Tracking
>
>         Attachments: rfExtDatatableBug.zip
>
>
> I've created a composite component which contains two richfaces extented data tables. Each Datatable contains a column for a button to perform an action. (in the left datatable there is an 'add' button, on the right datatable a 'remove' button). Everything works fine until I try to attach a client behavior to the add / remove btns. I want to monitor my component for selection and removal of any value from the calling page.
> The client behavior is triggered as expected, but the method behind the add and remove btns is executed twice! This also happens which actionListener attribute instead of action attribute. 
> I've replaced richfaces ext. DataTable by h:dataTable and everything works fine. 
> Here is the xml of my composite component:
> -----
> {code}
> <?xml version='1.0' encoding='UTF-8' ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"
>       xmlns:r="http://richfaces.org/rich"
>       xmlns:a="http://richfaces.org/a4j"
>       xmlns:h="http://java.sun.com/jsf/html"
>       xmlns:f="http://java.sun.com/jsf/core"
>       xmlns:fn="http://java.sun.com/jsp/jstl/functions"
>       xmlns:o="http://java.sun.com/jsf/composite/ezcomp"
>       xmlns:cc="http://java.sun.com/jsf/composite"      >
>     <!-- INTERFACE -->
>     <cc:interface componentType="MultiplePersonSelectionComponent">
>         <cc:attribute name="all" type="java.util.List" />
>         <cc:attribute name="selection" type="java.util.List" />
>         <cc:clientBehavior name="addPerson" event="action" targets="allPersonTable:addBtn" />
>         <cc:clientBehavior name="removePerson" event="action" targets="selectedPersonTable:removeBtn" />
>         <cc:attribute name="refresh" type="java.lang.String" default=""/>
>     </cc:interface>
>     <!-- IMPLEMENTATION -->
>     <cc:implementation>
>         <div id="#{cc.clientId}" style="width: 100%">
>             <h:panelGrid columns="2" width="100%" columnClasses="pnlTop, pnlTop">
>                 <r:panel header="Alle Personen"  id="all" style="text-align: center;">
>                     <r:extendedDataTable
>                         value="#{cc.attrs.all}"
>                         var="p"
>                         id="allPersonTable"  
>                         selectionMode="none"
>                         rows="10"
>                         >
>                         <f:facet name="header">
>                             <r:dataScroller for="allPersonTable" maxPages="5" id="dataScrollerTop" />
>                         </f:facet>
>                         <f:facet name="footer">
>                             <r:dataScroller for="allPersonTable" maxPages="5" id="dataScrollerBottom"/>
>                         </f:facet>
>                         <r:column 
>                             filterExpression="#{fn:containsIgnoreCase(p.firstName,cc.allFirstName)}"
>                             sortBy="#{p.firstName}"
>                             sortOrder="#{cc.allFirstNameSortOrder}"
>                             >
>                             <f:facet name="header">
>                                 <h:panelGrid columns="1" style="width:100%;" columnClasses="colTop">
>                                     <h:commandLink action="#{cc.sortAllByFirstName}" >
>                                         <a:ajax render="allPersonTable at body" />
>                                         <h:outputText value="Vorname" />
>                                     </h:commandLink>
>                                     <h:inputText value="#{cc.allFirstName}"
>                                                  id="firstnameFilter"
>                                                  style="width: 75px;"
>                                                  >
>                                         <a:ajax event="keyup"
>                                                 render="allPersonTable at body "
>                                                 execute="@this"
>                                                 />
>                                         <a:ajax event="blur"
>                                                 render="dataScrollerTop dataScrollerBottom"
>                                                 execute="@this"
>                                                 />
>                                     </h:inputText>
>                                 </h:panelGrid>
>                             </f:facet>
>                             <h:outputText value="#{p.firstName}" />
>                         </r:column>
>                         <r:column  
>                             filterExpression="#{fn:containsIgnoreCase(p.lastName,cc.allLastName)}"
>                             sortBy="#{p.lastName}"
>                             sortOrder="#{cc.allLastNameSortOrder}"
>                             >
>                             <f:facet name="header">
>                                 <h:panelGrid columns="1"
>                                              style="width: 100%;"
>                                              columnClasses="colTop">
>                                     <h:commandLink action="#{cc.sortAllByLastName}" >
>                                         <a:ajax render="allPersonTable at body" />
>                                         <h:outputText value="Nachname" />
>                                     </h:commandLink>
>                                     <h:inputText value="#{cc.allLastName}"
>                                                  id="lastnameFilter"
>                                                  style="width:75px;"
>                                                  >
>                                         <a:ajax event="keyup"
>                                                 render="allPersonTable at body "
>                                                 execute="@this"
>                                                 />
>                                     </h:inputText>
>                                 </h:panelGrid>
>                             </f:facet>
>                             <h:outputText value="#{p.lastName}" />
>                         </r:column>
>                         <r:column>
>                             <f:facet name="header">
>                                 <h:outputText value="Auswahl" />
>                             </f:facet>
>                             <h:panelGroup id="addBtnGroup">
>                                 <h:commandButton value="add"
>                                                  action="#{cc.add(p)}"
>                                                  disabled="#{cc.attrs.selection.contains(p)}"
>                                                  id="addBtn" >
>                                     <f:ajax event="action" render=":#{cc.clientId}:selectedPersonTable @this #{cc.attrs.refresh}" />
>                                 </h:commandButton>
>                             </h:panelGroup>
>                         </r:column>
>                     </r:extendedDataTable>
>                 </r:panel>
>                 <r:panel header="Auswahl" id="selection" style="text-align: center;">
>                     <r:extendedDataTable  
>                         value="#{cc.attrs.selection}"
>                         var="p" id="selectedPersonTable"
>                         rows="10" style="width: 100%"
>                         selectionMode="none"
>                         >
>                         <f:facet name="header">
>                             <r:dataScroller for="selectedPersonTable" id="selectedDataScrollerTop" maxPages="5" />
>                         </f:facet>
>                         <f:facet name="footer">
>                             <r:dataScroller for="selectedPersonTable" id="selectedDataScrollerBottom" maxPages="5" />
>                         </f:facet>
>                         <r:column
>                             filterExpression="#{fn:containsIgnoreCase(p.firstName,cc.selectedFirstName)}"
>                             sortBy="#{p.firstName}"
>                             sortOrder="#{cc.selectedFirstNameSortOrder}"
>                             >
>                             <f:facet name="header">
>                                 <h:panelGrid columns="1" style="width:100%;" columnClasses="colTop">
>                                     <h:commandLink action="#{cc.sortSelectedByFirstName}" >
>                                         <a:ajax render="selectedPersonTable at body" />
>                                         <h:outputText value="Vorname" />
>                                     </h:commandLink>
>                                     <h:inputText value="#{cc.selectedFirstName}"
>                                                  id="firstnameFilter"
>                                                  style="width: 75px;"
>                                                  >
>                                         <a:ajax event="keyup"
>                                                 render="selectedPersonTable at body "
>                                                 execute="@this"
>                                                 />
>                                         <a:ajax event="blur"
>                                                 render="selectedDataScrollerTop selectedDataScrollerBottom"
>                                                 execute="@this"
>                                                 />
>                                     </h:inputText>
>                                 </h:panelGrid>
>                             </f:facet>
>                             <h:outputText value="#{p.firstName}" />
>                         </r:column>
>                         <r:column
>                             filterExpression="#{fn:containsIgnoreCase(p.lastName,cc.selectedLastName)}"
>                             sortBy="#{p.lastName}"
>                             sortOrder="#{cc.selectedLastNameSortOrder}">
>                             <f:facet name="header">
>                                 <h:panelGrid columns="1"
>                                              style="width: 100%;"
>                                              columnClasses="colTop">
>                                     <h:commandLink action="#{cc.sortSelectedByLastName}" >
>                                         <a:ajax render="selectedPersonTable at body" />
>                                         <h:outputText value="Nachname" />
>                                     </h:commandLink>
>                                     <h:inputText value="#{cc.selectedLastName}"
>                                                  id="lastnameFilter"
>                                                  style="width:75px;"
>                                                  >
>                                         <a:ajax event="keyup"
>                                                 render="selectedPersonTable at body "
>                                                 execute="@this"
>                                                 />
>                                     </h:inputText>
>                                 </h:panelGrid>
>                             </f:facet>
>                             <h:outputText value="#{p.lastName}" />
>                         </r:column>
>                         <r:column>
>                             <f:facet name="header">
>                                 <h:outputText value="" />
>                             </f:facet>
>                             <h:panelGroup id="removeBtnGroup">
>                                 <h:commandButton   value="remove"
>                                                    action="#{cc.remove(p)}"
>                                                    id="removeBtn" >
>                                     <f:ajax event="action"
>                                             render=":#{cc.clientId}:allPersonTable :#{cc.clientId}:selectedPersonTable #{cc.attrs.refresh}"
>                                             />
>                                 </h:commandButton>
>                             </h:panelGroup>
>                         </r:column>
>                     </r:extendedDataTable >
>                 </r:panel>
>               </h:panelGrid>
>         </div>
>     </cc:implementation>
> </html>
> {code}
> -----
> And there's the place I use it: 
> -----
> {code}
> <o:MultiplePersonSelection all="#{ivb.persons}" selection="#{ivb.selection}" refresh="">
>     <f:ajax event="addPerson" render=":myForm:listing" />
>     <f:ajax event="removePerson" render=":myForm:listing" />
> </o:MultiplePersonSelection>
> <h:panelGroup  id="listing">
>     <h:dataTable value="#{ivb.selection}" var="p" id="liste">
>         <h:column>#{p.firstName}</h:column>
>         <h:column>#{p.lastName}</h:column>
>     </h:dataTable>
> </h:panelGroup>
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the richfaces-issues mailing list