1

I am trying to add a title attribute to f:selectItem component using passthrough, but it is not adding anything to my DOM elements.

Environnment

Server : Payara 5.184
JSF : 2.3.3.99
Framework : Primefaces 7.0

View

<html ... xmlns:p="http://primefaces.org/ui" xmlns:pt="http://xmlns.jcp.org/jsf/passthrough" ...>
...
<p:selectOneButton onchange="PF('myTable').filter()">
    <f:converter converterId="javax.faces.Boolean" />
    <f:selectItem itemLabel="a" itemValue="#{null}" pt:title="All" />
    <f:selectItem itemLabel="o" itemValue="#{true}" pt:title="OK" />
    <f:selectItem itemLabel="n" itemValue="#{false}" pt:title="NOTOK" />
</p:selectOneButton>

DOM

...
<div class="..." tabindex="0">
    <input ... type="radio" value="" class="ui-helper-hidden-accessible" tabindex="-1" checked="checked">
    <span class="ui-button-text ui-c">a</span>
</div>
...

So, there is no title attribute added. Any hint ?

robinvrd
  • 1,760
  • 12
  • 28
  • the source is open... Please check if an attempt is made at all to process passtrough attributes Tried other select components? Tried PF 8? – Kukeltje Mar 10 '20 at 11:59
  • And a quick search https://www.google.com/search?client=firefox-b-d&q=primefaces+selectitem+passtrough resulted in https://github.com/primefaces/primefaces/issues/3132 and look at the sept '17 2019 answer in https://stackoverflow.com/questions/11780397/primefaces-tooltip-for-pselectmanycheckbox – Kukeltje Mar 10 '20 at 12:15
  • Does this answer your question? [Primefaces tooltip for p:selectManyCheckbox or other p:selectMany\*/One\*](https://stackoverflow.com/questions/11780397/primefaces-tooltip-for-pselectmanycheckbox-or-other-pselectmany-one) – Kukeltje Mar 10 '20 at 12:21

1 Answers1

2

The passtrough attributes is, at least up to PrimeFaces 8, not supported for the f:selectItem(s) (Hence this explicit answr) But for this specific usecase Primefaces tooltip for p:selectManyCheckbox or other p:selectMany*/One* has a solution for you (using the itemDescription attribute instead of pt:title)

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
  • Oh okay, I did not even try this because the documentation say `Description of this option, for use in development tools.`, thank you @Kukeltje. – robinvrd Mar 10 '20 at 13:16
  • Correct... it is not 'used' officially. As you can read in the answer by BalusC, so it is (admitted) a sort of 'abuse' ;-) – Kukeltje Mar 10 '20 at 13:54