0 Replies Latest reply on Jul 18, 2011 2:32 AM by Paul Cedar

    extendedtable selection is not working in popuppanel

    Paul Cedar Newbie

      hi,

      I am facing problem using selection feature in the extended datatable, whilest it is in a popupanel. I have binded my page with a backbean that contains a selection listener. The listener is fired when i select the a row in the table, but the selected row is not saved in the propety related.

      Plz help.

       

      <!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:h="http://java.sun.com/jsf/html"

                xmlns:a4j="http://richfaces.org/a4j"

                xmlns:rich="http://richfaces.org/rich"

                xmlns:f="http://java.sun.com/jsf/core"

                xmlns:ui="http://java.sun.com/jsf/facelets">

       

       

      <h:head></h:head>

      <body>

                <h:form>

                          <rich:panel auotsized="true">

                                    <f:facet name="header">

                                              <h:outputText value="Agents in Project" />

                                    </f:facet>

                                    <rich:dataTable value="#{teamsBean.projectAgents}" var="rowItem"

                                              id="teamstbl">

                                              <rich:column>

                                                        <f:facet name="header">

                                                                  <h:outputText value="Name" />

                                                        </f:facet>

                                                        <h:outputText value="#{rowItem.name}" />

                                              </rich:column>

                                              <rich:column>

                                                        <f:facet name="header">

                                                                  <h:outputText value="First Name" />

                                                        </f:facet>

                                                        <h:outputText value="#{rowItem.firstName}" />

                                              </rich:column>

                                              <rich:column>

                                                        <f:facet name="header">

                                                                  <h:outputText value="Daily Cost" />

                                                        </f:facet>

                                                        <h:outputText value="#{rowItem.producedCostAgentDay}" />

                                              </rich:column>

                                              <rich:column>

                                                        <a4j:commandLink styleClass="no-decor" execute="@this"

                                                                  render="@none"

                                                                  oncomplete="#{rich:component('confirmPane')}.show()">

                                                                  <h:graphicImage value="/images/icons/delete.gif" alt="delete" />

                                                                  <f:setPropertyActionListener target="#{teamsBean.workingItem}"

                                                                            value="#{rowItem}" />

                                                        </a4j:commandLink>

       

       

                                                        <a4j:commandLink styleClass="no-decor" render="editGrid"

                                                                  execute="@this" oncomplete="#{rich:component('editPane')}.show()">

                                                                  <h:graphicImage value="/images/icons/edit.gif" alt="edit" />

                                                                  <f:setPropertyActionListener target="#{teamsBean.workingItem}"

                                                                            value="#{rowItem}" />

                                                        </a4j:commandLink>

                                              </rich:column>

                                    </rich:dataTable>

                          </rich:panel>

       

       

                          <a4j:jsFunction name="remove1" action="#{teamsBean.removeTeam}" />

       

       

                          <rich:toolbar width="10" height="10">

                                    <a4j:commandButton value="insert" execute="@form"

                                              oncomplete="#{rich:component('selectionPane')}.show()" />

                          </rich:toolbar>

       

       

                          <rich:popupPanel id="statPane" autosized="true">

                                    <h:graphicImage value="/images/icons/ai.gif" alt="ai" />Please wait...

                          </rich:popupPanel>

       

       

                          <rich:popupPanel id="confirmPane" autosized="true"> Are you sure you want to delete the row?

                        <a4j:commandButton value="Cancel"

                                              onclick="#{rich:component('confirmPane')}.hide(); return false;" />

                                    <a4j:commandButton value="Delete" onclick="remove1(); return false;" />

                          </rich:popupPanel>

       

       

                          <rich:popupPanel header="Edit Teams Details" id="editPane"

                                    domElementAttachment="parent" autosized="true">

                                    <h:panelGrid columns="2" id="editGrid">

       

       

                                              <h:outputText value="Name" />

                                              <h:outputText value="#{teamsBean.workingItem.name}" />

       

       

                                              <h:outputText value="First Name" />

                                              <h:outputText value="#{teamsBean.workingItem.firstName}" />

       

       

                                              <h:outputText value="Daily Cost" />

                                              <h:inputText value="#{teamsBean.workingItem.producedCostAgentDay}"

                                                        id="prdCost" />

       

       

                                    </h:panelGrid>

       

       

                                    <a4j:commandButton value="Store" action="#{teamsBean.editTeam}"

                                              render="table" execute="editPane"

                                              oncomplete="if (#{facesContext.maximumSeverity==null}) {#{rich:component('editPane')}.hide();}" />

                                    <a4j:commandButton value="Cancel"

                                              onclick="#{rich:component('editPane')}.hide(); return false;" />

                          </rich:popupPanel>

       

       

       

       

       

       

       

       

                          <rich:popupPanel id="selectionPane" autosized="true">

                                    <f:facet name="header">

                                              <h:outputText value="Available Team" />

                                    </f:facet>

                                    <rich:extendedDataTable id="selectionTable"

                                              value="#{agentsBean.listofAgents}" var="item"

                                              selection="#{teamsBean.selection}" selectionMode="single">

                                              <a4j:ajax execute="@form" event="selectionchange"

                                                        listener="#{teamsBean.selectionListener}" />

       

       

                                              <rich:column>

                                                        <f:facet name="header">

                                                                  <h:outputText value="Name" />

                                                        </f:facet>

                                                        <h:outputText value="#{item.name}" />

                                              </rich:column>

                                              <rich:column>

                                                        <f:facet name="header">

                                                                  <h:outputText value="First Name" />

                                                        </f:facet>

                                                        <h:outputText value="#{item.firstName}" />

                                              </rich:column>

                                    </rich:extendedDataTable>

       

       

                                    <a4j:commandButton value="Insert" render="table"

                                              execute="selectionPane" action="#{teamsBean.addTeam}"

                                              oncomplete="if (#{facesContext.maximumSeverity==null}) {#{rich:component('insertPane')}.hide();}" />

                                    <a4j:commandButton value="Cancel"

                                              onclick="#{rich:component('selectionPane')}.hide(); return false;" />

       

       

                          </rich:popupPanel>

                </h:form>

      </body>

      </html>

      thanks in advance.