1 2 Previous Next 24 Replies Latest reply on Mar 18, 2011 9:16 AM by ilya_shaikovsky Go to original post
      • 15. Re: Rich Modal Panel backing bean problems
        francescototti

        Its being updated.

         

         

        This is whats happening.

         

         

        When I click on add button, it will submit the whole form and data will be update. THE PROBLEM, THE MODAL PANEL CLOSES!

         

         

        However, if I do the buttong a4j commanbutton and rerender just the table inside the modal panel the problem will be that data wont be updated

         

         

        whatever i do in my code, i get either result 1 or result 2.

         

         

         

         

        what i want is modal panel not to close and data be upated on add button click.    

        • 16. Re: Rich Modal Panel backing bean problems
          liuliu

          hi

          why you use onclick to open the modalpanle not oncomplete, i think that is why it is closed after action.

          • 17. Re: Rich Modal Panel backing bean problems
            nbelaevski

            Ok, just to be sure how the code actually looks like, can you please post the code that contains h:commandButton & a4j:commandButton side-by-side?

            • 18. Re: Rich Modal Panel backing bean problems
              francescototti

              same result.

               

               

              here is the code for the 2 cases

               

               

              <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
              <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
              <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
              <!-- RichFaces tag library declaration -->
              <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
              <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
              
              
              
              <html>
              <head>
              <style type="text/css">
              .dr-mpnl-pnl {
                  overflow: auto !important
              }
              </style>
              
              
              <title>Global Events</title>
              
              </head>
              
              <body>
              </body>
              <f:view>
              
              
              
                  <h:form id="zForm">
                      <rich:toolBar>
                          <a4j:commandLink reRender="panel" ajaxSingle="true"
                              action="#{events.addForm}"
                              oncomplete="Richfaces.showModalPanel('pn1',{width:620, height:420, top:50})"
                              value="Add">
              
                          </a4j:commandLink>
              
                      </rich:toolBar>
              
                  </h:form>
              
              
                  <rich:modalPanel id="pn1">
              
              
              
                      <h:panelGrid id="panel">
              
                          <h:form id="betaForm">
              
                              <a4j:commandLink reRender="appTablet" ajaxSingle="true" value="Add"
                                  action="#{events.addRow}">
              
                              </a4j:commandLink>
              
              
                              <rich:dataTable rows="0" id="appTablet" var="item"
                                  value="#{events.eventList}" width="100%">
              
              
              
              
              
                                  <rich:column>
                                      <f:facet name="header">
                                          <h:outputText styleClass="font" value="Name" />
                                      </f:facet>
                                      <h:inputText styleClass="font" id="itemNames" maxlength="239"
                                          value="#{item.name}">
              
                                      </h:inputText>
              
              
                                  </rich:column>
              
              
              
              
              
                              </rich:dataTable>
              
                          </h:form>
              
              
                      </h:panelGrid>
              
              
              
              
                  </rich:modalPanel>
              
              </f:view>
              
              </html>
              

               

               

              by the above, the modal panel wont close.but values in the table wont be submitted.

               

               

               

               

              <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
              <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
              <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
              <!-- RichFaces tag library declaration -->
              <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
              <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
              
              
              
              
              <html>
              <head>
              <style type="text/css">
              .dr-mpnl-pnl {
                  overflow: auto !important
              }
              </style>
              
              
              
              <title>Global Events</title>
              
              
              </head>
              
              
              <body>
              </body>
              <f:view>
              
              
              
              
                  <h:form id="zForm">
                      <rich:toolBar>
                          <a4j:commandLink reRender="panel" ajaxSingle="true"
                              action="#{events.addForm}"
                              oncomplete="Richfaces.showModalPanel('pn1',{width:620, height:420, top:50})"
                              value="Add">
              
              
                          </a4j:commandLink>
              
              
                      </rich:toolBar>
              
              
                  </h:form>
              
              
              
                  <rich:modalPanel id="pn1">
              
              
              
              
                      <h:panelGrid id="panel">
              
              
                          <h:form id="betaForm">
              
              
                              <h:commandLink  value="Add"
                                  action="#{events.addRow}">
               
              
                              </h:commandLink>
              
              
              
                              <rich:dataTable rows="0" id="appTablet" var="item"
                                  value="#{events.eventList}" width="100%">
              
              
              
              
              
              
                                  <rich:column>
                                      <f:facet name="header">
                                          <h:outputText styleClass="font" value="Name" />
                                      </f:facet>
                                      <h:inputText styleClass="font" id="itemNames" maxlength="239"
                                          value="#{item.name}">
              
              
                                      </h:inputText>
              
              
              
                                  </rich:column>
              
              
              
              
              
              
                              </rich:dataTable>
              
              
                          </h:form>
              
              
              
                      </h:panelGrid>
              
              
              
              
              
                  </rich:modalPanel>
              
              
              </f:view>
              
              
              </html>
              
              

               

              by the above modal panel will close. the whole page will be submitted.The values the user inserts into the table are submitted and set in the backing bean.

               

               

              the difference between the two codes above is this inside the modalpanel

               

                           <a4j:commandLink reRender="appTablet" ajaxSingle="true"  value="Add"
                                  action="#{events.addRow}">

               

                              </a4j:commandLink>

               

               

                           <h:commandLink  value="Add"
                                  action="#{events.addRow}">

               

                              </h:commandLink>

              • 19. Re: Rich Modal Panel backing bean problems
                nbelaevski

                ajaxSingle="true" is the reason of such behavior.

                • 20. Re: Rich Modal Panel backing bean problems
                  francescototti

                  thank u very much, it just worked.

                   

                   

                  I spent 3 days on it, and finally it worked. I did another solution to it tho, but i didnt post it here because it was weak solution.

                  on every change of inputtext i was setting the bean manually on server side.

                   


                              <rich:column>
                                  <f:facet name="header">
                                      <h:outputText styleClass="font"  value="Name" />
                                  </f:facet>
                                      <h:inputText valueChangeListener="#{events.range}" styleClass="font" id="itemNames" maxlength="239" value="#{item.name}" >
                                      <a4j:support event="onchange"  >
                                      <f:param name="krik" value="#{curRow}"></f:param>
                                      </a4j:support>
                              </h:inputText>
                                 
                              
                              </rich:column>

                   

                   

                  finally i dont need this workaround.

                   

                   

                  THANK YOU!    

                  • 21. Re: Rich Modal Panel backing bean problems
                    ricardoq

                    Hi:

                    I got a problem with a rich:dataTable into a rich:modalPanel.

                    Row's atributtes I set on xhtml form didn't go by to the server side.

                    I had to set an <h:form> tag on modal panel so that row's attributes started going by to the server side.

                    like this:

                    <ui:composition ...>

                        <rich:modalPanel id="modalPanelId"  ... >

                            <h:form> ...

                    • 22. Re: Rich Modal Panel backing bean problems
                      nbelaevski

                      Hi Ricardo,

                       

                      I'm not getting what is the problem, can you please clarify (add more detailed code snippets at least)?

                      • 23. Re: Rich Modal Panel backing bean problems
                        chetankpr

                        Try putting modalpanel in <f:subview>

                        • 24. Re: Rich Modal Panel backing bean problems
                          ilya_shaikovsky

                          that should not be the cause of such behavior I belive.

                          1 2 Previous Next