-
1. Re: Still can't get selectedTab dynamic binding to work
ilya_shaikovsky Aug 26, 2010 9:58 AM (in response to jgreene)I'm not sure about which issue you talking.. and just decided to show example which seems show the answer to the questions listed
<h:form> <rich:tabPanel switchType="ajax" selectedTab="#{userBean.name}" id="tp"> <rich:tab label="First tab" name="first"> Here is tab #1 </rich:tab> <rich:tab label="Second tab" name="second"> Here is tab #2 </rich:tab> <rich:tab reRender="#{userBean.thirdRendered}" name="third" label="Third"> Here is tab #3 </rich:tab> </rich:tabPanel> <a4j:commandButton value="switch To 2" reRender="tp"> <a4j:actionparam name="sec" value="second" assignTo="#{userBean.name}"/> </a4j:commandButton> <a4j:commandButton value="switch to 3 and make it rendered" reRender="tp"> <a4j:actionparam name="thiR" value="#{true}" assignTo="#{userBean.thirdRendered}"/> <a4j:actionparam name="thiird" value="third" assignTo="#{userBean.name}"/> </a4j:commandButton> </h:form>
clicking to the first button - TP switched to second tab. and to the third one - third tab became rendered and switched to. the whole panel switched in ajax mode if controls used.
-
2. Re: Still can't get selectedTab dynamic binding to work
jgreene Aug 26, 2010 10:23 AM (in response to ilya_shaikovsky)Thanks for the reply, Ilya. However, one difference that I think is important with what I described is that for my example, the 3rd tab will not exist until the link is clicked, which will set a bean property on the back end. In the same action method, a string property is set to reference the name of the 3rd tab. Then when the component rerenders, the 3rd tab will be included (because I use its "rendered" attribute) in the TP, and it will be selected. All of this works for me except the tab does not change. The content for the 3rd tab is rendered, but the 3rd tab is not at the front.
I hope this makes sense.
-
3. Re: Still can't get selectedTab dynamic binding to work
jgreene Aug 27, 2010 4:44 PM (in response to ilya_shaikovsky)Ilya -
I want to try using the undocumented Richfaces.switchTab function to switch the tab on the "oncomplete" event. Here's an example I found on how to use it:
http://raogkalavar.blogspot.com/2008/09/switching-tab-via-javascript-in.html
In this example, it says to use the tab "name", but the example markup uses the "label" attribute, while the "name" attribute is not even used. Can you please clarify exactly how to use this javascript function, and which attribute values to pass in to the function? Thank you.
- Joe