问题
I am using the following code for displaying dynamic image in rich DataTable. Onclick of the thumbnail I need to display Full Image fetched from different location.
But the second a4j:mediaOutput tag is fetching all the Full images and keeping in memory. (Ofcourse modalPanel is displayed on click only )
I want the second a4j:mediaOutput tag to call daImageRetrievalBean.retrieveFullImage only after click.
Please help.
回答1:
<h:outputLink value="#" id="link">
<a4j:mediaOutput element="img" cacheable="false" session="true" style="height:75px; width:75px;"
createContent="#{daImageRetrievalBean.retrieveThumbnail}" value="#{digAsset.digitalAssetId}" mimeType="image/jpeg" />
<rich:componentControl for="panel" attachTo="link" operation="show" event="onclick">
</rich:componentControl>
</h:outputLink>
<rich:modalPanel id="panel" resizeable="false" autosized="true" minHeight="650" minWidth="700">
<f:facet name="header">
<h:outputText value="#{digAsset.fileName} Click on the image to hide" />
</f:facet>
<f:facet name="controls">
<h:panelGroup>
<a4j:mediaOutput element="img" cacheable="false" session="true" id="hidelink" style="height:600px; width:700px;margin-top: 30px"
createContent="#{daImageRetrievalBean.retrieveFullImage}" value="#{digAsset.fileName}" mimeType="image/jpeg" />
<rich:componentControl for="panel" attachTo="hidelink" operation="hide" event="onclick"/>
</h:panelGroup>
</f:facet>
</rich:modalPanel>
来源:https://stackoverflow.com/questions/1142150/invoke-rich-modal-panel-onclick