-
1. Re: Need help on rich:tab issue
mars1412 Mar 19, 2008 11:58 AM (in response to rulinsun)try this:
<rich:tabPanel switchType="ajax" selectedTab="#{richTabPanelHelper.selectedTab}">
-
2. Re: Need help on rich:tab issue
rulinsun Mar 19, 2008 12:14 PM (in response to rulinsun)Thanks for the reply. This is not related to my problem. From my understanding, selectedTab tells which tab (matching the name attribute of a tab) will be selected when the page is rendered. The value can be assigned from backbean, something like in your example.
But when user changes the selectedTab by click an unselectedTab, the property value of the backbean binding by selectedTab will not change. So from backbean, you can not tell which tab is reselected. That's my problem
Thanks!
Rulin -
3. Re: Need help on rich:tab issue
mars1412 Mar 19, 2008 12:20 PM (in response to rulinsun)ah - you are using switchType client, are you?
-
4. Re: Need help on rich:tab issue
rulinsun Mar 19, 2008 12:28 PM (in response to rulinsun)No, I am using switchType="server"
-
5. Re: Need help on rich:tab issue
mars1412 Mar 19, 2008 12:51 PM (in response to rulinsun)works for me
did you actually try it? -
6. Re: Need help on rich:tab issue
rulinsun Mar 19, 2008 1:13 PM (in response to rulinsun)I tried switchType="ajax" too. I question is basically why "onclick never triggered".
As to the selectedTab, my understanding is oneway binding, you can assign a value from backbean to change selected tab (even to a tab other than user clicked), but the value in the backbean will not change when user switch tab. -
7. Re: Need help on rich:tab issue
mars1412 Mar 19, 2008 1:17 PM (in response to rulinsun)"rulinsun" wrote:
I tried switchType="ajax" too. I question is basically why "onclick never triggered".
I also have no idea."rulinsun" wrote:
As to the selectedTab, my understanding is oneway binding, you can assign a value from backbean to change selected tab (even to a tab other than user clicked), but the value in the backbean will not change when user switch tab.
I doubt that, since the code I've pasted works for me and the value of my backing bean changes, when I select a different tab.
again - did you actually try this? -
8. Re: Need help on rich:tab issue
rulinsun Mar 19, 2008 1:36 PM (in response to rulinsun)I think I know why it works for you. You put the backbean is session scope. I can't do that. The reason is if user changes the tab in one window, it will change the tab in a spawed window of same session.
-
9. Re: Need help on rich:tab issue
mars1412 Mar 20, 2008 4:39 AM (in response to rulinsun)"rulinsun" wrote:
I think I know why it works for you. You put the backbean is session scope. I can't do that. The reason is if user changes the tab in one window, it will change the tab in a spawed window of same session.
actually it's in page scope - should work 4 U. -
10. Re: Need help on rich:tab issue
ilya_shaikovsky Mar 20, 2008 5:17 AM (in response to rulinsun)if you use not client side switching just try f:param to put for example name of tab in requestParametersMap ;)
-
11. Re: Need help on rich:tab issue
rulinsun Mar 20, 2008 9:09 AM (in response to rulinsun)Thanks! This works! I like to share the codes, in the application, we have dynamic number of tabs, under each tab we have a table with dynamic number of columns and heads, we also has a customization page to allow the user change Tab display and table dimesion. All of the information can determined by selectedTab id,
source of xhtml page:
<rich:tabPanel styleClass="mytable"
selectedTab="{controller.selectedId}"
switchType="server">
<c:forEach items="#{controller.tableDefinitions}" var="definitionEntry">
<rich:tab id="#{definitionEntry.id}"
name="#{definitionEntry.id}"
label="#{definitionEntry.viewTitle}"
action="#{controller.loadTableDefinition}"
>
<f:param name="selectedTab" value="#{definitionEntry.id}" />
<c:if test="#{controller.selectedDefintion.id eq definitionEntry.id}">
<ui:include src="table_view.xhtml" >
<ui:param name="viewId" value="{definitionEntry.id}"/>
</ui:include>
</c:if>
</rich:tab>
</c:forEach>
</rich:tabPanel>
Backend
public String loadTableDefinition(){
if(getTableDefinitions()==null ||
getTableDefinitions().size()==0) {
loadDefinitionsFromDatabase();
}
FacesContext context = FacesContext.getCurrentInstance();
HttpServletRequest request =(HttpServletRequest) context.getExternalContext().getRequest();
Map<String, Object> params = request.getParameterMap();
for (String param : params.keySet()) {
if(param.equals(Constants.TAB_SELECTION_KEY)){
String[] values = (String[])params.get(param);
selectedId = values[0];
break;
}
}
...