views:

1450

answers:

1

Loading/Selecting a (non-ajax) tab from within one of the other tabs can be done by using

$('#mytabscontainer').tabs('select', 3)

However, I need to be able to reload the active tab, and above method does not work for that. Neither does

$('#mytabcontainer').tabs('load', 3)

Any ideas on how to achive this?


** Solution **

In the jQuery 'tabs' plugin, replace the line containing:

if (($li.hasClass('ui-tabs-selected') && !o.collapsible) ||

with

if (

And add a css to the page / or edit the jQuery css files, so that you get:

div.ui-tabs ul li.ui-tabs-selected a {cursor: pointer !important;}

This will change tabs so that they're always selecteable, even if they've previously been clicked upon.

A: 

If you have this html for your tabs:

<div id="tabs">
    <ul>
        <li><a href="#tabs-1">Nunc tincidunt</a></li>
        <li><a href="ajax/content1.html">Ajax Tab 1</a></li>
        <li><a href="ajax/content2.html">Ajax Tab 2</a></li>
    </ul>
    <div id="tabs-1">
        <p>Proin elit arcu</p>
    </div>
</div>

With tab 1 being the non-ajax tab. That tab doesn't have a url that it can refresh from. So you first need to give it a url before you can reload it:

var tabs = $('#tabs').tabs();
tabs.tabs( 'url', 0,'ajax/content0.html');
tabs.tabs('load', 0);

Remember that the tabs are zero-indexed.

PetersenDidIt
What if I don't want the original tab to be remotely loaded? Also see my comment below the first comment on my post.
klokop
Sounds like you just need to make it so that the script that adds the new item send back the list so you can refresh the html with it.
PetersenDidIt
Which amounts to refreshing the tab. But I guess that's not possible.
klokop
Kinda you just need to update the list not the whole tab.
PetersenDidIt
Hmm, I guess that'd be a sollution. How about when I have this:| tab1 | tab2 | tab3 |Click on tab2 will show a list ('list') of links. Clicking on one of the links in the list will remove the list, and show a bunch of stuff ('content') related to the clicked item. Now, when I'm done reading 'content', I want to show 'list' again. I could do that by including some element in 'content' that, when clicked, removes 'content' and reenables 'list'. I think it would be more natural to just reanable the link in the tab, and have the user click the tab *again*.(hmm, no formatting in comments?)
klokop