PDA

View Full Version : Changing tabs programmatically



kerryms
21 Sep 2010, 8:48 AM
I'm launching a page with a tab panel containing four tabs, which also includes a toolbar with a back button. When a user selects a tab and hits the back button, then reselects the page it always goes back to the previously selected tab. It's important that it always be on the first tab when the page launches, but so far I've been unable to figure out how to do that. I initially thought that I could use setActiveTab as that is what ExtJS uses, but that method isn't part of the Sencha API. setCard may have been intended for handling that functionality, but it doesn't do anything.

Any help in figuring this out would be greatly appreciated!

evant
21 Sep 2010, 3:49 PM
Ext.setup({
onReady: function(){
var tabs = new Ext.TabPanel({
fullscreen: true,
items: [{
title: 'A',
html: 'a'
},{
title: 'B',
html: 'b'
}]
});

(function(){
tabs.setCard(1);
}).defer(2000);
}
});

kerryms
21 Sep 2010, 4:05 PM
That works, thanks! I'm not sure what was going on before as I was using tabs.setCard, but it's now working as expected.