Skip to main content

Search and Top Navigation

#5996 closed bug (wontfix)

Opened August 26, 2010 06:56PM UTC

Closed May 16, 2011 05:15PM UTC

Last modified October 11, 2012 09:15PM UTC

add() callback called after show()

Reported by: rs Owned by:
Priority: minor Milestone:
Component: ui.tabs Version: 1.8.4
Keywords: Cc:
Blocked by: Blocking:
Description

I have an empty tabs structure which I create programatically:

jQuery('<div/>').append('<ul/>').tabs({
  add: function(event, ui) {
    console.log('tab created', ui.panel);
  },
  show: function(event, ui) {
    console.log('tab opened', ui.panel);
  }
}).tabs('add', '#test', 'Test');

Strangely though, the show callback gets called before the add callback:

EXPECTED OUTPUT:

[tab created] [div#test]

[tab selected] [div#test]

ACTUAL OUTPUT:

[tab selected] undefined

[tab created] [div#test]

OUTPUT THAT WOULD BE FINE AS WELL:

[tab selected] undefined

[tab created] [div#test]

[tab selected] [div#test]

I want to load content lazily so I fill the panel on the first show. The behaviour, as it is implemented, makes this quite clumsy since I have to check for presence of the panel and then call the show callback manually for the first tab to initialize its contents.

Attachments (0)
Change History (3)

Changed September 16, 2010 09:40AM UTC by rs comment:1

When appending the div temporarily to a document, the situation is somewhat better in that ui.panel is no longer undefined but still the show callback is called before the add callback.

Changed May 16, 2011 05:15PM UTC by scottgonzalez comment:2

resolution: → wontfix
status: newclosed

I agree that this is wrong, but since the add method is being deprecated in 1.9, I'd rather not change this since there may be code that relies on the current order (expecting everything to be done prior to the add event being triggered).

Changed October 11, 2012 09:15PM UTC by scottgonzalez comment:3

milestone: TBD

Milestone TBD deleted