4 Replies Latest reply on Jun 20, 2012 3:41 AM by Nicolas Drosos

    Strange problem with rich:modalPanel not updating h:inputText

    Nicolas Drosos Newbie

      Hello,

       

      I have developed an xhtml page, with a rich:dataTable where each row includes, among other fields, an h:inputText and an a4j:commandButton. When the user presses the button, a rich:modalPanel is populated where the user can do some actions affecting the rich:dataTable data of the same row where the inputText and the button exist.

       

      The strange behaviour occurs when I close the modal panel, and the h:inputText does not reflect the updated data. What is even more strange is that if I replace the h:inputText with a h:outputText it works fine!

      I have also printed the list data the rich:dataTable carries and it seems that the bean has the correct (updated) data.

       

      Could someone help me with this, because I have done many experiments trying to fix this, but no luck at all..

       

      If you need any code or snapshots to clarify things please let me know.

       

      Many thanks!

        • 1. Re: Strange problem with rich:modalPanel not updating h:inputText
          Siva P Master

          Try adding a4j:region with a4j:outputPanel ane then add the code below it.

          • 2. Re: Strange problem with rich:modalPanel not updating h:inputText
            Nicolas Drosos Newbie

            Thanks for your answer.

             

            I included my rich:datatable inside a <a4j:region>

            <a4j:region>

                                                                                              <a4j:outputPanel>

            block but no luck. I also tried to replace all h:panelgrid in my xhtml page with

            <a4j:region>

                                                                                              <a4j:outputPanel>

             

            but the problem persists.

             

            Any other ideas? What is really strange is the fact that if I replace h:inputText with h:outputText it works fine.. I was thinking that maybe rich:modalPanel is messing around with the JSF lifecycle and maybe this affects refreshing h:inputText.

            Does anyone know any alternatives to rich:modalPanel? I 'm using jsf1.2 and richfaces 3.2.

             

            Thank you.

            • 3. Re: Strange problem with rich:modalPanel not updating h:inputText
              Siva P Master

              Please share some code i will check it....Mean time try reRender the id of the component(textbox)

              or

              • 4. Re: Strange problem with rich:modalPanel not updating h:inputText
                Nicolas Drosos Newbie

                I can't reRender the h:inputText itself because it's inside the rich:dataTable and the id is generated. However I'm rerendering the h:panelGrid that contains the rich:dataTable which does the job.

                 

                This is the rich:column inside the rich:datatable:

                 

                <rich:column>

                                                                                                  <f:facet name="header">

                                                                                                    <h:outputText value="Έγκριση" /> 

                                                                                                  </f:facet>

                                                                                                  <h:panelGrid columns="2" border="0" cellspacing="2" width="100%" styleClass="panelGrid-align">

                                                                                          <h:panelGrid width="50px" columns="2" border="1" rules="cols" cellspacing="0" cellpadding="0"

                                                                                                    columnClasses="leftCol,rightCol">  

                 

                                                                                                    <h:inputText value="#{orderList.approved}" styleClass="spinnerLabel"/>

                                                                                                    <h:panelGrid width="100%" columns="1" border="0" cellspacing="0" cellpadding="0" columnClasses="innerCol">

                                                                                                              <a4j:commandButton styleClass="spinnerBtnUp" action="#{serveOrders_bean.spinnerUp}" reRender="servingPanel"

                                                                                                                        disabled="#{orderList.availableCounter == 0}">

                                                                                                                        <a4j:actionparam name="spinnerUp" assignTo="#{serveOrders_bean.spinnerIdUp}" value="#{orderList.id}"/>

                                                                                                              </a4j:commandButton>                                                                          

                                                                                                        <a4j:commandButton styleClass="spinnerBtnDown" action="#{serveOrders_bean.spinnerDown}"

                                                                                                                  reRender="servingPanel">

                                                                                                                  <a4j:actionparam name="spinnerDown" assignTo="#{serveOrders_bean.spinnerIdDown}" value="#{orderList.id}"/>

                                                                                                        </a4j:commandButton>

                                                                                                    </h:panelGrid>

                                                                                          </h:panelGrid>

                                                                                          <a4j:commandButton id="editAssignements" styleClass="editAssignementsImg" disabled="#{orderList.availableCounter == 0}" 

                                                                                                    oncomplete="Richfaces.showModalPanel('editAssignmentsPanel');"          reRender="editAssignmentsPanel">

                                                                                                    <a4j:actionparam name="editOrderAssignment" assignTo="#{serveOrders_bean.orderIdEdited}" value="#{orderList.id}"/>                                                                          

                                                                                              <rich:toolTip followMouse="true" direction="top-right" showDelay="300" styleClass="tooltip_custom">

                                                                                                                    <span  style="white-space:nowrap">

                                                                                                       Επεξεργασία Χρεώσεων

                                                                                                     </span>

                                                                                                 </rich:toolTip>

                                                                                          </a4j:commandButton>

                 

                                                                                          </h:panelGrid>

                                                                                      </rich:column>

                 

                 

                and this is the bean method that is called when I close the modal panel:

                 

                public void closeModalPanel(){

                Session session = SessionFactoryUtil.getSessionFactory().getCurrentSession();

                              Transaction tx = session.beginTransaction();

                                    for (Order o: orders){

                                        if (o.getId() == popupOrder.getId()){

                                                  o.setApproved(popupOrder.getApproved());    

                                                  determineOrderStatus(o);

                                                  session.saveOrUpdate(o);

                                                  break;

                                        }

                                    }

                                    tx.commit();

                                    submitSearch();

                                    for (Order o: orders){

                                              if (o.getId() == popupOrder.getId()){

                                                        o.setSelected(true);

                                                        break;

                                              }

                                    }
                }