I want to show selectOneRadio with images above every radio button. I read that best solution set style as background image for every radio button
<p:selectOneRadio value="#{adminManageBroadcastController.selectedImage}" converter="#{broadcastImageConverter}">
<f:selectItems value="#{adminManageBroadcastController.fileUploadList}" var="image"
itemValue="#{image}"
style="background:url(#{image.url}); no-repeat !important;"/>
</p:selectOneRadio>
I know that data inside fileUploadList
is correct. But instead of label I see hashCode (equals and hashcode were override). If I do that I haven't problem
itemLabel="<img src="#{image.url}" width="20" height="20" alt="broadcast_img">"
itemLabelEscaped="false"
Why image isn't display as label?
You are setting your image as a selectItem. That is not what you want. The selectItem should be something like an object with (id, desc) values. The image goes into p:graphicImage.
Maybe p:selectOneListbox is what you are looking for. ;)