5 Replies Latest reply on Jan 21, 2011 11:23 AM by kpoudosu

    excelExporter - dataTable; only getting headers

      I'm testing the dataTable to Excel feature introduced in Seam 2.1; I'm calling it done in the Seam-Excel example.  I got it to prompt the user for an Excel file download but only the data table headers are showing up in the Excel file.


      My commandLink to export the table is:


      <h:commandLink styleClass="button" id="exportAddresses" 
       value="Export"
      action="#{excelExporter.export('listOfAddresses:addresses')}" />



      Even though there is data in the table, it's not appearing in the resulting Excel exported file.  Is there anyway to tell what is going on and how to resolve this problem?


      The underlying data table is a RichFaces 3.2.2GA data table found to a <List>.


      Could this problem be conversation related?


      Thank you.

        • 1. Re: excelExporter - dataTable; only getting headers

          Depending on your richfaces data, it might not work. Try a regular h:dataTable

          • 2. Re: excelExporter - dataTable; only getting headers

            Daniel,


            I've been able to get the exporter to work with RF data tables except in the following two circumstances (either or, not sure at this point):
            1) A facelet (ui:include) is used within a rich:column
            2) The data value for the column calls an @Transient method.
            3) Both of the above.


            Example of facelet:



            <rich:column sortBy="#{address.fullAddress}" selfSorted="#{!englinkUtil.isPrintDecorator(facesContext)}">
            <f:facet name="header">
            <h:outputText value="Address" />
            </f:facet>
            <!--  Include Full Address template -->
            <ui:include src="/layout/objects/fullAddress.xhtml" >
            <ui:param name="address" value="#{address}" />
            </ui:include>
            </rich:column>



            The @Transient method called above:


            @Transient
                 public String getFullAddress()
                 {
                      String address;
                      
                      address = this.postOfficeBox + " " + this.primaryAddressLine + " " + this.secondaryAddressLine;
                      address += " " + this.city;
                      
                      if (this.country.getName() == "US")
                           address += ", " + this.state + " " + this.zipCode;
                      else
                           address += ", " + this.country.getName() + " " + this.zipCode;
                      
                      return address;
                 }





            With your knowledge of the Excel exporter, would you say that you know issue might be the culprit?  And, furthermore, do you think there would be a work-around possible or perhaps a necessary fix for a future version?


            Thanks for your time!

            • 3. Re: excelExporter - dataTable; only getting headers
              nickarls

              Post separate JIRAs with xhtml + backing beans that can be dropped into the excel example. Stepping through it with a debugger should reveal some insights.

              • 4. Re: excelExporter - dataTable; only getting headers

                1) We do something like getDataTable().getValue().getWrappedData(). If it isn't a of the types supported (DataModel, List, Collection etc.) it won't work. Then we process that data for each UIColumn. In case of a rich:column it might be problem since it is possible to have colspans and so forth. Look at the excel example. It has a fully working exportable richfaces table.


                2) Se above. We do just that. If JSF for some reason doesn't get the transient data, we won't either.


                It's no magic on excel's behalf, we just get the data that represents the table.

                • 5. Re: excelExporter - dataTable; only getting headers
                  kpoudosu

                  Please how did you get it to work, exporting all the contents including the header, i am facing the same issue...


                  Thanks