PDA

View Full Version : Help with TabPanel



cadudecastroalves
8 Jan 2007, 11:03 AM
Hi people!

Here's my code:



var tabAbrirBt = {
init: function() {
var tabs = new YAHOO.ext.TabPanel('navigation');
tabs.addTab('abrir-bt', "Abrir BT");

var tabHistorico = tabs.addTab('historico', "Histórico");
var loading = tabHistorico.getUpdateManager();
loading.setDefaultUrl('database/xml/bt/abrirBtHistorico');
tabHistorico.addListener('activate', loading.refresh, loading, true);

tabs.activate('abrir-bt');
}
}
YAHOO.ext.EventManager.onDocumentReady(tabAbrirBt.init, tabAbrirBt, true);


When I load the page, the javascript console returns the following error message:
"tabHistorico.on is not a function"

What's happening?

jack.slocum
8 Jan 2007, 11:10 AM
What version are you running?

cadudecastroalves
8 Jan 2007, 11:21 AM
0.32.3.1

tryanDLS
8 Jan 2007, 1:21 PM
You're quite a ways behind - please update to the current .33 codebase and retest.

cadudecastroalves
8 Jan 2007, 3:18 PM
Yes! I agree!

But I did accurately like this example: http://www.yui-ext.com/deploy/yui-ext/examples/tabs/tabs.html. Would it have to function?[/url]

tryanDLS
8 Jan 2007, 3:28 PM
If you mean the tab example from the .32 codebase - yes, maybe. I don't remember if there were changes to that btwn .32 and .33. The problem is none of us have that version around to test against, and won't remember what the code may have been that far back.

cadudecastroalves
9 Jan 2007, 9:52 AM
Hi people!

The first problem with TabPanel was solved. Now, I have a new doubt.

I have two XML files (openBt.xml and history.xml). I'm using a XSL file to style it (openBt.xsl for openBt.xml and history.xsl for history.xsl).

By default, I load the openBt.xml page. It's the first tab, activate by default, too. When the user click on the history tab, I need to load it page (history.xml), and show it.

Here's my tab script:

var tabOpenBt = {
init: function() {
var tabs = new YAHOO.ext.TabPanel('navigation');
tabs.addTab('open-bt', "Open BT");

var tabHistory = tabs.addTab('history', "History");
var updater = tabHistory.getUpdateManager();
updater.setDefaultUrl('database/xml/bt/history');
tabHistory.on('activate', updater.refresh, updater, true);

tabs.activate('open-bt');
}
}

The tab navigation is working, but, the history page is not being shown.

Somebody help me please! :cry:

tryanDLS
9 Jan 2007, 12:29 PM
If you never loaded the tab, shouldn't you be calling update instead of refresh? Set a BP in refresh and follow the flow to see what's happening.

cadudecastroalves
10 Jan 2007, 10:22 AM
I'll try to be more clearly.

I've two tabs: openBt and History. Each page is a XML file and I'm using XSL to show it, like HTML. To show openBt page, I've to call openBt XML page and, to show History page, too. That's, to show each page, I've to call each XML file.

But, when I call the History page, I need to load it's XSL file to display correctly.

How do I?

tryanDLS
10 Jan 2007, 10:33 AM
So you need to an XSL translate on the fly? Wouldn't you be better of doing that on the server and just returning the transformed XML for each page?

Otherwise, you'd need to retrieve the xml and the xsl (2 requests) and do the transform client side.