Good morning,
I need to select all the data from a table (it has pagination).
Code:
<p:dataTable id="datos"
var="f"
rowKey="#{f.num}"
resizableColumns="true"
value="#{busquedaBean1.fuente}"
selection="#{busquedaBean1.selectedFuentes}"
style="margin-bottom:0;margin-top: 0%;"
paginatorTemplate="{CurrentPageReport}
{FirstPageLink} {PreviousPageLink}
{PageLinks} {NextPageLink} {LastPageLink}" >
<!-- CONTENIDO DE LA TABLA -->
<p:ajax event="rowSelect" global="true" listener="#{busquedaBean1.selectedFuentes}" />
<p:ajax event="rowUnselect" global="true" listener="#{busquedaBean1.selectedFuentes}" />
<p:column headerText="Nombre" style="width:80%;" sortBy="#{f.nombre}">
<h:outputText value="#{f.nombre}" />
</p:column>
<p:column headerText="Fecha" style="width:108%;" sortBy="#{f.fecha}" >
<h:outputText value="#{f.fecha}" />
</p:column>
<p:column headerText="Bloqueo" width="65" sortBy="#{f.bloqueo}">
<h:outputLabel value="#{f.bloqueo}" rendered="#{empty f.fechaBloqueo}" style="padding: 0 20%;"/>
<p:commandButton value="#{f.bloqueo}" rendered="#{ not empty f.fechaBloqueo}" id="detBloqueo" update=":form:carDetail" oncomplete="PF('carDialog').show()" icon="ui-icon-search" title="Mostrar detalles" style="background: transparent; color:#4297d7;border: 0px;" styleClass="detalles">
<f:setPropertyActionListener value="#{f}" target="#{busquedaBean1.autor}" />
</p:commandButton>
</p:column>
<p:column width="16" >
<h:commandLink title="Descargar" target="_blank" actionListener="#{descargarFormaBean.descargar(f.forma,f.nombre)}">
<span class="ui-button-icon-left ui-icon ui-icon-arrowthickstop-1-s" style="text-align:center;"></span>
</h:commandLink>
</p:column>
<p:column headerText="Directorio" width="190" sortBy="#{f.directorio}">
<p:commandButton value="#{f.dir}" id="detDirectorio" update=":form:dirDetail" oncomplete="PF('dirDialog').show()" title="Mostrar detalles" style="background: transparent; color:black;border: 0px;" styleClass="detalles">
<f:setPropertyActionListener value="#{f}" target="#{busquedaBean1.autor}" />
</p:commandButton>
</p:column>
<p:column id="SelectFuentes" style="width:16%;text-align:center" selectionMode="multiple" exportable="false" >
</p:column>
</p:dataTable>
When selecting the CheckBox of the column to select all the data, it does not select the other pages, it only selects the page that is active (the one that the user is seeing), and I need it to select everything.
NOTE: I was investigating and it says that it is a bug in the version of primefaces 5.1 but I'm not sure.
Thank you so much.
I already found the solution:
Code:
We have to create that ajax method, then we go to our Bean.java (in my case it is
busquedaBean1
and we call the java method:Code: