Deciding Which Tab to Show Based on a Page Parameter

A quick note to show two basic concepts - the question on OTN was how can I control which tab in an af:panelTabbed will be shown when a page is open based on a parameter.

The first thing you need is a parameter that you pass to a page (or a taskflow) - if you are using the adfc-config.xml you can click your page and add a parameter to it. Something like:

<?xml version="1.0" encoding="windows-1252" ?>
<adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
  <view id="untitled2">
    <page>/untitled2.jsf</page>
    <input-page-parameter id="__1">
      <from-value>#{param.p1}</from-value>
      <to-value>#{viewScope.p1}</to-value>
    </input-page-parameter>
  </view>
</adfc-config>

 Another sample here .

 Then you can access this viewScope parameter (p1) in your page.

Then for each of your showdetailItem you are going to set the disclosed property to be a conditional EL expression - something like this:

<af:showDetailItem text="tab1" id="sdi1" disclosed="#{(viewScope.p1 == '1')? true : false}">

 and

<af:showDetailItem text="tab2" id="sdi2" disclosed="#{(viewScope.p1 == '1')? false : true}">

When you run the page you can pass the parameter on the url as : untitled1.jsf?p1=2&....

 and the right tab will show up.


Comments:

Nice post. Thank you for all you do.

I have quick question.

I have 2 tabs on the top - panel tabbed (read only tree listing)
I have 2 tabs in the bottom corresponding to to the top tabs. (panel form)

How do I make bottom tab1 to show up when the top tab1 is clicked and viceversa.

Thanks

Posted by guest on September 10, 2011 at 12:06 PM PDT #

Thanks Shay for the above tip. Do you know if there is a way to have tabs show up in WebCenter Analytic reports? We would like to know often the tabs are used.

Posted by guest on September 12, 2011 at 06:17 AM PDT #

gues - to synch tabs across the page I would suggest writing code in the disclose Listener of the each showDetail - in that code you can set the disclose property of other tabs on the page to true.

Posted by Shay on September 12, 2011 at 06:41 AM PDT #

Guest - I am not too familiar with WebCenter Analytic, so I don't know what level of tracking it offers.
Of course you can always write a little dicloseListener that log these type of things for you.

Posted by Shay on September 12, 2011 at 06:43 AM PDT #

One issue we are experiencing with our tabs currently is we have some custom jQuery functions on our page that are called on the document.ready() function of our page. The document.ready() function does not seem to get called when clicking on a tab. Are you aware of another event we can tie our jQuery functions to instead of the normal document.ready() when using tabs?

Posted by Nick Olmsted on September 14, 2011 at 07:41 AM PDT #

when adding parameter p1 as follows or via property palette

<input-page-parameter id="__1">
<from-value>#{param.p1}</from-value>
<to-value>#{viewScope.p1}</to-value>
</input-page-parameter>
to my adfc-config.xml, i get an error:
invalid EL token "param.p1"

how do i declare param.p1?

Posted by ebox999 on November 11, 2011 at 06:35 PM PST #

regarding my previous postt, there was a misunderstanding
coming from the design-time warning.
ignoring it let me succeed.

Posted by guest on November 16, 2011 at 07:59 PM PST #

i have created a paneltabbed in that there are 5 showdetailitem but i want show perticular showdetailitem onload as now it shows previous selected showdetailitem

Posted by guest on February 04, 2012 at 03:25 AM PST #

guest - how about setting up the parameter to the page in a method call that you place in your page flow before you reach the page?

Posted by Shay on February 06, 2012 at 11:24 AM PST #

Shay, your download & some docs referencing link is giving 404. Where did you shift blog url ?

Posted by guest on May 21, 2012 at 03:33 AM PDT #

guest - for broken links on this blog see if this entry helps:

https://blogs.oracle.com/shay/entry/fixing_broken_links_to_entries

Posted by Shay on May 21, 2012 at 09:36 AM PDT #

How do we achieve this when change persistence is enabled? For instance, let's say we set the disclose property of tab 3 to true. When we navigate to the page the first time, the 3rd tab will be opened by default. Now the user opens the 5th tab. This disclosure action is persisted in the DB. If we navigate out and come back to this page later, instead of the default tab (3rd tab), 5th tab would be opened.

Is there a way to override this behavior? We don't want to turn off the persistence feature as it is mandatory.

Posted by Subhash on August 02, 2012 at 12:39 AM PDT #

Thank you very much for your help!!!

Posted by guest on November 21, 2012 at 12:58 AM PST #

i have a pannel tabbed layout and i want to call a task flow in the first tab and second task flow from another tab. Each of the task flow has a .jsff page which inturn has a method which is invoked from the java class.
when im clicking on the first tab both the task flows are being called. Can any one suggest me how to call a particular task flow at one time.

Posted by guest on September 09, 2013 at 12:39 AM PDT #

guest - you can play with the refresh condition of the second region (in the binding tab) so it will depend on a boolean viewScope variable that only get set to true when you press a tab.
More ideas:
http://www.adftips.com/2010/11/adf-ui-performance-tip-lazy-load-task.html
http://www.ateam-oracle.com/improving-adf-page-rendering-time/

Posted by Shay on September 09, 2013 at 04:16 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

me
I'm a Director of Product Management for the Oracle Java Development Tools.
Follow me:
Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today