PDA

View Full Version : Architect with Touch -- how to create event/code for tab button switch to new card



sencha2cool
2 Aug 2012, 10:15 AM
Hello,
Using Architect 2 with Touch.
Created two tab items (Home, Topics).
Under Topics, created activeitemchange event

Clicking Topics tab bar item stays on Home screen
How do I create event/code for Topics tab button to switch to new card (with userClassName MyPanel1 and userAlias mypanel1) ?

Mthor
2 Aug 2012, 10:38 AM
tabPanel.getLayout().setActiveItem(0);

sencha2cool
7 Aug 2012, 4:53 AM
That did not work for me.
I have Panel->Tabpanel->activeItemchange which creates code:
tabPanelActiveItemChange: function (container, value, oldvalue, options) {
alert('HERE');
}

This does print 'HERE' to screen when tap any tabBarItem -- but, how to switch to SecondPanel when second tabBarItem is tapped ?

sencha2cool
7 Aug 2012, 5:40 AM
Slowly getting closer
Event code is now:
if (value.id == 'Home'){
alert('Home');
}
if (value.id == 'Topics')
{
alert('Topics');
}

I have two Panels with ids Panel1 and Panel2, how to use setActiveItem() to show Panel2 (or Panel 1) ?

Mthor
7 Aug 2012, 6:21 AM
the way I told you works and is correct. go mess with some examples, plenty of them out there show you how to do this. also use === instead of ==

setActiveItem(0) is the first tab, setActiveItem(1) is the second tab, and so on. Go through some examples that sencha provided, they really help you get your feet wet!

sencha2cool
7 Aug 2012, 6:47 AM
Tried:
Ext.getCmp('maintabpanel').setActiveItem('topicsPanel');

But this did not work either -- please advise.

sencha2cool
7 Aug 2012, 6:54 AM
This is not working for me:

if (value.id === 'Topics')
{
alert('Topics'); // does display 'Topics'
tabPanel.getLayout().setActiveItem(0); // does NOT show second panel -- also setActiveItem(0) does NOT show second panel
}

sencha2cool
7 Aug 2012, 2:03 PM
With Safari Developer see that Ext.getCmp('tabPanel').getLayout().setActiveItem('topicsPanel');
causes Type Issue 'undefined' is not a function -- hmm.