7 Replies Latest reply on Nov 2, 2007 6:02 AM by ilya_shaikovsky

    rich:modalpanel how pass own parameters

    jgomes99

      How I can pass own parameters in this squence javascript:Richfaces.showModalPanel('mp',{width:400, top:160},?
      and after recover it in modal panel

        • 1. Re: rich:modalpanel how pass own parameters
          ilya_shaikovsky

          You can pass your parameters during modalPanel opening or closing. This passing could be performed in the following way:

          Richfaces.showModalPanel('panelId', {left: auto}, {param1: value1});


          Thus, except the standard modalPanel parameters you can pass any of your own parameters.

          Also modalPanel allows to handle its own opening and closing events on the client side. The "onshow" and "onclose" attributes are used in this case.

          The following example shows how on the client side to define opening and closing event handling in such a way that your own parameters could also be obtained:
          onshow="alert(event.parameters.param1)"


          Here, during modalPanel opening the value of a passing parameter is output.

          • 2. Re: rich:modalpanel how pass own parameters
            yevgen_78

            I can't set onshow to the modalpanel

            shows error, that onshow not found.
            There is no onshow method :(

            Is it possible to post whole example?

            <rich:modalpanel ...>
            ...

            • 3. Re: rich:modalpanel how pass own parameters
              ilya_shaikovsky

              Probably you just use the version where this events isabsent. Update your RF libraries.

              • 4. Re: rich:modalpanel how pass own parameters
                yevgen_78

                get the latest 3.0.1 -> nothing

                • 5. Re: rich:modalpanel how pass own parameters
                  yevgen_78

                  ok, found in 3.0.2 (nightly)

                  • 6. Re: rich:modalpanel how pass own parameters
                    asookazian

                    how can we add dynamic content to the modalPanel's header?

                    I want to do something like: "Please enter a note for " + employeeName
                    in the header

                    should I use the employeeName param that is passed via the shoModalPanel call? if so, how to append to the h:outputText for the header? or should we use <f:param> or inputHidden??

                    <rich:modalPanel id="mp" minHeight="200" minWidth="450"
                     height="200" width="500" zindex="2000">
                    
                     <f:facet name="header">
                     <!-- <h:outputText value="#{securityAuditAction.header}"/> -->
                     <h:outputText value="Note for Mike Bell"/>
                     </f:facet>
                    
                     <!--
                     <f:facet name="controls">
                     <h:graphicImage value="/img/icon_edit.gif" style="cursor:pointer" onclick="Richfaces.hideModalPanel('mp')" />
                     </f:facet>
                     -->
                     <a4j:form id="a4jForm">
                     <h:panelGrid columns="2" style="vertical-align:middle">
                     <h:outputText id="description" value="Please explain why XYZ is not approved:"/>
                     <BR/>
                     <h:inputTextarea id="noteText" value="#{noteAction.noteText}" rows="6" cols="30"/>
                     <h:inputHidden id="rowIndex" value="noteAction.rowIndex"/>
                     <h:inputHidden id="colName" value="noteAction.colName"/>
                     <h:inputHidden id="siteId" value="noteAction.siteId"/>
                     <h:inputHidden id="employeeNumber" value="noteAction.employeeNumber"/>
                     <a4j:commandButton value="submit" action="#{noteAction.submit}" onclick="showNoteGraphic();Richfaces.hideModalPanel('mp')"/>
                     <BR/>
                     <a4j:commandButton value="cancel" onclick="Richfaces.hideModalPanel('mp')"/>
                     </h:panelGrid>
                     </a4j:form>
                     </rich:modalPanel>


                    • 7. Re: rich:modalpanel how pass own parameters
                      ilya_shaikovsky

                      If you could use 3.2.0 SNAPSHOTS - there are already fixed one bug. And after fix - you'll able to reRender the whole modela panel. So just use el binding in header facet output and reRender panel before showing.