views:

205

answers:

3

Hi

I have nested tabs in jquery tabs which are pretty simple to do if we want static jquery tabs

but what if we want nested tabs that the remote page should decide what would be the tabs.

or in other words i want nested tabs in a remote page (or ajaxified)

For example i m calling this page(remote page) through tabs

<div id="container-2">

  <ul>
  <li><a href="#fragment-1a"><span>Section 1a</span></a></li>
  <li><a href="#fragment-1b"><span>Section 1b</span></a></li>

  <li><a href="#fragment-1c"><span>Section 1c</span></a></li>

  </ul>
  <div id="fragment-1a">
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
  </div>
  <div id="fragment-1b">
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
  </div>
  <div id="fragment-1c">

  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
  </div>

  </div>

In the main page i have

<script type="text/javascript">
$(function(){
$('#tabs').tabs();
$("#container-2").tabs();
});
</script>
<div id="tabs">
        <ul>
                <li><a href="remote.jsp"><span>Requests</span></a></li>
      </ul>
  </div>

But i m not able to get the nested tabs in the remote page.

They are in the simple list form.

Any help

Thanks

Pradyut

A: 

You will need to call the tabs()s function on the #container-2 only after it has been loaded. When you use a remote tab the content is not loaded until the tab is opened, meaning that the content of the tab will not be added to the DOM at the same time $(document).ready() fires. Try this instead:

<script type="text/javascript">
 $(function(){
    $('#tabs').tabs({
     load: function(event, ui) {
        $("#container-2").tabs();
     }
    });
 });
</script>

I haven't tested it, so you may need to fiddle with the code inside of the load function to get it working, but that should get you started anyway.

Nathan Taylor
this works not on ff or iebut works on chrome and safari...
Pradyut Bhattacharya
A: 

You're trying to bind a tabs() to the $('#container-2'), which isn't there. You need to do it after the load of the tab content.

$('#tabs').tabs({
   load: function(event, ui){
     $("#container-2").tabs();
   }
});
munch
A: 

the remote itself should have a script

<script type="text/javascript">

  $(function(){
  $('#tabs-2').tabs();
  });
  </script>

the example url here: -

http://pradyut.dyndns.org/WebApplicationSecurity/newtab.jsp

Pradyut Bhattacharya