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}" />
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