You need to sign in to do that
Don't have an account?

How to use switchType
Hi,
I'm having troubles with the switchType part of a tabPanel. I can't tell a difference between ajax and server, and client breaks my page by making everything centered and not letting me click any tabs.
I'm trying to have the controller force a tab change by using selectedTab="{!selectedTab}", then having the controller simply change that selectedTab variable. Has anyone made that work?
Also, does anyone have a sample style sheet to change that default green color?
Thanks!
dsl
I'm having troubles with the switchType part of a tabPanel. I can't tell a difference between ajax and server, and client breaks my page by making everything centered and not letting me click any tabs.
I'm trying to have the controller force a tab change by using selectedTab="{!selectedTab}", then having the controller simply change that selectedTab variable. Has anyone made that work?
Also, does anyone have a sample style sheet to change that default green color?
Thanks!
dsl
here is a working sample, slightly modified from the documentation
controller:
The SwitchType property of a TabPanel has three different options: Client, Server and Ajax.
To explain the difference between all of them, I have built a small sample:
To understand how this works, try one tabPanel at a time.
For SwitchType="Client": The inputText box on "Tab 2" does not get filled.
For SwitchType="Server": The inputText box on "Tab 2" does indeed get filled, but the entire page gets refreshed.
For SwitchType="Ajax": The inputText box on "Tab 2" does indeed get filled, but the only a section of the page gets refrehed.
Andres,
I found your explanation very helpful. Your example should be added to the the vForce documenation since it isn't helpful on this topic at all.
Regards,
Tyler
This is one of the very few threads I've seen discussing the switchType attribute on the tabPanel, so I figured I'd contribute the problem I had today in the hopes that someone will find it useful.
Today I ran into a problem where I had identical selectLists across five different tabs, but the controller variable would not update according to the value in the SelectList unless I changed the SelectList on the last tab. After a lot of experimenting, I finally figured out that it was being caused by the switchType="client" attribute on the tabPanel. If I had to guess, I'd say that all of my SelectLists were being laoded simutaniously, and since only one of them could be linked back to controller variable, only the SelectList on the last tab was actually functional.
Switching to ajax or server as the switchType did fix the problem, but I wanted to keep the fast load times between tabs, and so I solved the problem by creating five different variables in the controller, one for each tab's SelectList. I won't say it was the cleanest solutions, but it fixed the problem without sacrificing speed when changing tabs.
Hope this was helpful, and I'd be happy to hear if anyone has a better solution!
use switch type="client" for better performance
thank you for your example.
Hi.. i am from argentina and I am not a developer but I had to study and try new things sometimes without understanding what I am doing.
I have been using "client" and that works fine for the speed but in some of the pages that are included in the tabs we are using more menus of the following sort that I put later on.. but the problem is that with this vertical menues tha pages do not work as all the content of each section appear one below the other.. any suggestions?
<ul class="nav nav-tabs" id="tabnav" style="width:130px" align="left">
<li class="active"><a class="active" href="#tab1">Introducción</a></li>
<li><a href="#tab2">El Compromiso</a></li>
<li><a href="#tab4">El Voluntario</a></li>
<li><a href="#tab6">La Tecnología</a></li>
<li><a href="#tab7">Los Puestos</a></li>
<li><a href="#tab8">Las Noticias</a></li>
<li><a href="#tab9">Próximos Pasos</a></li>
</ul>
and then
<div id="tabs" align="left">
<div class="tab-pane" id="tab1"><a name="tab1"></a>
Thanks for your explanation on switch type.
But I have one another prob ....
Iam using a command button inside a tab (tabpanel switchType='client') and the command button is not working.
can you plz help me out...