I am using Primefaces 4.0 Datatable with a paginator. The table lies right under a
accordionPanel wich can expand or collapse, affecting the layout of the page.
Unfortunately, the paginator of the datatable doesn't move when the accordion animation is performed.
BEFORE EXPANDING the accordion:
AFTER EXPANDING the accordion:
I have kinda taken the code from primefaces showcase, and didn't touch it much, but anyway here's what is in my xhtml:
Any idea of what i'm doing wrong?
TABLE CODE:
<p:dataTable id="idDataTable" value="#{analysisBean.listOfSamu}" var="nthSamu" rows="10"
paginator="true"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
selectionMode="single">
<p:column headerText="ID" sortBy="#{nthSamu.idSamu}" filterBy="#{nthSamu.idSamu}" filterMatchMode="contains">
<h:outputText value="#{nthSamu.idSamu}"/>
</p:column>
<p:column headerText="EJE" sortBy="#{nthSamu.nombre}" filterBy="#{nthSamu.nombre}" filterMatchMode="contains">
<h:outputText value="#{nthSamu.nombre}"/>
</p:column>
<p:column headerText="EJE" sortBy="#{nthSamu.primerApellido}" filterBy="#{nthSamu.primerApellido}" filterMatchMode="contains">
<h:outputText value="#{nthSamu.primerApellido}"/>
</p:column>
<p:column headerText="IM" sortBy="#{nthSamu.importe}" filterBy="#{nthSamu.importe}" filterMatchMode="contains">
<h:outputText value="#{nthSamu.importe}"/>
</p:column>
<p:column headerText="FE" sortBy="#{nthSamu.fecha}" filterBy="#{nthSamu.fecha}" filterMatchMode="contains">
<h:outputText value="#{nthSamu.fecha}"/>
</p:column>
</p:dataTable>
ACCORDION CODE:
enter code her <p:fieldset legend="Filtros" style="width: 40%" >
<h:panelGrid columns="1">
<p:accordionPanel multiple="true" style="width: 100%">
<p:tab title="Acerca del Giro">
<h:panelGrid columns="5">
<h:column>
<h:outputLabel style="vertical-align:middle" value="Oficina: " />
<p:selectOneMenu id="oficinaSelect" style="vertical-align:middle">
<f:selectItem itemLabel="Todos" itemValue="Todos" />
<f:selectItem itemLabel=" Naguaes" itemValue=" Naguaes" />
<f:selectItem itemLabel=" aguaes" itemValue=" aguaes" />
<f:selectItem itemLabel="Naguaes" itemValue=" s Naguaes" />
<f:selectItem itemLabel="aguaes" itemValue=" s aguaes" />
</p:selectOneMenu>
</h:column>
<h:column>
<h:outputLabel style="vertical-align:middle" value="País: "/>
<p:selectOneMenu id="paisSelect" style="vertical-align:middle">
<f:selectItem itemLabel="Todos" itemValue="Todos" />
<f:selectItem itemLabel="Naguaes" itemValue=" Naguaes" />
<f:selectItem itemLabel="aguaes" itemValue=" aguaes" />
<f:selectItem itemLabel="Naguaes" itemValue=" s Naguaes" />
<f:selectItem itemLabel="aguaes" itemValue=" s aguaes" />
</p:selectOneMenu>
</h:column>
</h:panelGrid>
</p:tab>
<p:tab title="Acerca del Ejecutor">
<h:panelGrid columns="5">
<p:graphicImage url="images/usericon.png" width="30" height="30" style="border: 3px solid activecaption"/>
<h:column>
<h:outputLabel value="Naguaidad:" style="vertical-align:middle"/>
<p:selectOneMenu id="idNaguaidadSelect2" style="vertical-align:middle">
<f:selectItem itemLabel="Todos" itemValue="Todos" />
<f:selectItem itemLabel="aguaes" itemValue=" Naguaes" />
<f:selectItem itemLabel="guaes" itemValue=" aguaes" />
<f:selectItem itemLabel="Naguaes" itemValue=" s Naguaes" />
<f:selectItem itemLabel="aguaes" itemValue=" s aguaes" />
</p:selectOneMenu>
</h:column>
<h:column>
<h:outputLabel value=" Porto NInj:" style="vertical-align:middle" />
<p:selectOneMenu id="id PortoNInjSelect" style="vertical-align:middle">
<f:selectItem itemLabel="Todos" itemValue="Todos" />
<f:selectItem itemLabel="aguaes" itemValue=" Naguaes" />
<f:selectItem itemLabel="guaes" itemValue=" aguaes" />
<f:selectItem itemLabel="Naguaes" itemValue=" s Naguaes" />
<f:selectItem itemLabel="aguaes" itemValue=" s aguaes" />
</p:selectOneMenu>
</h:column>
<h:column>
<h:outputLabel value="Actividad:" style="vertical-align:middle"/>
<p:selectOneMenu id="idActividadSelect" style="vertical-align:middle">
<f:selectItem itemLabel="Todos" itemValue="Todos" />
<f:selectItem itemLabel=" Naguaes" itemValue=" Naguaes" />
<f:selectItem itemLabel=" aguaes" itemValue=" aguaes" />
<f:selectItem itemLabel=" s Naguaes" itemValue=" s Naguaes" />
<f:selectItem itemLabel=" s aguaes" itemValue=" s aguaes" />
</p:selectOneMenu>
</h:column>
</h:panelGrid>
</p:tab>
</p:accordionPanel>
<p:commandButton id="idFiltrarCommandButton2" style="float:right" icon="ui-icon-search" value="Filtrar" action="#{analysisBean.populateList()}" update="idDataTable"></p:commandButton>
</h:panelGrid>
</p:fieldset>
I'm fairly with prime-faces. Seems like you need to have the dataTable and the accordionPanel within two seperate forms and panels. I would recommend doing something like,
Code:
<Dialogue>
<Form1>
<Panel>
Datatable
</panel>
</Form1>
<Form2>
<panel>
AccordionPanel
</panel>
</Form2>
</Dialogue>
just don't forget to update the respective forms accordingly
Related
I have a drop down menu which will add new row of input fields as follows:
<h:selectOneMenu id="selBillingSelect" rendered="#participantController.enableMultipleBilling}" title="#{awbInformationorderBundle.RATING_DETAILS_ADD_LBL_TIP}" tabindex="#{headerBean.tabIndex}" styleClass="optional" value="#{participantController.numberOfRows}" accesskey="6" style="vertical-align:bottom">
<f:ajax event="change" listener="#{participantController.addBillingLines}" render=":frmParticipantInfo:billingTable hidBillingSize" execute=":frmParticipantInfo:billingTable" onevent="billingAutoExpansion" />
<f:selectItem itemValue="0" itemLabel="Add a Carrier" />
<f:selectItem itemValue="1" itemLabel="1" />
<f:selectItem itemValue="2" itemLabel="2" />
<f:selectItem itemValue="3" itemLabel="3" />
<f:selectItem itemValue="4" itemLabel="4" />
</h:selectOneMenu>
backing bean code to add data
public void addBillingLines(){
BillingPartsInfoDto aBillingPartsInfoDto = null;
for (int i = 0; i < this.getNumberOfRows(); i++) {
if(this.getBillingSize()<this.getMaxAirlineCodeAllowed()){
aBillingPartsInfoDto= new BillingPartsInfoDto();
billingInfoDtos.add(aBillingPartsInfoDto);
this.setBillingSize(this.getBillingInfoDtos().size());
}
}
this.setNumberOfRows(0);
return;
}
i have a a4j:repeat to display the data as follows:
<h:panelGroup id="billingTable"></h:panelGroup>
<a4j:repeat id="billingLines#{rowIndex}" var="item" keepSaved="true" value="#{participantController.billingInfoDtos}" rowKeyVar="rowIndex"> <cc:customTable id="billingTable"> <cc:customTr styleClass="fieldTitle"> <cc:customTd valign="center"> <h:outputText value="Carrier Code" escape="false" /> </cc:customTd> <cc:customTd valign="center"> <h:outputText value="#{participantBundle.BILLING_INVOICE_MEDIA_LBL}" escape="false" /> </cc:customTd> <cc:customTd><h:outputText styleClass="spacer20" /> </cc:customTd><cc:customTd valign="center"> <h:outputText value="#participantBundle.BILLING_INVOICE_FREQUENCY_LBL}" escape="false" /></cc:customTd><cc:customTd><h:outputText tyleClass="spacer20" />
<cc:customTd valign="center">
<h:outputText value="#{participantBundle.BILLING_INVOICE_SEQUENCE_LBL}" escape="false" /></cc:customTd>
<cc:customTd>
<h:outputText styleClass="spacer20" />
</cc:customTd>
<cc:customTd valign="center">
<h:outputText
value="#{participantBundle.BILLING_INVOICE_LANGUAGE_LBL}"
escape="false" />
</cc:customTd>
<cc:customTd>
<h:outputText styleClass="spacer20" />
</cc:customTd>
<cc:customTd valign="center">
<h:outputText
value="#{participantBundle.BILLING_INVOICE_SITE_LBL}"
escape="false" />
</cc:customTd>
<cc:customTd>
<h:outputText styleClass="spacer20" />
</cc:customTd>
<cc:customTd valign="center">
<h:outputText
value="#{participantBundle.BILLING_CURRENCY_LBL}"
escape="false" />
</cc:customTd>
<cc:customTd>
<h:outputText styleClass="spacer20" />
</cc:customTd>
<cc:customTd>
<h:outputText style="vertical-align:top;"
value="#{participantBundle.DETAILS_INVOICE_EMAIL_LBL}" />
</cc:customTd>
</cc:customTr>
<cc:customTr>
<cc:customTd valign="top">
<h:selectOneMenu id="carrierCode" value="#{item.airline}"
title="#{participantBundle.INVOICE_MEDIA_TIP}" rendered="#{participantController.enableMultipleBilling}"
tabindex="#{headerBean.tabIndex}" style="width:50px;"
accesskey="#{participantBundle.BILLING_INVOICE_MEDIA_AKEY}"
styleClass="required">
<f:selectItems value="#{participantController.specificAirlines}"></f:selectItems>
</h:selectOneMenu>
</cc:customTd>
<cc:customTd>
<h:selectOneMenu id="invoiceMedia1"
value="#{item.invoiceMedia}"
title="#{participantBundle.INVOICE_MEDIA_TIP}"
tabindex="#{headerBean.tabIndex}"
accesskey="#{participantBundle.BILLING_INVOICE_MEDIA_AKEY}"
styleClass="required">
<f:selectItem itemLabel=" " itemValue=" " />
<f:selectItem itemLabel="Descriptive"
itemValue="Descriptive" />
<f:selectItem itemLabel="CASS Tape" itemValue="CASS Tape" />
<f:selectItem itemLabel="Government Form"
itemValue="Government Form" />
<f:selectItem itemLabel="Literal" itemValue="Literal" />
<f:selectItem itemLabel="Tape" itemValue="Tape" />
<f:selectItem itemLabel="Email" itemValue="Email" />
<f:selectItem itemLabel="FTP" itemValue="FTP" />
<f:converter converterId="EnumConverter"></f:converter>
</h:selectOneMenu>
</cc:customTd>
<cc:customTd></cc:customTd>
<cc:customTd>
<h:selectOneMenu id="invoiceFrequency"
value="#{item.invoiceFrequency}"
title="#{participantBundle.INVOICE_FREQUENCY_TIP}"
tabindex="#{headerBean.tabIndex}" styleClass="required">
<f:selectItem itemLabel=" " itemValue=" " />
<f:selectItem itemLabel="Weekly" itemValue="Weekly" />
<f:selectItem itemLabel="Bi-Monthly"
itemValue="Bi-Monthly" />
<f:selectItem itemLabel="Daily" itemValue="Daily" />
<f:selectItem itemLabel="Demand" itemValue="Demand" />
<f:selectItem itemLabel="Monthly" itemValue="Monthly" />
<f:selectItem itemLabel="10 days" itemValue="10 days" />
<f:converter converterId="EnumConverter"></f:converter>
</h:selectOneMenu>
</cc:customTd>
<cc:customTd></cc:customTd>
<cc:customTd>
<h:selectOneMenu id="invoiceSequence"
value="#{item.invoiceSequence}"
title="#{participantBundle.INVOICE_SEQUENCE_TIP}"
tabindex="#{headerBean.tabIndex}" styleClass="required">
<f:selectItem itemLabel=" " itemValue=" " />
<f:selectItem itemLabel="Ascending Order"
itemValue="Ascending Order" />
<f:selectItem itemLabel="Double Space"
itemValue="Double Space" />
<f:converter converterId="EnumConverter"></f:converter>
</h:selectOneMenu>
</cc:customTd>
<cc:customTd>
<h:inputText id="txtInvoiceLanguage"
value="#{item.invoiceLanguage}"
tabindex="#{headerBean.tabIndex}" size="3" maxlength="3"
styleClass="required"
title="#{participantBundle.INVOICE_LANGUAGE_TIP}" />
</cc:customTd>
<cc:customTd></cc:customTd>
<cc:customTd>
<h:inputText id="txtSite"
value="#{item.invoiceSite}"
tabindex="#{headerBean.tabIndex}" size="3" maxlength="3"
styleClass="required"
title="#{participantBundle.INVOICE_SITE_TIP}" />
</cc:customTd>
<cc:customTd></cc:customTd>
<cc:customTd>
<h:inputText id="txtBillingCurrency"
value="#{item.currency}"
tabindex="#{headerBean.tabIndex}" size="3" maxlength="3"
styleClass="required"
title="#{participantBundle.BILLING_CURRENCY_TIP}" />
</cc:customTd>
<cc:customTd></cc:customTd>
<cc:customTd>
<h:inputText id="txtInvoiceEmail"
style="vertical-align:top;"
value="#{item.invoiceEmail}"
size="45" maxlength="68" styleClass="optional"
title="#{participantBundle.DETAILS_EMAIL_TIP}" /></cc:customTd></cc:customTr></cc:customTable>
</a4j:repeat>
The problem is when I add a new row using the drop down and then set the value to the input box in the a4j:repeat component and submit form , the backing bean is set with with null value for all the fields.
Where as when i don't add any new row and save form the data is saved in the backend.
I think its because every time you are adding new objects of aBillingPartsInfoDto to the list billingInfoDtos and not set any values to the dto variables.
if(this.getBillingSize()<this.getMaxAirlineCodeAllowed()){
aBillingPartsInfoDto= new BillingPartsInfoDto();
/* Set values to dto variables here */
billingInfoDtos.add(aBillingPartsInfoDto);
this.setBillingSize(this.getBillingInfoDtos().size());
}
Does anyone knows how to disable the sourceCaption from primefaces picklist template?
I need that my user set three informations
(crudMB.upf.dataImplantacao, crudMB.upf.responsavelImplantacao, crudMB.upf.prazoSenha ) before selecting any options at the picklist.
At my code you guys can see this three variables that i need to enable the source part of the picklist.
<p:panel header="Produtos Fornecidos" style="height: auto;">
<h:panelGrid columns="2">
<h:outputLabel value="Data Implantação:" />
<p:calendar value="#{crudMB.upf.dataImplantacao}" />
<h:outputLabel value="Responsavel Implantação: " />
<p:inputText value="#{crudMB.upf.responsavelImplantacao}" />
<h:outputLabel value="Prazo de Senha: " />
<p:selectOneMenu value="#{crudMB.upf.prazoSenha}" >
<f:selectItem itemLabel="Selecione Um" itemValue="" itemDisabled="true" />
<f:selectItems value="#{crudMB.prazosSenha}" var="ps" itemLabel="#{ps.descricao}" />
</p:selectOneMenu>
</h:panelGrid>
<h:panelGrid>
<p:pickList id="picklist" value="#{crudMB.produtosFornecidos}" var="pf" itemValue="#{pf}" itemLabel="#{pf.nome}" converter="genericPickListConverter" >
<f:facet name="sourceCaption" >Disponiveis</f:facet>
<f:facet name="targetCaption" >Escolhidos</f:facet>
<p:ajax event="transfer" listener="#{crudMB.onTransfer}" />
<p:column>
<p:outputLabel value="#{pf.nome}"/>
</p:column>
<p:column>
<p:outputLabel value="#{pf.plataforma}"/>
</p:column>
<p:column>
<p:outputLabel value="#{pf.versaoAtual}"/>
</p:column>
</p:pickList>
</h:panelGrid>
Given the following list of <p:selectOneRadio>.
<p:selectOneRadio layout="grid" columns="1" value="#{1}">
<f:selectItem id="paypal" itemValue="1" itemLabel="Paypal"/>
<f:selectItem id="wireTransfer" itemValue="2" itemLabel="Wire Transfer"/>
</p:selectOneRadio>
Is it possible to display an image as a label of <f:selectItem> so that the list looks something like the following?
I tried using a <p:outputLabel> placing a <p:graphicImage> inside and removing the itemLabel attribute from the<f:selectItem> inside the <p:selectOneRadio> but either way it did not work.
<p:outputLabel for="paypal">
<p:graphicImage library="default" name="images/payments/paypal_logo.jpeg"/>
</p:outputLabel>
You can solve it using the SelectOneRadio - Custom Layout
Here an example:
<h3>Custom Layout</h3>
<p:outputPanel id="customPanel" style="margin-bottom:10px">
<p:selectOneRadio id="customRadio" value="#{radioView.color}" layout="custom">
<f:selectItem itemLabel="Red" itemValue="Red" />
<f:selectItem itemLabel="Green" itemValue="Green" />
<f:selectItem itemLabel="Blue" itemValue="Blue" />
</p:selectOneRadio>
<h:panelGrid columns="3" cellpadding="5">
<p:radioButton id="opt1" for="customRadio" itemIndex="0" />
<h:outputLabel for="opt1" value="Red" />
<p:spinner />
<p:radioButton id="opt2" for="customRadio" itemIndex="1" />
<h:outputLabel for="opt2" value="Green" />
<p:inputText />
<p:radioButton id="opt3" for="customRadio" itemIndex="2" />
<h:outputLabel for="opt3" value="Blue" />
<p:calendar />
</h:panelGrid>
</p:outputPanel>
<p:selectOneRadio id="customRadio" value="#{radioView.image}" layout="custom">
<f:selectItem itemLabel="Image1" itemValue="Image1" />
<f:selectItem itemLabel="Image2" itemValue="Image2" />
</p:selectOneRadio>
<h:panelGrid columns="2" cellpadding="5">
<p:radioButton id="opt1" for="customRadio" itemIndex="0" />
<h:graphicImage value="/some/image2.png"/>
<p:radioButton id="opt2" for="customRadio" itemIndex="1" />
<h:graphicImage value="/some/image2.png"/>
<h:panelGrid columns="3" cellpadding="5">
<h:form>
<h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5">
<h:outputText value="Region: " />
<p:selectOneMenu id="regionSelection" value="#{haf.selectedRegion}" effect="fade">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItems value="#{haf.regions}" var="region"
itemLabel="#{region.regionName}" itemValue="#{region.regionCode}" />
<p:ajax listener="#{haf.selectRegion}" update="provinceSelection" />
</p:selectOneMenu>
<h:outputText value="Province: " />
<p:selectOneMenu id="provinceSelection" value="#{haf.selectedProvince}" effect="fade">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItems value="#{haf.provinces}" var="province"
itemLabel="#{province.provName}" itemValue="#{province.provCode}" />
<p:ajax listener="#{haf.selectProvince}" update="citySelection" />
</p:selectOneMenu>
<h:outputText value="City/Municipality: " />
<p:selectOneMenu id="citySelection" value="#{haf.selectedCity}" effect="fade">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItems value="#{haf.cities}" var="city"
itemLabel="#{city.cityName}" itemValue="#{city.cityCode}" />
<p:ajax listener="#{haf.selectCity }" update="brgySelection" />
</p:selectOneMenu>
<h:outputText value="Barangay: " />
<p:selectOneMenu id="brgySelection" value="#{haf.selectedBrgy}"
effect="fade">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItems value="#{haf.brgys}" var="brgy"
itemLabel="#{brgy.brgyName}" itemValue="#{brgy.brgyCode}" />
</p:selectOneMenu>
</h:panelGrid>
</h:form>
May I ask what is the problem of the about code... the first ajax fires but the second doesn't. Does JSF have rule, 1 form, 1 ajax? Thanks in advance for answering a naive question.
I tried to update a Gmap which placed in a tabView. But i am getting the
java.lang.IllegalArgumentException: tab2
error. I have searched this problem a little and noticed that it is available only if tab is visible. So what can I do ? The code block is below:
<h:form id="form">
<p:tabView orientation="left" id="tabView" styleClass="tabView">
<p:ajax event="tabChange" listener="#{sucBean.onTabChange}"
update=":form:tabView:map" />
<p:tab title="Bütün Suçlar" id="tab1">
<p:gmap zoom="10" type="HYBRID" center="40.78470,29.94873" id="map"
model="#{sucBean.advancedModel}"
style="width:740px;height:500px;margin:-14px 0 0 -10px;">
<p:ajax event="overlaySelect" listener="#{sucBean.onMarkerSelect}" />
<p:gmapInfoWindow>
<p:outputPanel
style="text-align:justify;display:block;margin:auto:">
<p:panelGrid columns="2" cellpadding="8">
<h:outputText value="Suç Tipi:" style="color:red" />
<h:outputText value="#{sucBean.marker.data.sucTipi}" />
<h:outputText value="Tarih: " style="color:red" />
<h:outputText value="#{sucBean.marker.data.islenmeZamani}" />
<h:outputText value="Adres: " style="color:red" />
<h:outputText value="#{sucBean.marker.data.adres}" />
<h:outputText value="Suçu İşleyen:" style="color:red" />
<h:outputText value="#{sucBean.marker.data.isleyenBilgisi}" />
</p:panelGrid>
</p:outputPanel>
</p:gmapInfoWindow>
</p:gmap>
</p:tab>
<p:tab title="Suç Ara" id="tab2">
<p:fieldset legend="Ayrıntılı Arama" styleClass="searchField"
id="fieldSet">
<p:panelGrid columns="4" cellpadding="10">
<p:inputText value="#{sucBean.arananKelime}" style="width:300px" />
<h:outputText value=" Kriter:" />
<p:selectOneMenu value="#{sucBean.aramaKriteri}">
<f:selectItem itemLabel="Suç Tipi" itemValue="sucTipi" />
<f:selectItem itemLabel="Adres" itemValue="adres" />
<f:selectItem itemLabel="İşlenme Zamanı" itemValue="zaman" />
<f:selectItem itemLabel="Cinsiyet" itemValue="cinsiyet" />
<f:selectItem itemLabel="Yaş" itemValue="yas" />
</p:selectOneMenu>
<p:commandButton value="Ara"
actionListener="#{sucBean.sucKaydiAra}" update="aramaSonucu" />
</p:panelGrid>
</p:fieldset>
<p:dataTable var="suc" value="#{sucBean.sucModel}" paginator="true"
rows="10" id="aramaSonucu" selection="#{sucBean.selectedSuc}">
<p:column selectionMode="multiple" style="width:18px"></p:column>
<p:column headerText="Suç Tipi">
<h:outputText value="#{suc.sucTipi}" />
</p:column>
<p:column headerText="İşlenme Zamanı">
<h:outputText value="#{suc.islenmeZamani}" />
</p:column>
<p:column headerText="Adres">
<h:outputText value="#{suc.adres}" />
</p:column>
<p:column headerText="Suçu İşleyen">
<h:outputText value="#{suc.isleyenBilgisi}" />
</p:column>
<!-- <f:facet name="footer"> -->
<!-- </f:facet> -->
</p:dataTable>
<p:commandButton id="multiSelectButton" actionListener="#{sucBean.secilenleriGetir}" update=":form:tabView:tab2:map2"
value="Secilenleri Haritada Göster" icon="ui-icon-pin-s" />
<p:gmap zoom="12" type="HYBRID" center="40.78470,29.94873"
id="map2" model="#{sucBean.advancedModel2}"
style="width:740px;height:300px;margin:10px 0 0 -10px;">
When you reference a component inside container components like tabView or accordion, you don't need to include the actual tab id in your update target.
In your case update=":form:tabView:map2" would be the correct update target.