0 Replies Latest reply on Oct 5, 2007 5:10 AM by orribl

    Popup problem

      Hi,
      I want to print a rich:dataTable (with rich:dataScroller) and therefore I want to open a popup with this dataTable. I do this using a commandLink with javascript. I want to offer 2 printing options: 'print current page' and 'print all':

      <a4j:commandLink
       style="padding:5px"
       action="#{mse.printPage}"
       oncomplete="window.open(
       'mse_print.faces',
       'popupWindowName',
       'dependent=yes, menubar=no, toolbar=no, scrollbars=yes'
       );"
       value="#{msg.print_page}"
      />
      <a4j:commandLink
       style="padding:5px"
       action="#{mse.printAll}"
       oncomplete="window.open(
       'mse_print.faces',
       'popupWindowName',
       'dependent=yes, menubar=no, toolbar=no, scrollbars=yes'
       );"
       value="#{msg.print_all}"
      />

      Here are the 2 methods:
      public void printAll() {
       try{
       //Backing bean with print datatable
       Print print = new Print();
       //Create new HtmlDataTable
       HtmlDataTable htmlDataTable = new HtmlDataTable();
       //Set value of created dataTable
       htmlDataTable.setValue(this.mseItems);
       //Put backing bean to sessionMap
       FacesContext.getCurrentInstance().
       getExternalContext().getSessionMap().put("print", print);
       } catch ( Exception ex ){
       ex.printStackTrace();
       }
       }
      }
      ...
      //2nd method is similar
      

      When I click the link, the popup opens and everything works fine.
      when I close the popup and send a new ajax-request to the server, an alert-message appears: 'viewstate could't be restored'.
      I'm using Richfaces 3.0.1; I also tried 3.1.0 and it worked, but I couldn't use it because of the problem described here: http://jboss.com/index.html?module=bb&op=viewtopic&t=120099