1
votes

I am using Primefaces graphicImage inside a p:tooltip and would like to set the width and height for the images individually.

 <p:remoteCommand....update="myImage" />

 <p:tooltip beforeShow="remoteCommand()">
   <p:graphicImage id="myImage"... style="#{myBean.myStyle}" />
....

Update: Bean.myStyle is triggered correctly and the style parameter is updated in the page source, but not in the dom tree. If I set style="width:100px" directly it works, but if the value comes from the bean, it is ignored.

It seems like the style-attribute of graphicImage gets updated but not the component itself.

What am I missing here?

2
missing quotation marks?jp-jee
ops, but I forgot them only in the questionsinclair
What does the "styles" tab in the browser's DOM inspector say?BalusC
@BalusC: the styles-attribute is correct in the page source, but it's empty in the dom tree.sinclair
Apparently it contains a syntax error causing it to be unparseable and thus not end up in DOM.BalusC

2 Answers

0
votes

I think style value is setted when the document is loaded and its never reloaded, when its visible just its display:none value is changing. So I would give an id to p:graphicImage then I would add a p:ajax using onShow or similar event (I dont know which one is available for tooltip) then I would use update attribute to render graphic image. If I remember right even it should work just with <p:ajax /> without any attribute but I am not sure

So it should look like that:

<p:graphicImage id="x" style="#{bean.value}">
  <p:ajax event="show" update"x"/>
</p:graphicImage>
0
votes

use this

<p:graphicImage width="#{bean.widthValue}" height="#{bean.heightValue}" >
</p:graphicImage>