0 Replies Latest reply on Dec 15, 2012 10:47 AM by kotuboy

    rich:extendedDataTable does not deliver the selected object

    kotuboy

      I have the following extendeddatatable.

       

      I click on the button  --> <a4j:commandLink value="#{msg['documentPopup.docDownload']}"  (see below)

      It sends sometimes the correct object (the selected object) to backend. Sometimes it sends a null object

      Actually I expect if I click on´the button, it should read the right object.

       

      Where is the problem??

       

       

      <rich:extendedDataTable id="documentTable"

                                                                                      value="#{documentPopup.documentList}" var="document"

                                                                                      rowClasses="whiteRow, titaniumRow"

                                                                                      selection="#{documentPopup.selection}" selectionMode="single"

                                                                                      style="table-layout:fixed;height: 150px; width: 640px;">

       

                                                                                      <a4j:ajax render="inputGrid"

                                                                                                listener="#{documentPopup.tableRowSelect}" event="selectionchange" />

       

                                                                                      <rich:column id="docName"

                                                                                                sortBy="#{document.name}"

                                                                                                sortOrder="#{documentPopup.documentNameOrder}"

                                                                                                filterValue="#{documentPopup.documentNameFilter}"

                                                                                                filterExpression="#{fn:containsIgnoreCase(document.name, documentPopup.documentNameFilter)}">

                                                                                                <f:facet name="header">

                                                                                                          <a4j:commandLink value="#{msg['documentPopup.name']}"

                                                                                                                    render="documentTable"

                                                                                                                    action="#{documentPopup.sortByDocumentName}" />

                                                                                                          <h:inputText value="#{documentPopup.documentNameFilter}" styleClass="SelectorTextBox80px">

                                                                                                                    <a4j:ajax event="keyup"

                                                                                                                              render="documentTable@body" execute="@this" />

                                                                                                          </h:inputText>

                                                                                                </f:facet>

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

                                                                                      </rich:column>

      ....

       

                                                                                      <rich:column id="docAction">

                                                                                                <f:facet name="header">

                                                                                                          <h:outputText value="#{msg['documentPopup.docAction']}" />

                                                                                                </f:facet>

                                                                                                          <a4j:commandLink value="#{msg['documentPopup.docDelete']}"

                                                                                                                    action="#{documentPopup.doDocumentDelete}" render="documentTable inputGrid" />

                                                                                                          <a4j:commandLink value="#{msg['documentPopup.docUpdate']}"

                                                                                                                    action="#{documentPopup.doDocumentUpdate}" render="documentTable inputGrid" />

                                                                                                          <a4j:commandLink value="#{msg['documentPopup.docDownload']}"

                                                                                                                    action="#{documentPopup.doDocumentDownload}" />

                                                                                      </rich:column>

                                                                            </rich:extendedDataTable>

       

       

      The Mangedbean looks like (related part):

       

          public void doDocumentDownload() {

              System.out.println("selectedDocument:" + selectedDocument);        ---------------------------------------->

              System.out.println("selectedDocument.getId()" + selectedDocument.getId()); ----------------------------->sometimes correct sometime 0

              final byte[] docData = documentFacade.readDocument(selectedDocument.getId());

              openPDF(selectedDocument.getName(), docData);

          }