7 Replies Latest reply on Feb 17, 2009 8:47 AM by depy

    mediaOutput in modal panel

    depy

      I have a problem generating mediaOutput in a modal panel. The image is generated before the modal panel is even opened. I want the media to be generated when the modal panel is showed. And I want to pass in the parameter.


      Here's the code for calling the modal panel. I want to pass in the parameter here.

      <h:graphicImage width="28" height="23" id="imgGraph" value="resources/icon_chart.gif"/>
       <rich:componentControl for="panel" attachTo="imgGraph" operation="show" event="onclick" params="#{p.agentID}"/>
      


      And here's the modal panel.
      <rich:modalPanel id="panel" width="650" height="250">
       <f:facet name="header">
       <h:panelGroup>
       <h:outputText value="Modal Panel"></h:outputText>
       </h:panelGroup>
       </f:facet>
       <f:facet name="controls">
       <h:panelGroup>
       <h:outputText value="[X]" id="hidelink"></h:outputText>
       <rich:componentControl for="panel" attachTo="hidelink" operation="hide" event="onclick"/>
       </h:panelGroup>
       </f:facet>
       <a4j:mediaOutput id="mediaChart" standby="Loading chart..." element="img" cacheable="false" session="true" createContent="#{chartBean.generateChart}" mimeType="image/jpeg" />
       </rich:modalPanel>
      


      So the idea is, for every row in datatable I show an image and when you click on it the ID of that row (item) is passed to the chart generator so I generate chart after modal panel is opened.


      Thank you!

        • 1. Re: mediaOutput in modal panel
          six-p4ck

          I think use reRender optioncan help you.


          somethink like:

          <a4j:commandLink reRender="panel">
           <h:graphicImage width="28" height="23" id="imgGraph" value="resources/icon_chart.gif"/>
           <rich:componentControl for="panel" attachTo="imgGraph" operation="show" event="onclick" params="#{p.agentID}"/>
          </a4j:commandLink>
          
          


          • 2. Re: mediaOutput in modal panel
            depy

            I tried something like this:


            <a4j:commandLink reRender="mediaChart" ajaxSingle="true" actionListener="#{chartBean.createChart}">
             <f:attribute name="agentIDChart" value="#{p.agentID}"/>
             <h:graphicImage width="28" height="23" id="imgGraph" value="resources/icon_chart.gif"/>
             <rich:componentControl for="panel" attachTo="imgGraph" operation="show" event="onclick" params="#{p.agentID}"/>
             </a4j:commandLink>
            


            And it doesnt rerender the chart. The method for creating chart is not called. :(

            • 3. Re: mediaOutput in modal panel
              six-p4ck

              firefox do cache.

              try with IE.

              If it's work with IE i can help you.

              • 4. Re: mediaOutput in modal panel
                nbelaevski

                Hello,

                Try this:

                <a4j:commandLink reRender="mediaChart" ajaxSingle="true" actionListener="#{chartBean.createChart}" oncomplete="#{rich:component('panel')}.show()">
                 <f:param name="agentIDChart" value="#{p.agentID}"/>
                 <h:graphicImage width="28" height="23" id="imgGraph" value="resources/icon_chart.gif"/>
                 </a4j:commandLink>


                • 5. Re: mediaOutput in modal panel
                  depy

                  I tried it, but now I get:


                  Exception Details: org.apache.jasper.el.JspELException
                  /monitor.jsp(69,24) '#{rich:component('panel')}.show()' Function 'rich:component' not found


                  I'm using richfaces only, without seam. Is this because of it?

                  • 6. Re: mediaOutput in modal panel
                    nbelaevski

                    Ok, these functions are not available in 3.1.x. Try this:

                    Richfaces.showModalPanel('panel')


                    • 7. Re: mediaOutput in modal panel
                      depy

                      Thanks a million times. It works now. :)