PrimeFaces - Tooltip in a SelectOneMenu

I'm trying to use tooltip in a p:selectOneMenu.

I need to show different information tooltip for each option in the f:selectItem when you do a mouse over or just "pre-select" the option.

What I want: What i want

I have the information need for it in the same list that I'm using for the OneSelectMenu, but I tried with the basic <p:tooltip> and the <f:facet name="itemtip"> from:

Itemtip

and nothing works.

What you can recommend me to do? Im using PrimeFaces 6.1.

Upvotes: 2

Views: 2824

Answers (1)

thunderhook
thunderhook

Reputation: 580

For this you can use the attribute itemDescription.

Here is a working working example tested with PF 6.1 (Joinfaces jsf-spring-boot-starter), Firefox, Chrome, IE and even Edge:

<p:selectOneMenu>
    <f:selectItems value="#{selectOneMenuTooltipView.cars}" var="car"
        itemLabel="#{car.name}" itemValue="#{car}"
        itemDescription="#{car.desc}" />
</p:selectOneMenu>

p:selectOneMenu tooltip

Upvotes: 2

Related Questions