Hello everybody i have tabview:
<p:tabView value="#{beanPlanning.plannings}"
var="planning" id="tabview"
widgetVar="myTabView"
activeIndex="#{beanPlanning.index}"
cache="false"
>
<p:ajax event="tabChange" process="#this" listener="#{beanPlanning.elementSelected(planning.id)}" update="tabview"/>
<p:tab title="#{planning.libelle}" >
<p:panelGrid>
<ui:repeat value="#{beanPlannin.tasksFactorys}" var="tf">
<p:row>
<p:column>
<h:outputText value="#{tf.libelle}"/>
</p:column>
<p:column>
<p:selectBooleanCheckbox value="#{tf.affiche}" />
<h:outputText value="#{messages.PFafficheCheckox}" />
</p:column>
<p:column>
<p:colorPicker value="#{tf.coleur}" />
</p:column>
...
but when I want to save data it's possible save just the data of last tab!!!
Related
I use primefaces in my project and i'm facing some issues with it's components.
I have a dataTabe inside an accordion and both of them are populated with a list in my managed bean. The thing is, before I put this dataTable inside the accordion the filter used to work just fine. When it was into the accordion, actualy the results were corresponding to the filter, but if I click on a comandButton in any row the object that I get from the "f:setPropertyActionListener" is not corresponding to the list after the filter.
Edit:
-Primefaces 6.0
-Dynamic Web Module 3.0
-Java 1.7
-Mojarra JSF Implementation 2.2.3
The .xhtml:
<h:form id="frmPrincipal" enctype="multipart/form-data">
<p:toolbar style="background : none; border:0px">
<f:facet name="left">
<p:commandButton value="Novo Documento" oncomplete="PF('dlgIncluirDocumento').show();"
actionListener="#{MyBean.prepararInclusao()}" update=":frmIncDocVal:pngIncDoc
:frmIncDocVal:pnlTblEmail :frmIncDocVal:pnlEmailNvDoc" />
</f:facet>
</p:toolbar>
<p:accordionPanel dynamic="true" value="#{MyBean.grupos}" var="grupo">
<p:tab title="#{grupo.nome}">
<p:dataTable id="tbValidadeDocFiltrado" widgetVar="#{grupo.idComponente}"
emptyMessage="Nenhum registro enccontrado" lazy="false"
value="#{grupo.documentos}" var="item" filteredValue="#{grupo.documentosFiltrados}"
paginator="true" rows="30" paginatorPosition="bottom" rowsPerPageTemplate="15,30,45">
<f:facet name="header"><p:outputLabel value="Validade Documento" /></f:facet>
<p:column headerText="Empresa" sortBy="#{item.tipoDocumento.empresa.nome}" filterBy="#{item.tipoDocumento.empresa.nome}">
<f:facet name="filter">
<p:selectOneMenu onchange="PF('#{grupo.idComponente}').filter()" >
<f:selectItem itemLabel="Selecione" itemValue="#{null}"
noSelectionOption="true" />
<f:selectItems value="#{MyBean.itensEmpresa}"
var="empresa" itemValue="#{empresa.nome}"
itemLabel="#{empresa.nome}" />
</p:selectOneMenu>
</f:facet>
<p:outputLabel value="#{item.tipoDocumento.empresa.nome}" />
</p:column>
<p:column headerText="Departamento"
sortBy="#{item.tipoDocumento.departamento.nome}"
filterBy="#{item.tipoDocumento.departamento.nome}">
<f:facet name="filter">
<p:selectOneMenu onchange="PF('#{grupo.idComponente}').filter()">
<f:selectItem itemLabel="Selecione" itemValue="#{null}"
noSelectionOption="true" />
<f:selectItems value="#{MyBean.itensDepartamento}"
var="departamento" itemValue="#{departamento.nome}"
itemLabel="#{departamento.nome}" />
</p:selectOneMenu>
</f:facet>
<p:outputLabel value="#{item.tipoDocumento.departamento.nome}" />
</p:column>
<p:column headerText="Documento" sortBy="#{item.tipoDocumento.nome}"
filterBy="#{item.tipoDocumento.nome}">
<p:outputLabel value="#{item.tipoDocumento.nome}" />
</p:column>
<p:column headerText="Arquivo">
<p:commandLink title="Download" value="#{item.arquivo.nome}" ajax="false" onclick="PrimeFaces.monitorDownload(start, stop);" rendered="#{item.cadastroDocumentoDownload}" disabled="#{ ! item.icArquivo}">
<f:setPropertyActionListener value="#{item}" target="#{MyBean.validadeDocumento}" />
<p:fileDownload value="#{MyBean.fileDown}" />
</p:commandLink>
</p:column>
<p:column headerText="Opções" exportable="false" width="160">
<p:commandButton icon="ui-icon-pencil" title="Alterar"
oncomplete="PF('dialog1').show();"
disabled="false" rendered="#{item.cadastroDocumentoEditar}"
action="#{MyBean.prepararAlterarTipoDocumento()}"
update=":idTituloTpDocTituloTelaDlgAlt :frmAltTpDoc:pngAltDoc">
<f:setPropertyActionListener value="#{item}" target="#{MyBean.validadeDocumento}" />
</p:commandButton>
</p:column>
</p:dataTable>
</p:tab>
</p:accordionPanel>
</h:form>
Print with the command button working:
Print with the command button not working after filter:
I have an List of List. lets say student and address. one to many relationship. In my data table there are 3 columns for the Name, Surname, Age related to the Student and In a single column I need to show address with concatenating the following fields like, address1, address2, city, country.Now I need to export this table by using <p:dataExporter>. When I try to export as Excel the corresponding column of Address is exported as Object (org.primefaces.uirepeat. blah blah..)
My code is
<p:dataTable value="#{manager.studentList}" var="item" id="studentData">
<p:column>
<f:facet name="header">Name</f:facet>
<h:outputText value="#{item.name}" />
</p:column>
<p:column>
<f:facet name="header">Surname</f:facet>
<h:outputText value="#{item.surname}" />
</p:column>
<p:column>
<f:facet name="header">Age</f:facet>
<h:outputText value="#{item.age}" />
</p:column>
<p:column>
<f:facet name="header">Address</f:facet>
<ui:repeat value="#{studentBean.addressList}" var="address">
<h:outputText value="#{address.address1}" /> <br />
<h:outputText value="#{address.address2}" /> <br />
<h:outputText value="#{address.city}" /> <br />
<h:outputText value="#{address.country}" />
</ui:repeat>
</p:column>
</p:dataTable>
<h:commandLink>
<p:graphicImage name="/images/excel.png" />
<p:dataExporter type="xls" target="studentData" fileName="studentdetails" pageOnly="true"/>
</h:commandLink>
Suggest me some way to export. even I tried with c:forEach and columns.
<p:dataTable value="#{manager.studentList}" rowIndexVar="index" var="item" id="studentData">
<p:column>
<f:facet name="header">Name</f:facet>
<h:outputText value="#{item.name}" />
</p:column>
<p:column>
<f:facet name="header">Surname</f:facet>
<h:outputText value="#{item.surname}" />
</p:column>
<p:column>
<f:facet name="header">Age</f:facet>
<h:outputText value="#{item.age}" />
</p:column>
<p:column>
<f:facet name="header">Address</f:facet>
<c:forEach var="address" items="#{studentBean.addressList.get(index).address}">
<h:outputText value="#{address.address1}" />,
<h:outputText value="#{address.address2}"/>,
<h:outputText value="#{address.city}" />,
<h:outputText value="#{address.country}" />
</c:forEach>
</p:column>
</p:dataTable>
<h:commandLink>
<p:graphicImage name="/images/excel.png" />
<p:dataExporter type="xls" target="studentData" fileName="studentdetails" pageOnly="true"/>
</h:commandLink>
i trying with c:forEach is ok
On selecting a row, I need to update the page which is in ui:insert of p:dialog. What my issue is when the page is loaded I can select the row and fetch the data. After selection of another row, I am not able to fetch. There is no action going on.
This is my dataTable
<p:ajax event="rowSelect" update="samples" />
<p:ajax event="rowUnselect" update="samples" />
<p:column headerText="SNo" style="width:20px;" >
#{rowIndex+1}
</p:column>
<p:column headerText="PatientId">
#{patServ.patientOrder.patientEpisode.patientRegistration.patientId}
</p:column>
<p:column headerText="Patient Name" >
#{patServ.patientOrder.patientEpisode.patientRegistration.firstName} #{patServ.patientOrder.patientEpisode.patientRegistration.lastName}
</p:column>
<p:column headerText="Visit ID">
#{patServ.patientOrder.patientEpisode.id}
</p:column>
<p:column headerText="Order ID">
#{patServ.patientOrder.id}
</p:column>
<p:column headerText="Barcode ID" >
<p:outputLabel value="#{resultEntryBean.getBarcodes(patServ.id)}" />
</p:column>
<p:column headerText="Department Name" >
#{loginBean.getSpecialityName( patServ.serviceLabData.serviceHeaderData.speciality )}
</p:column>
<p:column headerText="Service Name" >
#{patServ.serviceLabData.serviceHeaderData.serviceName}
</p:column>
<p:column headerText="Ordered Date">
<p:outputLabel value="#{patServ.createdOn}">
<f:convertDateTime pattern="dd/MM/yyyy hh:mm a" type="date" timeZone="IST" />
</p:outputLabel>
</p:column>
<p:column headerText="Status">
<p:outputLabel value="#{resultEntryBean.status == 3 ? 'Acknowledged': resultEntryBean.status == 5 ? 'Result Entered': resultEntryBean.status == 6 ? 'Result Authorized' : 'Result Deauthorized'}" />
</p:column>
<p:column>
<p:commandButton value="Print" icon="ui-icon-print" update="reportContent" disabled="#{empty resultEntryBean.selectedPatientService}" onclick ="PF('templateDlg').show()" ajax="true"/>
</p:column>
</p:dataTable>
and im updating xhtml in ui:include here in the dialog box
<p:dialog id="mainDialog" header="Selected Template" widgetVar="templateDlg">
<h:panelGroup id="reportContent">
<ui:include src="#{resultEntryBean.selectedTemplate()}.xhtml"></ui:include>
</h:panelGroup>
</h:form>
How should I update the xhtml file in the ui:include of p:dialog
I am using primefaces 3.4.2 jar. I have a datatable with four columns. In two columns I have a datalist and I want to export text showed by datalist. But when I export it, it shows the following "org.primefaces.component.datalist.DataList#1195cc3" in the pdf and xls file.
<p:dataTable emptyMessage="#{messages['empty.result.set']}" id="searchResult" var="row" value="#{managePessoaJuridica.manageableList}" rows="10" paginator="true" paginatorPosition="top" paginatorAlwaysVisible="false" style="display:#{managePessoaJuridica.manageableList == null? 'none': ''}">
<p:column styleClass="column_icons" exportable="false">
<p:panelGrid columns="#{pessoaJuridicaController.showSelectAction?3:2}">
<p:commandButton id="selectAction" icon="ui-icon-circle-check" title="#{messages['action.select']}" action="#{pessoaJuridicaController.select(row.id)}" immediate="true" process="#this" rendered="#{pessoaJuridicaController.showSelectAction}"/>
<p:commandButton id="editAction" icon="ui-icon-pencil" title="#{messages['action.edit']}" action="#{pessoaJuridicaController.load(row.id)}" immediate="true" process="#this" update="#form"/>
<p:commandButton id="deleteAction" icon="ui-icon-trash" title="#{messages['action.delete']}" action="#{pessoaJuridicaController.delete(row.id)}" immediate="true" process="#this" update="searchResult"
onclick="return confirm('#{messages['confirm.delete.this']} #{messages['pessoa.juridica.view.title']}');" />
</p:panelGrid>
</p:column>
<p:column id="column_nome" sortBy="#{row.nome}" >
<f:facet name="header">
<h:outputText id="columnHeader_nome" value="#{messages['pessoa.nome']}"/>
</f:facet>
<h:outputText id="nome" value="#{row.nome}">
</h:outputText>
</p:column>
<p:column style="width:0px;">
<f:facet name="header">
<h:outputText id="columnHeader_categoriasPessoa" value="#{messages['pessoa.categorias.pessoa']}"/>
</f:facet>
<p:dataList type="definition" id="categoriasPessoa" var="item" value="#{row.categoriasPessoa}" >
<p:column>
<h:outputText id="item_categoriasPessoa" value="#{item}" converter="com.domain.configuracao.crud.CategoriaPessoaJsfConverter"/>
</p:column>
</p:dataList>
</p:column>
<p:column style="width:0px;">
<f:facet name="header">
<h:outputText id="columnHeader_identificacoesPessoa" value="#{messages['pessoa.identificacoes.pessoa']}"/>
</f:facet>
<p:dataList type="definition" id="identificacoesPessoa" var="item" value="#{row.identificacoesPessoa}">
<p:column>
<h:outputText id="item_categoriaIdentificacoes" value="#{pessoaJuridicaController.getCategoriaIdentificacao(item)}" converter="com.domain.configuracao.crud.CategoriaIdentificacaoJsfConverter"/>:
<h:outputText id="item_identificacoesPessoa" value="#{item}" converter="com.domain.configuracao.crud.IdentificacaoPessoaJsfConverter"/>
</p:column>
</p:dataList>
</p:column>
<p:column id="column_ativo" sortBy="#{row.ativo}" >
<f:facet name="header">
<h:outputText id="columnHeader_ativo" value="#{messages['classe.base.cadastro.ativo']}" />
</f:facet>
<h:outputText id="ativo" value="#{row.ativo}" converter="com.BooleanJsfConverter" >
</h:outputText>
</p:column>
<f:facet name="footer">
<p:menuButton value="#{messages['export.action']}" rendered="#{not empty managePessoaJuridica.manageableList}">
<p:menuitem value="#{messages['export.spreadsheet']}" ajax="false">
<p:dataExporter type="xls" target="searchResult" fileName="export" excludeColumns="0" encoding="ISO-8859-1"/>
</p:menuitem>
<p:menuitem value="#{messages['export.pdf']}" ajax="false">
<pe:exporter type="pdf" target="searchResult" fileName="export" excludeColumns="0" encoding="ISO-8859-1"/>
</p:menuitem>
<p:menuitem value="#{messages['export.csv']}" ajax="false">
<p:dataExporter type="csv" target="searchResult" fileName="export" excludeColumns="0" encoding="ISO-8859-1"/>
</p:menuitem>
</p:menuButton>
<p:spacer width="10"/>
<h:outputText value="#{fn:length(managePessoaJuridica.manageableList)} #{messages['records.found']}" rendered="#{not empty managePessoaJuridica.manageableList}"/>
</f:facet>
</p:dataTable>
But when I export it, it shows the following
"org.primefaces.component.datalist.DataList#1195cc3" in the pdf and
xls file.
Obviously, Primefaces's data exporter use the toString() method of an object to print its "value(s)".
Suggestions :
Write a custom exporter (recommended)
Override toString() method of org.primefaces.component.datalist.DataList (not advised)
I have a form with a panel and two dataTables. The code below has had most of the columns removed to make it easier to follow.
<h:form id="invoiceLookUp">
<p:panel>
<f:facet name="header">
<p:column style="font-weight: bold;">
Invoice Selection Criteria
</p:column>
</f:facet>
<h:outputText value="Seq ID"/>
<p:inputText
id="invoice_header_seq_id" styleClass="field" size="10"
value="#{invoiceBean.invoice_header_seq_id}"
/>
<p:commandButton
update="invoicesTable" value="Look Up"
action="#{invoiceBean.addInvoices()}"
/>
</p:panel>
<p:dataTable
id="invoicesTable" var="invoice" rows="15" lazy="true" selectionMode="single"
value="#{invoiceBean.invoiceList}"
rowKey="#{invoice.invoiceHeader.invoiceHeaderSeqId}"
selection="#{invoiceBean.selectedInvoice}"
>
<p:ajax event="rowSelect" update=":invoiceLookUp:invoiceLinesTable"/>
<f:facet name="header"><h:outputText value="Invoice Headers" /></f:facet>
<p:column sortBy="#{invoice.invoiceHeader.invoiceHeaderSeqId}" id="invoiceSeqId">
<f:facet name="header">
<h:outputText value="Seq ID" title="Invoice Header Seq ID"/>
</f:facet>
<h:outputText value="#{invoice.invoiceHeader.invoiceHeaderSeqId}" />
</p:column>
</p:dataTable>
<p:dataTable
id="invoiceLinesTable" var="invoiceLine" rows="15" lazy="true" selectionMode="single"
value="#{invoiceBean.selectedInvoice.invoiceLines}"
rowKey="#{invoiceLine.invoiceLineSeqId}"
selection="#{invoiceBean.selectedInvoiceLine}"
>
<f:facet name="header"><h:outputText value="Invoice Lines" /></f:facet>
<p:column sortBy="#{invoiceLine.invoiceLineSeqId}" id="invoiceLineSeqId">
<f:facet name="header"><h:outputText value="Line Seq ID"/></f:facet>
<h:outputText value="#{invoiceLine.invoiceLineSeqId}"/>
</p:column>
</p:dataTable>
</h:form>
When you enter a Seq ID and then click Look Up, the table populates as expected. When I select a row in the invoicesTable, I get the following error:
javax.faces.FacesException: Cannot find component with identifier ":invoiceLookUp:invoiceLinesTable" referenced from "form:invoiceLookUp:invoicesTable".
Can anyone tell me what I am doing wrong?