here is my short situation.
I have a page with datatable and several buttons supported by bean. The bean must be initialized with some default properties. These properties can be changed depending on the action. I started with the annotated RequestScoped Bean and @PostConstruct method. but it seems that datatable only works well with the viewport (session). Now my setup looks like this:
@ManagedBean @ViewScoped public class ProductsTableBean implements Serializable { private LazyDataModel<Products> productsData; @Inject private ProductsFacade model; public void onPageLoad() {
and a snippet from the jsf page:
<p:commandButton action="#{productsTableBean.addRow()}" title="save" update="@form" process="@form" > </p:commandButton> ... <f:metadata> <f:event type="preRenderView" listener="#{productsTableBean.onPageLoad}"/> </f:metadata>
And here the main problem arises in the order of the call, I have the following output:
onPageLoad called addRow called onPageLoad called <-- :(
But I want addRow to be the last action to be called, for example:
onPageLoad called addRow called
Any simple solution here?
source share