In a <p:dataTable>
with paginator, I need to print all the pages. When I use <p:printer>
and give the datatable as target, it only prints first page with pagination controls. How can I print all the rows of the table with <p:printer>
?
相关问题
- java.lang.NullPointerException at java.io.PrintWri
- java.lang.NullPointerException at java.io.PrintWri
- h:selectOneMenu in p:dataTable doesn't submit
- h:selectOneMenu in p:dataTable doesn't submit
- PrimeFaces block UI does not work when the compone
相关文章
- System.OutOfMemoryException:“数组维度超过了支持的范围。”
- Print background image on every page once
- Python: print in two columns
- Rounding decimals in nested data structures in Pyt
- How to control print font size
- How to allow numbers only using f:validateRegex
- Selecting all visible rows after a search using
- JSF 2.0: ajax request when press ENTER
Ok, I was actually able to achieve the desired behavior but in a very unpleasant way.
First of all, it seems that
p:printer
just takes a DOM element by an id from a xhtml page and passes it to a printer. So, to be able to print a full table it first should be re-rendered.My idea was to re-render table without paginator, refresh it and pass to the printer and after that to restore table's state. To be able to do so I created two buttons: one that triggers the table re-rendering, and other that passes this table to a printer and restores it's state.
First button is visible and is the button a user presses to print. It calls the
deactivatePaginator()
method to disable pagination and prepare table view for printing. Second button is hidden and is the actual button to containp:printer
component. It calls theactivatePaginator()
method to restore table view.Here is the resulting xhtml page:
Methods' realisation is pretty simple. All is needed to do is to set
paginatorActive
flag accordingly.All this madness could be covered by
p:blockUI
as multiple table update causes a quick glitch.This solution is proposed as workaround and I don't think is a proper way to do things. But I also don't think there is another way to do what is required using
p:printer
.