1 Reply Latest reply on Oct 15, 2008 5:17 AM by nbelaevski

    Dynamic Modal Panel

    nathandennis

      having trouble creating modal panel dynamically and no examples on forum or documentation.

      HtmlModalPanel myPanel = (HtmlModalPanel) new HtmlModalPanel();
       myPanel.setAutosized(true);
       myPanel.setId("mperror");
       myPanel.setZindex(3000);
       HtmlOutputText mes = new HtmlOutputText();
       mes.setValue("test message");
      
       myPanel.getChildren().add(mes);
       //myPanel.setShowWhenRendered(true); this breaks other mod panels???
       FacesContext.getCurrentInstance().getViewRoot().getChildren().add(myPanel);
      


      i thought this should work but it executes and no modal panel
      a little lost

      and example would be good. any help greatly appreciated

        • 1. Re: Dynamic Modal Panel
          nbelaevski

          Sure, try to add this after modal panel:

          HtmlOutputText text = new HtmlOutputText();
           text.setEscape(false);
          
           StringBuilder builder = new StringBuilder("<script type='text/javascript'>");
           builder.append(RichFunction.component("panelId"));
           builder.append("show()");
           builder.append("</script>");
          
           text.setValue(builder.toString());