Lost in SelectOneMenu with images

UI Components for JSF
Post Reply
honyk
Posts: 150
Joined: 28 Sep 2010, 11:14

07 Dec 2011, 01:13

Hello Everyone,

I'd like to create combo with images whose names equal to labels in simple ArrayList<String>.

But when the following code is used (derived from the show case), just labels appear in the combo when it is populated. I use PF 3.0M4, but RC1-Snapshot gives the same results. Win7 + Mojarra 2.1.4 + Tomcat 7.0.14.

Code: Select all

<p:selectOneMenu value="#{settings.colorMapName}" var="colorMapName">
    <f:selectItems value="#{settings.colorMapNameList}"/>
    <p:column>                      
        <p:graphicImage value="/resources/colormaps/#{colorMapName}.svg" width="100" height="10"/>
    </p:column> 
</p:selectOneMenu>
Any idea what can be wrong in my code?

Regards,
Jan

honyk
Posts: 150
Joined: 28 Sep 2010, 11:14

08 Dec 2011, 20:10

I've found that the var needs to be on selectItems tag. But it still desn't work. Even replacing List<String> with List<SelectItem> didn't help. What is the magic to insert graphics into the combo box?

Code: Select all

<p:selectOneMenu value="#{settings.colorMapName}">
    <f:selectItems value="#{settings.colorMapNameList}" var="colorMapName" />
    <p:column>                      
        <p:graphicImage value="/resources/colormaps/#{colorMapName}.svg" width="100" height="10"/>
    </p:column> 
</p:selectOneMenu>

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 23 guests