1 Reply Latest reply on Jan 24, 2013 10:31 AM by Chris Dollar

    a4j:poll causes problems with rich:tabPanel with switchType=ajax

    Chris Dollar Novice

      I'm noticing that the firing of an a4j:poll can cause problems with a rich:tabPanel when switchType is set to ajax. The behavior is either clicking on a tab (so as to change tabs) either results in no change at all, or the tabs will change and then quickly change back to the old selected tab. The behavior is random in the fact that not ever click to change tabs causes the bad behavior, but if you click enough times it is always reproducable for me. Changing the frequency of the poll firing to something really quick (like 1 second) exaggeratesthe problem so that it occurs more often.

       

      I am able to reproduce the behavior in the RF showcase. Using a fresh checkout of showcase from today, deployed to the "all" configuraiton of a fresh AS6.1 install, the following patch was all that was required to get the behavior to show up.

       

      diff --git a/src/main/java/org/richfaces/demo/togglepanel/DynamicPanelBean.java b/src/main/java/org/richfaces/demo/togglepanel/DynamicPanelBean.java

      index da1056e..1d7df55 100644

      --- a/src/main/java/org/richfaces/demo/togglepanel/DynamicPanelBean.java

      +++ b/src/main/java/org/richfaces/demo/togglepanel/DynamicPanelBean.java

      @@ -16,4 +16,8 @@ public class DynamicPanelBean {

           public void setActiveTab(String activeTab) {

               this.activeTab = activeTab;

           }

      +

      +    public void pollAction() {

      +        // do something

      +    }

      }

      diff --git a/src/main/webapp/richfaces/tabPanel/samples/dynamic-sample.xhtml b/src/main/webapp/richfaces/tabPanel/samples/dynamic-sample.xhtml

      index bbf66aa..8a35b82 100644

      --- a/src/main/webapp/richfaces/tabPanel/samples/dynamic-sample.xhtml

      +++ b/src/main/webapp/richfaces/tabPanel/samples/dynamic-sample.xhtml

      @@ -4,7 +4,7 @@

           xmlns:rich="http://richfaces.org/rich">

       

           <h:form>

      -   

      +       <a4j:poll id="testPoll" action="#{dynamicPanelBean.pollAction()}" interval="1000" render="@none" execute="@this" limitRender="true"/>

               <rich:tabPanel activeItem="#{dynamicPanelBean.activeTab}">

              

                   <rich:tab header="Static">

      @@ -44,4 +44,4 @@

                   </a4j:repeat>

               </rich:tabPanel>

           </h:form>

      -</ui:composition>

      \ No newline at end of file

      +</ui:composition>

       

       

      Again, the "bad" behavior isn't for each click, but if pretty easy to reproduce.

       

      Should I file this as an issue in jira?

        • 1. Re: a4j:poll causes problems with rich:tabPanel with switchType=ajax
          Chris Dollar Novice

          Bump. It appears that my patch I pasted in lost it's formatting - if the changes are unclear I can post it again.

           

          I'd like to note that I realize that polling every 1 second is ridiculous, and I understand that. Howerver, the bad behavior seems the same no matter what the interval of the poll is. It seems to be more a timing issue of the poll firing when the ajax tab change is also firing. But like I said above, setting the poll to 1 second exaggerates the bad behavior.

           

          Can someone from RF please comment on this? I'd really appreciate it.