views:

84

answers:

1

I'm trying to load data to a tab panel (ui.panel) and then activate related tab through .tabs("select", ui.index).

How can I iterate through all ui objects in jQuery UI Tabs? Those that are available through load method of UI Tabs object.

A: 

This is how I achieved my goal:

            var $tabs = $("#tabContainer").tabs({
            load: function(event, ui){
                $("a.updateTab").live("click", function(){

                    // href for links are replaced by jq tabs with this pattern (pseudocode):
                    // a.href = "#" + a.title.replace(" ", "_")
                    // so we're searching a tab wich content should be reloaded
                    var tabItemId = "#Menu_" + "some text";

                    var index = $(".ui-tabs-panel", $tabs).index($(tabItemId));
                    $tabs.tabs("url", index, this.href);
                    $tabs.tabs("select", index);
                    return false;
                });
            }
        });
oddy