3 Replies Latest reply on Feb 10, 2009 10:19 AM by santon2000

    dynamically created modal panel and show it

      Hi !
      I want create modal panel dynamical and show it.
      Button "Create" create dynamical modal panel and attach it as a children to form.
      When press button "Show" or "Show2" nothing happen. :((
      In browser (Opera) javaScript console is empty (no error).

      Jboss 5.0.0.GA
      RF 3.3.0GA

      jsp

      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="j"%>
      <%@ page contentType="text/html;charset=UTF-8"%>
      <% response.setHeader("Cache-Control","no-cache"); %>
      <% response.setHeader("Pragma","no-cache"); %>
      
      
      
      <html>
      <j:view>
       <body>
       <h:form >
      
       <a4j:status startText="In progress..." stopText="Complete">
       </a4j:status>
      
       <a4j:commandButton value="create"
       actionListener="#{TEST5RSBean.processCreateEvent}"
       />
      
      
       <a4j:commandButton id="b1" value="show">
       <rich:componentControl for="mp_id" attachTo="b1" operation="show" event="onclick"/>
       </a4j:commandButton>
      
       <a4j:commandButton value="show2"
       oncomplete="javascript:Richfaces.showModalPanel('mp_id');"/>
      
       </h:form>
       </body>
      
      </j:view>
      
      </html>
      


      JAVA
      package th.jsf.beans;
      
      import javax.faces.event.ActionEvent;
      
      import org.richfaces.component.html.HtmlModalPanel;
      
      public class test5RSBean
      {
      
       public test5RSBean()
       {
       }
      
       public void processCreateEvent(ActionEvent event) {
       HtmlModalPanel mp=new HtmlModalPanel();
       mp.setId("mp_id");
       mp.setWidth(500);
       mp.setHeight(260);
      
       event.getComponent().getParent().getChildren().add(mp);
       }
      
      }
      


      P.S. sorry for english :)

        • 1. Re: dynamically created modal panel and show it
          ilya_shaikovsky

          MP call should include form id if you not using rich:component or rich:clientId functions.

          • 2. Re: dynamically created modal panel and show it
            ilya_shaikovsky

            and by the way. Nothing reREndered - so your created panel exist only at component tree on server side but not at DOM on the client.

            • 3. Re: dynamically created modal panel and show it

               

              "ilya_shaikovsky" wrote:
              MP call should include form id if you not using rich:component or rich:clientId functions.


              When press "Show3" - nothing, reRender - nothing,
              setting form_name:modal_panel_id - nothing .

              Or syntax error in jsp?

              Also tested when modal panel attach as children to then viewRoot.



              JSP

              
               <body>
               <h:form id="main_form">
              
               <a4j:status startText="In progress..." stopText="Complete">
               </a4j:status>
              
               <a4j:commandButton value="create"
               actionListener="#{TEST5RSBean.processCreateEvent}"
               />
              
               <a4j:commandButton value="create2"
               actionListener="#{TEST5RSBean.processCreateEvent2}"
               />
              
              
               <a4j:commandButton id="b1" value="show"
               reRender="mp_id">
               <rich:componentControl for="main_form:mp_id" attachTo="b1" operation="show" event="onclick"/>
               </a4j:commandButton>
              
               <a4j:commandButton value="show2"
               reRender="main_form:mp_id"
               oncomplete="javascript:Richfaces.showModalPanel('main_form:mp_id');"/>
              
               <a4j:commandButton value="show3"
               reRender="mp_id"
               oncomplete="javascript:rich:component('mp_id').show();"/>
              
              
               </h:form>
               </body>