3 Replies Latest reply on May 6, 2008 4:38 PM by Dongyao Zhao

    how to show modalPanel dynamically?

    1 1 Newbie

      Hi, I'm having some troubles to perform an action before showing a modal panel...

      <h:commandLink value="Link">
       <a4j:support action="#{AnyManagedBean.anyAction}"
       event="onclick" reRender="panel"
       oncomplete="javascript:Richfaces.showModalPanel('panel');" />
      </h:commandLink>
      ...
      <rich:modalPanel id="panel">
       ...
      </rich:modalPanel>
      



      Is that another way?

        • 1. Re: how to show modalPanel dynamically?
          1 1 Newbie

          Sorry, I forgot to mention that the action goes fine and the modal panel is shown for a few seconds...

          • 2. Re: how to show modalPanel dynamically?
            1 1 Newbie

            This is not working to...

            <h:outputLink value="#">
             <h:outputText value="Link" />
             <a4j:support action="#{AnyManagedBean.anyAction}"
             event="onclick" reRender="panel"
             oncomplete="javascript:Richfaces.showModalPanel('panel');" />
            </h:outputLink>
            ...
            <rich:modalPanel id="panel">
             ...
            </rich:modalPanel>
            


            The action goes fine... but nothing is shown...

            • 3. Re: how to show modalPanel dynamically?
              Dongyao Zhao Novice

              I have the same problem, i have a modalPanel, in which there is a rich:scrollableDataTable, with an action it causes a new modalpanel.
              Problem is:
              the new modalpanel shows only the first selcted row. can not be rerendered.

              <ui:composition xmlns="http://www.w3.org/1999/xhtml"
               xmlns:f="http://java.sun.com/jsf/core"
               xmlns:h="http://java.sun.com/jsf/html"
               xmlns:rich="http://richfaces.org/rich"
               xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
               xmlns:ui="http://java.sun.com/jsf/facelets"
               xmlns:dim="http://dimetis.de/jsf">
              <rich:scrollableDataTable width="510px" id="UserTable"
               value="#{userManagementDialogBean.users}" var="user"
               selection="#{userManagementDialogBean.selection}"
               rowClasses="taskRows" columnClasses="taskColumns">
               <rich:column width="130px">
               <f:facet name="header">
               <h:outputText value="Name"/>
               </f:facet>
               <h:outputText value="#{user.name}" />
               </rich:column>
              
               <rich:column width="120px">
               <f:facet name="header">
               <h:outputText value="Creation Time"/>
               </f:facet>
               <h:outputText value="#{user.creationTimeString}" />
               </rich:column>
               <rich:column width="60px">
               <f:facet name="header">
               <h:outputText value="Admin"/>
               </f:facet>
               <h:selectBooleanCheckbox value="#{user.admin}" disabled="#{user.name==mainBean.user}"/>
               </rich:column>
               <rich:column width="60px">
               <f:facet name="header">
               <h:outputText value="Delete"/>
               </f:facet>
               <h:selectBooleanCheckbox value="#{user.toBeDeleted}" disabled="#{user.admin!=false}" />
               </rich:column>
               </rich:scrollableDataTable>
               <br/>
               <a4j:commandButton value="Create User" action="#{userManagementDialogBean.createUser}" />
               <a4j:commandButton value="Change User" action="#{userManagementDialogBean.takeSelection}"
               oncomplete="Richfaces.showModalPanel('changeUserId')" reRender="userInfoId" ajaxSubmit="true" />
               <br/>
              </ui:composition>
              


              the code of the new modalpanel
              <a4j:outputPanel id="userInfoId">
               <h:panelGrid columns="2">
               <h:outputLabel value="Name" for="nameId" />
               <h:inputText id="nameId" value="#{userManagementDialogBean.selectedUser.name}" />
               <h:outputLabel value="Password" for="pwId" />
               <h:inputText id="pwId" value="#{userManagementDialogBean.selectedUser.password}" />
               <h:outputLabel value="New Password" for="npwId" />
               <h:inputSecret id="npwId" value="#{userManagementDialogBean.newPwd}" required="true" />
               <h:outputLabel value="Re-type" for="rpwId" />
               <h:inputSecret id="rpwId" required="true" >
               <f:validator validatorId="passwordValidator" />
               <f:attribute name="passwordId" value="j_id766:j_id769:npwId" />
               </h:inputSecret>
               <h:message for="rpwId" style="color: red;"/>
               </h:panelGrid>
               </a4j:outputPanel>