X

Shay Shmeltzer's Oracle Development Tools Tips

Deciding Which Tab to Show Based on a Page Parameter

Shay Shmeltzer
Director of Product Management - Oracle

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.


Join the discussion

Comments ( 17 )
  • guest Saturday, September 10, 2011

    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


  • guest Monday, September 12, 2011

    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.


  • Shay Monday, September 12, 2011

    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.


  • Shay Monday, September 12, 2011

    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.


  • Nick Olmsted Wednesday, September 14, 2011

    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?


  • ebox999 Saturday, November 12, 2011

    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?


  • guest Thursday, November 17, 2011

    regarding my previous postt, there was a misunderstanding

    coming from the design-time warning.

    ignoring it let me succeed.


  • guest Saturday, February 4, 2012

    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


  • Shay Monday, February 6, 2012

    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?


  • guest Monday, May 21, 2012

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


  • Shay Monday, May 21, 2012

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

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


  • Subhash Thursday, August 2, 2012

    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.


  • guest Wednesday, November 21, 2012

    Thank you very much for your help!!!


  • guest Monday, September 9, 2013

    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.


  • Shay Monday, September 9, 2013

    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/


  • guest Thursday, July 21, 2016

    I have a panelTabbed and in that I have two showDetailItem.

    I want to dynamically reset the height, as of now when I am giving a constant height at inlinestyle for panelTabbed, both the showDetailItem is taking that height and due to this one of the tab is showing so much whitespace and the other is fine.

    I want to achieve a dynamic height reset so that both the tabs shrink n expand as per the content.

    How can I achieve this.


  • Shay Shmeltzer Thursday, August 4, 2016

    guest - look into the dimensionFrom attribute of your layout components - this will decide how they scale.


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.