7 Replies Latest reply on Apr 26, 2013 11:16 PM by peter.falken

    Rerender problem on popup panel

    valucky

      Hi all,

       

      We have a problem with rerender in RichFaces 4.2.2.Final.

      Some page what we made, it contains popup panel.

      the method which showing the popup like this

       

      <a4j:commandButton

                              styleClass="standardButton"

                              value="#{property.someThing}"

                              action="#{bean.action}"

                              render="contentClientId"

                              oncomplete="#{rich:component('panelName')}.show();"/>

       

      but after showing the popup contains old data and 1-2 seconds later refresh and we can see the correct datas.

      we tried some techniques and hacks, but we doesn't find a solution.

       

      somebody has a solution for this problem or any idea?

       

      Thank you

       

      regards

      Andras

        • 1. Re: Rerender problem on popup panel
          michpetrov

          Hi,

           

          the panel does not automatically rerender when you show it. Additionally the panel is rendered at the end of <body> by default so even if the <rich:popupPanel> is inside the "contentClientId" the panel itself isn't (and does not rerender).

           

          You can fix it either by specifying the panel's id in the render attribute or adding domElementAttachment="parent" to the popupPanel.

          • 2. Re: Rerender problem on popup panel
            valucky

            Hi,

             

            Ok, i know this. I use render="contentClientId", where "contentClientId" is the container element which contains the popup data.

            the problem is, the popup refresh too late. first time show the oldest data and some seconds later the popup will show the correct data.

             

            Thanks

            Andras

            • 3. Re: Rerender problem on popup panel
              michpetrov

              Well, it's not the button that's the issue. What does the popup panel and the bean.action method look like?

              • 4. Re: Rerender problem on popup panel
                valucky

                The action is collect data which need in popup.

                Action is fired and the getters called before popup show.

                But the popup shows the old data (preview call) in turn the correct data is stored the object in background. And 1-2 seconds later refreshing the items on the popup without any user action

                 

                Thanks

                • 5. Re: Rerender problem on popup panel
                  michpetrov

                  I need to see the code

                   

                  You can try putting <a4j:log> on the page and checking what triggers the render. Another thing that occured to me is that the commandButton is probably executing the whole page, add execute="@this" to it.

                  • 6. Re: Rerender problem on popup panel
                    valucky

                    yes, you want to see, but my boss said he doesn't want to see

                     

                    i will try a4j:log

                     

                    Thanks

                    • 7. Re: Rerender problem on popup panel
                      peter.falken

                      Valucky,

                      The code that you're looking for is this:

                       

                           <a4j:commandButton value="Edit">
                                     <a4j:ajax listener="#{someBean.load(item.id)}" oncomplete="#{rich:component('popup')}.show();" />
                           </a4j:commandButton>
                      

                       

                      This will trigger the action and after the AJAX call has completed - then it will show the popup panel.

                      I stumbled with the same problem you're having about a week ago. This code shows how I solved it.

                      Please tell your boss that OpenSource is about sharing knowledge & not about hiding code + implementations.

                       

                      Luis