10 Replies Latest reply on Nov 16, 2007 9:29 AM by swestbom

    tabPanel in client mode

    twocoasttb

      I have a <rich:tabPanel> where switchMode="client". Each of my three tabs contains its own <h:form> element. Is it possible to have this tabPanel remember the current tab when one of the forms is submitted? Is it even possible when there isn't a form element that wraps the entire tabPanel?

        • 1. Re: tabPanel in client mode

          tabPanel has selectedTab attribute. You can use EL there to set particular tab you want. selectedTab contains the value of 'name' attribute rich:tab has.

          • 2. Re: tabPanel in client mode
            twocoasttb

            Sergiy,
            Thanks for your response. Is there a proper way to capture the current tab when it is selected? Is this possible when the tabPanel is in client mode and isn't wrapped in a form?
            Tom

            • 3. Re: tabPanel in client mode

              Right. tabPanel with switchMode="client" has a pure client side behavior and has no state saving feature out-of-the-box. So, it is up to you, how you change the property that will be used in the EL for selectedTab

              • 4. Re: tabPanel in client mode
                twocoasttb

                Thanks again, Sergiy. Is 'oncomplete' supposed to work in rich:tab when rich:tabPanel is in client mode? It doesn't seem to do anything for me:

                <head>
                 <script type="text/javascript">
                 function tellMe() {
                 alert("Here!!");
                 }
                 </script>
                </head>
                
                <rich:tabPanel id="profileTabs" switchType="client">
                 <rich:tab name="profile" label="Basic Info" oncomplete="javascript:tellMe();">
                 <h:outputText value="content"/>
                 </rich:tab>
                </rich:tabPanel>


                It does work in "ajax" mode. BTW, I'm using a CVS build from around th 17th of April.

                Thanks,
                Tom


                • 5. Re: tabPanel in client mode

                  no. all Ajax-oriented attributes work only in Ajax mode. So, it works now as designed.
                  However, the idea to have some pure javascript hookups on opening and leaving the tabs is not new. Also, we have a similar request for rich:panelBar.

                  • 6. Re: tabPanel in client mode

                    Ok, we are now on version 3.1.2 and we still have no out of the box state saving on client side tabs. Don't you ever make anything real with these tag libraries, that is basic behavior

                    • 7. Re: tabPanel in client mode
                      ilya_shaikovsky

                      loot to the first two Sergey's posts. It works for all the users that asked for it before you.

                      • 8. Re: tabPanel in client mode

                        What is EL and how do I retrieve the current tab using client mode other than by rewriting the RichFaces.switchTab function to make an Ajax call to set the current tab?

                        • 9. Re: tabPanel in client mode
                          ilya_shaikovsky

                           

                          
                          <rich:tabPanel .. selectedTab="#{bean.selTab}">
                          ....
                          ....
                           <rich:tab name="somName"...>
                          ....
                          


                          So when you need the selTab property should be set to someName value.

                          • 10. Re: tabPanel in client mode

                             

                            "ilya_shaikovsky" wrote:
                            
                            <rich:tabPanel .. selectedTab="#{bean.selTab}">
                            ....
                            ....
                             <rich:tab name="somName"...>
                            ....
                            


                            So when you need the selTab property should be set to someName value.


                            That works for the initial load but once you submit a form from a tab the client doesn't keep the state of the tab and goes to the default unless I reset it with an actionListener server side, but If I do that and there is a validation error the actionListener doesn't fire and the user goes to the last tab specified server side. That is why I think a built in tab state option that works using the ajax, server or client setting is better.