I would like to make my <p:dataGrid>
pagination automatic. Without using the next button, move to the next page in few seconds.
<p:dataGrid id="cars" var="of" value="#{infoBaseOfVals.listinfoBaseOf}"
columns="2" rows="4" layout="grid" paginator="true" cellpadding="10"
cellspacing="20px" scrolling="false" responsive="true" type="unordered" itemType="none"
paginatorTemplate="Nombre OFs : #infoBaseOfVals.listinfoBaseOf.size()} OFs {CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="2,4,8,16,24,32,40,48,56,64,72,80">
How can I achieve this?
For recent versions of PrimeFaces (at least 6.0, but maybe also some before) You can achieve that with a little javascript. Set the widgetVar attribute to your dataGrid and add something like this:
For older PrimeFaces version (if this does not work) see the other answer
For older versions of PrimeFaces it works with javaScript this is the script