I have a datagrid with pagination. When I change the page I want to update some components in the page, but I don't know how to get the event. Some code:
<p:panelGrid id="buttons">
<p:commandLink value="Link1" action="#{myBean.method1}" disabled="#{myBean.boolean1}" />
<p:commandLink value="Link2" action="#{myBean.method2}" disabled="#{myBean.boolean2}" />
</p:panelGrid>
<p:dataGrid var="myVar" paginator="true" value="#{myBean.listOfObjects}">
...
...
</p:dataGrid>
I want something like update="buttons"
in the dataGrid, so when the page changes, update the buttons depending on disabled=""
attribute of the buttons, is it possible?
Greetings.
Finally, instead of <p:dataGrid ... />
i used <p:dataTable ... />
with <p:ajax ... />
inside, this is my code:
<p:dataTable var="myVar" paginator="true" rows="1" value="#{myBean.listOfObjects}">
<p:ajax event="page" update="buttons" listener="#{myBean.update}" />
...
...
</p:dataTable>
And update
method:
public void update(PageEvent event) {
int var = event.getPage();
...
(update components values of dataTable and buttons using var)
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With