I have a page with a <p:tabView> element in it with several tabs. What I want to do is add a request parameter to the URL for the page so that when the view is constructed a selected tab is displayed, rather than just the first tab.
So if the URL "./util.xhtml" shows the page with the first tab, the URL "./util.xhtml?tab=foo" shows the page with the tab with title="foo". Is there any way to do this?
BTW, how about a "bookmark this page" component for Primefaces? Or is there one already I missed?
Book-markable tab?
-
- Posts: 23
- Joined: 25 Oct 2011, 22:33
I am also interested in how to bookmark tabs from a tabview element. Is there a good way to do this?
-
- Posts: 409
- Joined: 28 Dec 2011, 17:44
metadata and includeviewparams can help to implement such a thing. But you have some work to do before
Another problem is, that if you want to use your browser to bookmark a page, the URL must be changed. And therefore you need a page request for each tab change
Another problem is, that if you want to use your browser to bookmark a page, the URL must be changed. And therefore you need a page request for each tab change
Primefaces 8.0.7 (PF Extensions 8.0)
JSF: Mojarra 2.3.2 (Spec 2.3) - running on WildFly 22
JSF: Mojarra 2.3.2 (Spec 2.3) - running on WildFly 22
Well, not always. You can make the tab title a link as well and if you make that the correct link, you can right-click on the header and do 'bookmark this as...'. Our users got that quicklyHamsterbau wrote:Another problem is, that if you want to use your browser to bookmark a page, the URL must be changed. And therefore you need a page request for each tab change
-
- Posts: 409
- Joined: 28 Dec 2011, 17:44
That's write, but what i meant with "if you want to use your browser to bookmark a page" is the default behaviour or shortcut of the current used browser, taking the current URL as bookmark.
There are also solutions for different browser types using JavaScript to create a bookmark. But it depends on the used browser.
There are also solutions for different browser types using JavaScript to create a bookmark. But it depends on the used browser.
Primefaces 8.0.7 (PF Extensions 8.0)
JSF: Mojarra 2.3.2 (Spec 2.3) - running on WildFly 22
JSF: Mojarra 2.3.2 (Spec 2.3) - running on WildFly 22
- andyba
- Expert Member
- Posts: 2473
- Joined: 31 Mar 2011, 16:27
- Location: Steinfeld, near Bremen/Osnabrück, DE
- Contact:
Unless you cause tab changes to also change the current URL you will not be able to have the page bookmarked easily.
So each tab change is going to require that the browser location is rewritten with the activeTab as a get parameter in it which will cause a complete round trip to the server.
Or you can add a bookmark widget on that page (plenty of JQuery ones about) and set it up to use the current URL with the activeTab as a get parameter in it.
The rest is then simply about capturing the get param in the page and setting the appropriate bean property
So each tab change is going to require that the browser location is rewritten with the activeTab as a get parameter in it which will cause a complete round trip to the server.
Or you can add a bookmark widget on that page (plenty of JQuery ones about) and set it up to use the current URL with the activeTab as a get parameter in it.
The rest is then simply about capturing the get param in the page and setting the appropriate bean property
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
-
- Posts: 23
- Joined: 25 Oct 2011, 22:33
I know there's jQuery plugins to create bookmarkable tabs and i think it'd be nice to just have an attribute on the tabView to set the tabs to be bookmarkable or not. Idea for future primefaces release??
Not sure, but I think it's not easy with PF own TabView widget. In PF Extensions I use jQuery Tabs in tabbed Layout and done bookmarkable tabs very easy. Showcase: http://fractalsoft.net/primeext-showcas ... gement.jsf
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Should be easy, create a viewparam and bind it to the property that is also bound to activeIndex of tabview.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 6 guests