views:

21

answers:

1

I have parent window with some jquery ui tabs. I would like to know how I can reload the tabs from a popup window.

Any help would be appreciated!

This is what I've tried:

var selected = $('#my_tabs', window.parent.document).tabs('option', 'selected');
$('#my_tabs', window.parent.document).tabs( 'load' , selected );
A: 

If you console log your selected var, what does it give you? As far as I can see that would give you the LI element for the active tab, but not it's index (which is what the tabs load method requires), though I may well be wrong.

Try this:

$('#my_tabs li',window.opener.document).each(function(index){
   if($(this).hasClass('ui-tabs-selected')){
      $('#my_tabs',window.opener.document).tabs('load',index);
      return;
   }
})

Seems like that would reload the active tab since it runs through the tabs, finds the active one, and then passes it's index to the tabs load method to reload the tab.

Hopefully that helps!

Mark
Thanks heaps Mark for trying, however it threw up this javascript error: "uncaught exception: cannot call methods on tabs prior to initialization; attempted to call method 'load'"
Paul