richfaces DataScroller not working - jsf

I am trying to implement datascroller in richfaces 3.1.4 with JSF 1.2 but the datascroller is not working properly though it is showing the no of pages.Here is the code :
<rich:dataTable width="150 px" id="listOfServiceId" rows="#{posManageOrderBean.count}" columnClasses="col"
value="#{posManageOrderBean.customerProjectServiceIds}" var="serviceIDs"
headerClass="dr-stglpnl-h" rowClasses="evenrow,oddrow">
<h:column>
<f:facet name="header">
<h:outputText value="Service Id" rendered="true" />
</f:facet>
<h:commandLink value="#{serviceIDs.serviceID}" action="#{posManageOrderBean.showAllServiceIdAttr}" >
<f:param name="serviceId" value="#{serviceIDs.serviceID}"> </f:param>
</h:commandLink>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Copf Id" rendered="true" />
</f:facet>
<h:outputText value="#{serviceIDs.copfID}" rendered="true" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Service Id" rendered="true" />
</f:facet>
<h:outputText value="#{serviceIDs.customerProjectName}" rendered="true" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Service Id" rendered="true" />
</f:facet>
<h:outputText value="#{serviceIDs.customerName}" rendered="true" />
</h:column>
<f:facet name="footer">
<h:panelGrid>
<rich:datascroller maxPages="20" id="sc1" for="listOfServiceId" reRender="listOfServiceId"></rich:datascroller>
</h:panelGrid>
</f:facet>
</rich:dataTable>

Related

DataExporter tag - PrimeFaces - page only = "false"

I'm trying to export data from DataTable using DataExporter tag, but, DataExporter is exporting only first page data (page of the print), but I want to export data from all pages.
See below my button code and the screen.
Code:
<p:dataTable id="listaConsulta" rowStyleClass="#{empty rowIx or rowIx mod 2 ne 0 ? 'jsfcrud_odd_row' : 'jsfcrud_even_row'}" rowIndexVar="rowIx" value="#{funcionarioController.items}" var="item">
<p:column>
<f:facet name="header">
<h:outputText value="Código"/>
</f:facet>
<h:outputText value="#{item.codigo}"/>
</p:column>
<p:column width="25%">
<f:facet name="header">
<h:outputText value="Nome"/>
</f:facet>
<h:outputText value="#{item.nome}"/>
</p:column>
<p:column width="10%">
<f:facet name="header">
<h:outputText value="Cpf"/>
</f:facet>
<h:outputText value="#{item.cpf}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Nascimento"/>
</f:facet>
<h:outputText value="#{item.datanascimento}">
<f:convertDateTime pattern="dd/MM/yyyy" />
</h:outputText>
</p:column>
<p:column width="25%">
<f:facet name="header">
<h:outputText value="Cargo"/>
</f:facet>
<h:outputText value="#{item.cargo.descricao}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Telefone"/>
</f:facet>
<h:outputText value="#{item.fone}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Celular"/>
</f:facet>
<h:outputText value="#{item.celular}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Ativo"/>
</f:facet>
<h:outputText value="#{item.estaAtivo}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="" />
</f:facet>
<h:commandLink title="Editar" action="Create?faces-redirect=true&includeViewParams=true">
<f:setPropertyActionListener value="#{item}" target="#{funcionarioController.selected}"/>
<h:graphicImage height="32" value="/image/file_edit.png" />
</h:commandLink>
<h:commandLink title="Ficha Registro" target="_blank" action="#{funcionarioController.gerarRelatorioJasper}">
<f:setPropertyActionListener value="#{item}" target="#{funcionarioController.selected}"/>
<p:graphicImage value="/image/pdf.png" />
</h:commandLink>
</p:column>
</p:dataTable>
</h:panelGroup>
<br />
<p:commandButton ajax="false" immediate="true" action="#{funcionarioController.prepareCreate()}" value="#{bundle.ListFuncionarioCreateLink}"/>
<p:spacer width="10px"/>
<p:commandButton value ="Gerar Excel" ajax="false">
<p:dataExporter type="xls" target="listaConsulta" fileName="dadosFuncionarios" encoding="utf-8" pageOnly="false"/>
</p:commandButton>
Screen:
How do I solve this?
EDIT: I change the code inserting datatable and dataexporter entire code.

How to inject div in JSF datatable excluding header

I have added a custom scrollbar in my JSF datatable and it looks like that:
My code is this:
<div class="verticalScrollbar" style="max-height:330px;">
<h:dataTable var="entity" value="#{entityBean.entities}"
styleClass="datatable"
headerClass="datatable-header"
rowClasses="datatable-odd-row,datatable-even-row">
<h:column>
<f:facet name="header">
<h:outputText value="Field 1" />
</f:facet>
<h:outputText value="#{entity.field1}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Field 2" />
</f:facet>
<h:outputText value="#{entity.field2}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Field 3" />
</f:facet>
<h:outputText value="#{entity.field3}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Field 4" />
</f:facet>
<h:outputText value="#{entity.field4}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Field 5" />
</f:facet>
<h:outputText value="#{entity.field5}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Field 6" />
</f:facet>
<h:outputText value="#{entity.field6}" />
</h:column>
</h:dataTable>
</div>
<script>
(function($){
$(window).load(function(){
$(".verticalScrollbar").mCustomScrollbar({
scrollButtons:{ enable:false },
horizontalScroll:false,
advanced:{ updateOnBrowserResize:true, updateOnContentResize:true }
});
});
})(jQuery);
</script>
The verticalScrollbar div contains the whole datatable including the header, so when I scroll down the table, I cannot see the header, like that:
How can I apply my scrollbar only to the body of the table excluding the header, so that the header stays still, while only the body scrolls down?

Conditional column rendering

I'm working with jsf 2.0. I have this datatable
<h:dataTable value="#{agreement.licenseProducts}"
var="licenseProduct"
styleClass="pnx-table pnx-table-bdr pnx-table-unstyled mp-license-info">
<h:column>
<f:facet name="header">
<h:outputText value="Product" />
</f:facet>
<h:outputText value="#{licenseProduct.description}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Serial Number" />
</f:facet>
<h:outputText value="#{licenseProduct.serialNumber}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{agreement.labelForConcurrency}" />
</f:facet>
<h:outputText value="#{licenseProduct.concurrent}" />
</h:column>
<ui:fragment rendered="#{agreement.managementTool != 'NONE'}">
<h:column>
<f:facet name="header">
<h:outputText value="#{agreement.labelForLicenseType}" />
<span class="pnx-icon-right pnx-icon-info pnx-tooltip">
<div class="pnx-tooltip-content">
<h:outputText value="Tooltip content" />
</div>
</span>
</f:facet>
<h:outputText value="#{licenseProduct.licenseBase}" />
</h:column>
</ui:fragment>
<h:column>
<f:facet name="header">
<h:outputText value="#{agreement.labelForSeatCount}" />
</f:facet>
<h:outputText value="#{licenseProduct.seats}" />
</h:column>
</h:dataTable>
The problem is that the ui:fragment part is not working. No matter what the attribute's value is, it will NEVER show the column.
Any ideas?
--EDIT--
Just in case, I have other ui:fragments that depend on that same attribute, and they do render correctly depending on the attribute's value. I'm sure it has to do with the dataTable and the columns.
The rendered's attribute of <h:column> tag performs simply the job :
<h:column rendered="#{agreement.managementTool != 'NONE'}">
...
</h:column>

rich:extendedDataTable with dynamic columns

I want to fill a rich:extendedDataTable with a static columns and dynamic columns in RichFaces 4.2
I tried following code,but it's not working for me :
<rich:extendedDataTable id="listDipRec"
iterationStatusVar="itDipRec" rows="200"
value="#{declarationReglementaireModel.detailCurrentDecReg.decReg.listLigneDipRecsDTO}"
var="ligneDipRec" frozenColumns="1"
style="height:300px; width:800px;" selectionMode="none">
<rich:column width="35px">
<h:panelGrid columns="1" cellpadding="2">
<a4j:commandLink render="editGridDipRec" execute="#this"
oncomplete="#{rich:component('modifDipRec')}.show()">
<span class="icone icone-edit icone-align-center" />
<a4j:param value="#{itDipRec.index}"
assignTo="#{declarationReglementaireModel.currentLigneDipRecIndex}" />
<f:setPropertyActionListener
target="#{declarationReglementaireModel.currentLigneDipRec}"
value="#{ligneDipRec}" />
</a4j:commandLink>
</h:panelGrid>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="Date ligne fichier Dip" />
</f:facet>
<h:outputText value="#{ligneDipRec.dtLigneDipRec}">
<f:convertDateTime pattern="dd/MM/yyyy" timeZone="Europe/Paris" />
</h:outputText>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="Référence titre" />
</f:facet>
<h:outputText value="#{ligneDipRec.rfTitre}">
</h:outputText>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="Origine titre" />
</f:facet>
<h:outputText value="#{ligneDipRec.lbOrigineLigne}">
</h:outputText>
</rich:column>
<c:forEach items="#{ligneDipRec.listDonneeDipRecDTO}" var="column"
varStatus="status">
<rich:column>
<f:facet name="header">
<h:outputText value="Valeur rubrique" />
</f:facet>
<h:outputText value="#{declarationReglementaireModel.getColumnData(ligneDipRec,column).lbValeurRubrique}" />
</rich:column>
</c:forEach>
</rich:extendedDataTable>
<c:forEach> doesn't have access to the table's variables (i.e. ligneDipRec), and unfortunately you can't do anything about it.
The good news is that whatever you put inside the forEach will have access to those variables. The only thing you need to do is to save the size of the list somewhere in the bean and then loop over it, rather than over the variable:
<c:forEach var="columnNumber" begin="0"
end="{declarationReglementaireModel.detailCurrentDecReg.decReg.listSize - 1}">

Where to keep h:messages in a h:datatable while validating two h:columns

I am using one h:selectbooleancheckbox in each row to make 2 columns editable.
Have a look at my JSF page
<h:dataTable id="editTable" styleClass = "listtable" value="#{bean.GroupList}" var="group" border="1" first="0" rows="8" width="75%" frame="hsides" rules="all" cellpadding="5" headerClass="tableheading" rowClasses="firstrow, secondrow">
<f:facet name="header">
<h:outputText value="Groups"></h:outputText>
</f:facet>
<h:column>
<f:facet name="header">
<h:outputText value="GroupId"></h:outputText>
</f:facet>
<h:outputText value="#{group.Id}" rendered="#{not bean.checked[group.Id]}"></h:outputText>
<h:inputText value="#{group.Id}" rendered="#{bean.checked[group.Id]}" required="true"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="GroupName"></h:outputText>
</f:facet>
<h:outputText value="#{group.Name}" rendered="#{not bean.checked[group.Id]}"></h:outputText>
<h:inputText value="#{group.Name}" rendered="#{bean.checked[group.Id]}" required="true"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Check to Enable/Disable"></h:outputText>
</f:facet>
<h:selectBooleanCheckbox value="#{bean.checked[group.Id]}" />
</h:column>
</h:dataTable>
I have required="true" for GroupId and GroupName columns.
I am not getting where to keep h:messages for each column to display requiredmessage
Please help.
You need to use <h:message> instead to display errors specific to an input element. The <h:messages> will display all messages which are not covered by any <h:message>.
<h:column>
<f:facet name="header">
<h:outputText value="GroupId"></h:outputText>
</f:facet>
<h:outputText value="#{group.Id}" rendered="#{not bean.checked[group.Id]}"></h:outputText>
<h:inputText id="groupId" value="#{group.Id}" rendered="#{bean.checked[group.Id]}" required="true"/>
<h:message for="groupId" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="GroupName"></h:outputText>
</f:facet>
<h:outputText value="#{group.Name}" rendered="#{not bean.checked[group.Id]}"></h:outputText>
<h:inputText id="groupName" value="#{group.Name}" rendered="#{bean.checked[group.Id]}" required="true"/>
<h:message for="groupName" />
</h:column>

Resources