PDA

View Full Version : Ajax Tabs: Selecting a Nested Tab> ddadmin



pstrick
03-06-2009, 10:51 PM
1) Script Title: Ajax Tabs

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/ajaxtabs_suppliment2.htm

3) Describe problem:

I came across the thread from ddadmin at http://www.dynamicdrive.com/forums/archive/index.php/t-29939.html

(see below) It describes how to select a nested tab from outside the tabs interface. However, when I first open the page and select the link, it takes me to the top level tab but not the nested tab. When I click on another tab and go back to the original link, it works and takes me to the nested tab.

Any ideas?

Thanks!


Below is the original thread that provides coded solution:


There are many ways to select a nested tab from outside the tabs interface itself. The easiest way is to add to your onajaxpageload event handler the code in red below:


Code:
countries.onajaxpageload=function(pageurl){
if (pageurl.indexOf("externalnested.htm")!=-1){
var provinces=new ddajaxtabs("provincetabs", "provincedivcontainer")
provinces.setpersist(true)
provinces.setselectedClassTarget("link") //"link" or "linkparent"
provinces.init()
if (typeof nestedtabindex!="undefined" && nestedtabindex>-1)
provinces.expandit(nestedtabindex)
nestedtabindex=-1
}

This registers a variable nestedtabindex that you can set anywhere on your page to select the "x" nested tab (0=1st tab). So for example, you may have:

Code:
<a href="#" onClick="countries.expandit(1); nestedtabindex=2">Select "2nd" tab</a>