This question already has answers here:
How to add tooltip to f:selectItems
(2 answers)
Closed 6 years ago.
I wanna put a tooltip for each f:selectItem on my selectOneRadio, somenthing like:
<p:datatable data...>
<p:selectOneRadio required="true" requiredMessage="Required">
<f:selectItem itemLabel="1" itemValue="1" title="msg 1"/>
<f:selectItem itemLabel="2" itemValue="2" title="msg 2"/>
</p:selectOneRadio>
</p:datatable>
Any ideas or sugesttions?
Use itemDescription for tooltip. Please try the following.
<p:datatable data...>
<p:selectOneRadio required="true" requiredMessage="Required">
<f:selectItem itemLabel="1" itemValue="1" itemDescription="msg 1"/>
<f:selectItem itemLabel="2" itemValue="2" itemDescription="msg 2"/>
</p:selectOneRadio>
</p:datatable>
Related
This question already has answers here:
commandButton/commandLink/ajax action/listener method not invoked or input value not set/updated
(12 answers)
Closed 5 years ago.
I have a selectOneMenu element(carType) which populates another selectOneMenu(manufacture) element on changing it. This works fine and I get it rendered everytime.
Then I have another selectOneMenu(model) which gets populated evertime the manufacture list is changed. This does not seem to work however.I see that the listener is not called at all for carManufacturerChanged. Any help will be appreciated. Code is :
<p:selectOneMenu value="#{createControler.carType}">
<f:selectItem itemLabel="Select Car Type" itemValue="" />
<f:selectItems value="#{createControler.carTypeList}" var="carType"
itemLabel="#{carType}" itemValue="#{carType}"/>
<f:ajax event="change" listener="#{createControler.carTypeChanged}" render="manufacture"/>
</p:selectOneMenu><br></br><br></br>
<p:selectOneMenu value="#{createControler.carManufacturer}" id="manufacture">
<f:selectItem itemLabel="Select Car Manufacturer" itemValue="" />
<f:selectItems value="#{createControler.carManufacturerList}" var="carManufacturer"
itemLabel="#{carManufacturer.manufacture}" itemValue="#{carManufacturer.manufacture}"/>
<f:ajax event="change" listener="#{createControler.carManufacturerChanged}" render="model" />
</p:selectOneMenu><br></br><br></br>
<p:selectOneMenu value="#{createControler.carModel}" id="model">
<f:selectItem itemLabel="Select Car Model" itemValue="" />
<f:selectItems value="#{createControler.carModelList}" var="carModel"
itemLabel="#{carModel.model}" itemValue="#{carModel.model}"/>
</p:selectOneMenu><br></br><br></br>
EDIT : When I add another <f:selectItem itemValue="random" itemLabel="random" /> in the carManufacturer menu, and select it, then the listener is called. So, I think the problem might be that listener is not triggered for elements that are rendered in runtime. Might be of help to someone who can answer.
Go check you corresponding CDI bean's scope. If it's RequestScoped, change the scope to ViewScoped or scopes that spans multiple requests.
I want to display the selected rows of a table in a dialog box but I have an empty dialog box even if I check one or more line nothing is displayed .. I realy don't know what is the cause of my problem .. I hope there will be someone who can help me (I m a beginner in jsf2 and I just discovered primefaces I really want help thanks soo much in advance ) this is my jsf :
<p:outputLabel for="product" value="" />
<p:dataTable id="product" var="ligne" value="#{productBean.myProducts}" selection="#{productBean.selectedProducts}" style="margin-bottom:0" rowKey="#{productBean.id}">
<p:column selectionMode="multiple" style="width:16px;text-align:center"/>
<p:column headerText="Code">
<h:outputText value="#{ligne.code}" />
</p:column>
<p:column headerText="designation" >
<h:outputText value="#{ligne.title}" />
</p:column>
<f:facet name="footer">
<p:commandButton process="product" update=":form:multiProductDetail" icon="ui-icon-search" value="View" oncomplete="PF('multiProductDialog').show()" />
</f:facet>
</p:dataTable>
<p:dialog header="Products" widgetVar="multiProductDialog" modal="true" showEffect="fade" hideEffect="fade" resizable="false" width="200">
<p:outputPanel id="multiProductDetail" style="text-align:center;">
<ui:repeat value="#{prodBean.selectedProducts}" var="ligne">
<h:outputText value="#{ligne.code} -- #{ligne.title}" style="display:block"/>
</ui:repeat>
</p:outputPanel>
Did you put a
h:form
inside this page
Is there data inside selection="#{productBean.selectedProducts}" .Can you a debug point there and see or put some sysouts in the getters and setters of selectedProducts.
Can you share your product code and check if selectedProducts is null or not
system.out.println("products"+selectedProducts.get(0))
best
vj
I have a SelectOneMenu that I want hide somevalues that came from Bean based on condition (x.situacao eq 'INATIVO').
<p:selectOneMenu id="selectonemenu"
value="#{pessoaBean.pessoa.profissao}" filter="true"
filterMatchMode="startsWith" converter="simpleEntityConverter"
required="true" requiredMessage="Selecione uma Profissao para Pessoa">
<f:selectItem itemValue="" itemLabel="Selecione..."
noSelectionOption="true" />
<f:selectItems value="#{profissaoBean.profissoes}" var="x"
itemLabel="#{x.nome}" itemValue="#{x}"
itemDisabled="#{x.situacao eq 'INATIVO'}"/>
</p:selectOneMenu>
As far I got is disabled value but not hide it from selectonemenu.
How do that? One way is filter this on Bean but I wanna use an already method that I have.
I am using Primefaces 4.0 with JSF 2.0
my requirement is to do some specific task behind (ON / OFF) selection button, my code is like
<h:form>
<h:panelGrid>
<p:selectOneButton value="#{buttonBean.number}">
<f:selectItem itemLabel="ON" itemValue="1" />
<f:selectItem itemLabel="OFF" itemValue="0" />
</p:selectOneButton>
</h:panelGrid>
</h:form>
for now UI and all is fine but, value is not passed on click to the bean which is buttonBean.number unless i submit it using a submit button.
My aim is to pass and set number = 0 and number = 1 by only click not submit it, where "0" is for Off and "1" is for On,
Another solution without submit
<p:selectOneMenu id="listFilter" value="#{sess.selectedFileId}">
<p:ajax update="mytable" listener="#{beanBacking.fileChanged()}" partialSubmit="true" />
<f:selectItem itemLabel="-- ALL --" itemValue="#{null}" />
<f:selectItems value="#{beanBacking.fileList}" />
</p:selectOneMenu>
<p:ajax /> learn p:ajax more HERE, from this page will not even refersh.
Im using Jsf 2.0 and primefaces exstensions component pe:layout to create a page with left navigation menu bar ,bottom footer and center pane for content everthing works fine but when ever i add primefaces datatable (p:datatable) in the center pane the header and footer layouts are preserved but the left pane disappears and the center pane occupies the entire page. I tried setting width and height of the datatable but nothing seems to work. The page displays correctly without datatable. Any help would be greatly appreciated.
Please find below the code with datatable:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions">
<ui:composition template="/templates/showcaseLayout.xhtml">
<ui:define name="centerContent">
<f:facet name="header">
<h:outputText value="Jan Sampark"/>
</f:facet>
<h:panelGroup layout="block" styleClass="centerContent">
Welcome to the Menu Page.
<p:growl id="messages" showDetail="true"/>
</h:panelGroup>
<p:tabView id="tabView">
<p:tab id="tab1" title="Godfather Part I">
<h:panelGrid columns="2" cellpadding="10">
<p:graphicImage id="tab1Img" value="/images/godfather/godfather1.jpg" />
<h:outputText id="tab1Text"
value="The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding.
His beloved son Michael has just come home from the war, but does not intend to become part of his father's business. T
hrough Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family, kind and benevolent to those who give respect,
but given to ruthless violence whenever anything stands against the good of the family." />
</h:panelGrid>
</p:tab>
<p:tab id="tab2" title="Godfather Part II">
<h:panelGrid columns="2" cellpadding="10">
<p:graphicImage id="tab2Img" value="/images/godfather/godfather2.jpg" />
<h:outputText id="tab2Text" value="Francis Ford Coppola's legendary continuation and sequel to his landmark 1972 film, The_Godfather, parallels the young Vito Corleone's rise with his son Michael's spiritual fall, deepening The_Godfather's depiction of the dark side of the American dream.
In the early 1900s, the child Vito flees his Sicilian village for America after the local Mafia kills his family. Vito struggles to make a living, legally or illegally, for his wife and growing brood in Little Italy,
killing the local Black Hand Fanucci after he demands his customary cut of the tyro's business. With Fanucci gone, Vito's communal stature grows."/>
</h:panelGrid>
</p:tab>
<p:tab id="tab3" title="Godfather Part III">
<h:panelGrid columns="2" cellpadding="10">
<p:graphicImage id="tab3Img" value="/images/godfather/godfather3.jpg" />
<h:outputText id="tab3Text" value="After a break of more than 15 years, director Francis Ford Coppola and writer Mario Puzo returned to the well for this third and final story of the fictional Corleone crime family.
Two decades have passed, and crime kingpin Michael Corleone, now divorced from his wife Kay has nearly succeeded in keeping his promise that his family would one day be completely legitimate."/>
</h:panelGrid>
</p:tab>
</p:tabView>
<h:panelGroup layout="block" styleClass="centerContent">
<p:dataTable var="car" value="#{tableBean.carsSmall}" id="carList" editable="true" style="table-layout: fixed"
scrollable="true" scrollHeight="250" scrollWidth="300">
<f:facet name="header">
In-Cell Editing
</f:facet>
<!-- <p:ajax event="rowEdit" listener="#{tableBean.onEdit}" update=":form:messages" /> -->
<!-- <p:ajax event="rowEditCancel" listener="#{tableBean.onCancel}" update=":form:messages" /> -->
<p:column headerText="Model" >
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{car.model}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{car.model}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Manufacturer">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{car.manufacturer}" />
</f:facet>
<f:facet name="input">
<h:selectOneMenu value="#{car.manufacturer}" >
<f:selectItems value="#{tableBean.manufacturers}"
var="man"
itemLabel="#{man}"
itemValue="#{man}" />
</h:selectOneMenu>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Color">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{car.color}" />
</f:facet>
<f:facet name="input">
<h:selectOneMenu value="#{car.color}" >
<f:selectItems value="#{tableBean.colors}"
var="color"
itemLabel="#{color}"
itemValue="#{color}" />
</h:selectOneMenu>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Options">
<p:rowEditor />
</p:column>
</p:dataTable>
</h:panelGroup>
</ui:define>
<ui:define name="docuTable">
<ui:include src="/sections/shared/documentation.xhtml">
<ui:param name="tagName" value="timeline"/>
</ui:include>
</ui:define>
</ui:composition>
</html>