Hello,

first post on this list :-)
using ui 1.7 (thanks so much for this final release) & jquery 1.3.2

I add dynamically tabs when clicking on links inside tab contents. The
added list item gets an attribute rel and is selected right after it's
added & loaded via ajax reqiest.
Now I try to select it when I click on the same link again - don't
want 2 tabs with the same content in it. Since the select method needs
an index for selecting a tab I try to get the tab's index and select
it with its attribute rel but this don't work. I've tried several ways
but the only I get is an index of -1 and I can't select the tab.

thx for any hints

The code:

//** Tabs init
    var myTabs =
    {
      tabTemplate: '<li rel="#{href}"><a href="#{href}">#{label}</
a><span class="ui-icon ui-icon-close" style="float: left; margin:
0.4em 0.2em 0 -10px; cursor: pointer;">Remove Tab</span></li>',
      add: function(event, ui) {
        $(this).tabs('select',ui.index);
      },
      select: function(event,ui){
        $(".dynLoad",ui.panel).updatecontent();
      },
      ajaxOptions: {
        complete: function(){
          $("#ajaxLoad").hide();
        },
        beforeSend: function(){
          $("#ajaxLoad").show();
        }
      }
    }
      var detailsTab = $("#detailsTab").tabs(myTabs);

//** Add tab by clicking on a link
$(".addTab").livequery('click', function()
{
        var id    = $(this).attr('name');
        var url   = $(this).attr('href');
        var type  = $(this).attr('title');
        var label = '<img src="/images/gfx/ic_'+type+'.gif" /> #'+id;
        if($("li[rel='"+url+"']").length == 0) {
          detailsTab.tabs('add',url,label);
        }
        else {
          detailsTab.tabs('option', 'selected', $("li[rel='"+url
+"']").index("#detailsTab"));
        }
        return false;
      });


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to