0 Replies Latest reply on Jun 6, 2008 10:18 AM by leiras

    Show modalPanel dynamically

      Hi,

      i have a modalPanel created dynamically. Here is the code:

       private HtmlModalPanel mountModalPanelErrors() {
       HtmlModalPanel mp = new HtmlModalPanel();
       mp.setId("mpTeste");
      
       HtmlForm form = new HtmlForm();
       form.setId("formTeste");
      
       HtmlAjaxCommandButton btFechar = new HtmlAjaxCommandButton();
       btFechar.setId("btFechar123");
       btFechar.setValue("Fechar");
       btFechar.setLimitToList(false);
       btFechar.setOncomplete("javascript:Richfaces.hideModalPanel('mpTeste')");
       btFechar.setStyleClass("button");
       mp.getChildren().add(form);
      
       return mp;
       }
      


      The ModalPanel is an attribute of my ManagedBean (called Origem), and is created on the constructor. Like this:

      public Origem() {
       this.mp = this.mountModalPanelErrors();
      }
      


      I don't know how to show it dynamically. I tried this

      this.getMp().setRendered(true);
      this.getMp().setShowWhenRendered(true);
      


      with no success. Any idea? Thanks a lot.