2 Replies Latest reply on Apr 19, 2011 4:16 AM by jobmathew

    Modal panel on If Condition Richface 3.3

    jobmathew

      HI,

       

      I wanted to pop up a modal panel depending on the certian condition.

       

      I have tried two different kind of codes but not yet success,

       

      Any help is highly appricated.

       

      first method

       

          <a4j:commandButton  value="Finish" action="#{bean.finish}" reRender="hForm" oncomplete="if(testcaseBean.showModalPanel) Richfaces.showModalPanel('modalPanel')" >

                                                       <f:setPropertyActionListener value="#{record.row}" target="#{bean.collection}" />

                                                   </a4j:commandButton>

       

      showModalPanel :- Is a boolean value in the backing bean.

       

      second method

       

        <a4j:commandButton  value="Finish" action="#{bean.finish}" reRender="hForm" oncomplete="#{bean.launchModalPanel()}" >

                                                       <f:setPropertyActionListener value="#{record.row}" target="#{bean.collection}" />

                                                   </a4j:commandButton>

       

          public void launchModalPanel() {

       

              FacesContext context = Utility.getFacesContext();

              UIComponent component = context.getViewRoot().findComponent("modalPanel");

              HtmlModalPanel panel = (HtmlModalPanel) component;

              panel.setRendered(true);

              panel.setShowWhenRendered(true);

              panel.saveState(context);

       

          }