Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger an ajax event listener on click of p:graphicImage?

I want to do some processing when the user click on the p:graphicsImage inside a ui:repeat How do i do it.

<ui:repeat id="repeat" value="#{getData.image}" var="imageLst" varStatus="loop">
   <h:panelGroup>
      <p:graphicImage id="gi1" value="#{imageStreamer.image}" alt="image not available" >
          <f:param name="id" value="#{imageLst.imageID}" />
          <p:ajax id="aj2" event="click" listener="#{getData.searchID}" immediate="true" update=":form:tabView:check :form:growl"/>
      </p:graphicImage>
   </h:panelGroup>
</ui:repeat>

In the above code if i place the ajax part doesn't get triggered. How do i monitor a Click on the 'p:graphicImage'

like image 750
user1433804 Avatar asked Jun 09 '12 17:06

user1433804


1 Answers

The <p:graphicImage> doesn't support any ajax events.

Just wrap it in a <h:commandLink> (or the p: one).

<h:commandLink>
    <p:graphicImage id="gi1" value="#{imageStreamer.image}" alt="image not available" >
        <f:param name="id" value="#{imageLst.imageID}" />
    </p:graphicImage>
    <p:ajax id="aj2" listener="#{getData.searchID}" update=":form:tabView:check :form:growl"/>
</h:commandLink>
like image 86
BalusC Avatar answered Nov 15 '22 04:11

BalusC