I have a proposal for tabview to add a facility to create bookmarkable URLs for the each tab, out of the box.
It should update URLs in the address bar as the tab in a Tabview component change thereby providing a facility to create bookmark-able URLs very easily..
Does that make sense ? Can primefaces make this job easier for us ?
Proposal for bookmarkable URLs creation facility for tabview
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Why don't you send the activeIndex as a view parameter and then bind the backing property to the tabview's activeIndex option. JSF2 does it for you already.
I had the same question but I don't understand the answer.
Is the suggestion to do this?
If that works so far so good, but how does the "activeTab=" string get appended to the URL that the user bookmarks?
Is the suggestion to do this?
Code: Select all
<p:tabview activeIndex=#{request[activeTab]} ..
Netbeans 7.1, GlassFish 3.1.1, MacOS X 10.6.8, Safari, Firefox
-
- PrimeFaces Core Developer
- Posts: 3979
- Joined: 03 Dec 2010, 14:11
- Location: Bavaria, DE
- Contact:
use f:viewParams, map it to a variable of a bean (for example: #{myPageBean.activeIndex}) and set activeIndex=#{myPageBean.activeIndex}
Thomas Andraschko
PrimeFaces | PrimeFaces Extensions
Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE
Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko
PrimeFaces | PrimeFaces Extensions
Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE
Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko
OK so far. I modified my page like this:
If I modify the URL manually to append "activeTab=x" it will bring up tab x. Now what is needed is to add something to the p:tab elements so that when they are clicked, the URL currently visible gets changed so that if the user then selects "bookmark this page" in his browser that will be saved in the bookmark. Is there a best practice for that or do I have to add some javascript called by onTabChange?
Code: Select all
<ui:define name="content">
<f:metadata>
<f:viewParam name="activeTab" value="#{login.activeTab}" />
</f:metadata>
<p:tabView activeIndex="#{login.activeTab}">
<p:tab title="Tab The First">
Stuff in the First Tab
</p:tab>
<p:tab title="Second Tab">
Second Tab Stuff Goes Here
</p:tab>
<p:tab title="Tab 3">
Everything about 3
</p:tab>
</p:tabView>
</ui:define>
Netbeans 7.1, GlassFish 3.1.1, MacOS X 10.6.8, Safari, Firefox
-
- Information
-
Who is online
Users browsing this forum: No registered users and 44 guests