You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Betts, Chuck" <Ch...@intuit.com> on 2007/07/07 01:33:19 UTC

Getting a tooltip on Dropdown menu

Hi,

 

I am trying to use a Dropdown menu, but I'd like the generated HTML to
have a "title" attribute, which will give each menu item a tooltip.
This is to allow long menu items in a dropdown menu with a fixed length.

 

Here is what I am doing now:

 

<h:selectOneMenu id="companySelect"
value="#{CompanySelectBean.companySelection}"

                  binding="#{CompanySelectBean.companySelectOneRadio}">

<f:selectItems value="#{CompanySelectBean.companyFiles}" />

</h:selectOneMenu>

 

I saw that there is an <f:attribute> tag that might let me add
attributes to a single <f:selectItem>, but using the multiple version
<f:selectItems> is it possible?  Can I set the "title" attribute
programmatically?  The CompanySelectBean is returning an array of
SelectItems, is there an alternative subclass that would do this in
MyFaces perhaps?

 

ChuckBetts | Software Engineer - Shared Development & Services - SPC |
Intuit, Inc. 858-525-8616 

 


Re: Getting a tooltip on Dropdown menu

Posted by Andrew Robinson <an...@gmail.com>.
The only option I see is labelClass on the select item, no way to set
the title. You can't even extend the existing functionality as the
developer chose to put the code in static methods. If you are
interested, the code is in HtmlRendererUtils.java function:

public static void renderSelectOptions(FacesContext context,
                                           UIComponent component,
Converter converter, Set lookupSet,
                                           List selectItemList) throws
IOException {

It would be great to open up some kind of extension hook into this
method for custom components or renderers to be able to extend the
default rendering behavior without having to re-write the whole
rendering code.

I'd suggest you open an enhancement request bug. That is unless I
missed some extension point?

-Andrew

On 7/6/07, Betts, Chuck <Ch...@intuit.com> wrote:
>
>
>
>
> Hi,
>
>
>
> I am trying to use a Dropdown menu, but I'd like the generated HTML to have
> a "title" attribute, which will give each menu item a tooltip.  This is to
> allow long menu items in a dropdown menu with a fixed length.
>
>
>
> Here is what I am doing now:
>
>
>
> <h:selectOneMenu id="companySelect"
> value="#{CompanySelectBean.companySelection}"
>
>
> binding="#{CompanySelectBean.companySelectOneRadio}">
>
> <f:selectItems value="#{CompanySelectBean.companyFiles}" />
>
> </h:selectOneMenu>
>
>
>
> I saw that there is an <f:attribute> tag that might let me add attributes to
> a single <f:selectItem>, but using the multiple version <f:selectItems> is
> it possible?  Can I set the "title" attribute programmatically?  The
> CompanySelectBean is returning an array of SelectItems, is there an
> alternative subclass that would do this in MyFaces perhaps?
>
>
>
> ChuckBetts | Software Engineer - Shared Development & Services - SPC |
> Intuit, Inc. 858-525-8616
>
>