PDA

View Full Version : TabPanel Creation



Jody
30 Nov 2006, 2:48 PM
Jack, great work... hopefully this isn't a stupid question (kind of new to the yui framework and your extension; love it though.

I have a simple TabPanel and the code for it works fine but I need to initiate it's instantiation via script... how would I call the init function manually?

Here is the code:


var newtabs = {
init : function(){
var tabs = new YAHOO.ext.TabPanel('mytabs');
tabs.addTab('tab1', "tab1");
tabs.addTab('tab2', "tab1");
tabs.addTab('tab3', "tab1");
tabs.activate('tab1');
}
}

to load onDocumentReady you'd use:

YAHOO.ext.EventManager.onDocumentReady(newtabs.init, newtabs, true);

But I need to fire the init function later...

(I've left out the HTML, but again, I don't have a problem getting the tabs to work onDocumentReady).

Any help would be greatly appreciated.
Thanks,

Jody
30 Nov 2006, 2:51 PM
I also need to do the same kind of thing for a BasicDialog as well but assume it would be a similar solution...

thanks again!

tryanDLS
30 Nov 2006, 2:59 PM
you just declared a global variable called newtabs, didn't you? You can access that anywhere and call newtabs.init()

Jody
5 Dec 2006, 11:04 AM
uh, ok... thanks. :) thought I tried that but it was a long day and maybe I didn't.