PDA

View Full Version : Problem with the new framework sencha touch



shiyue
26 Aug 2011, 7:24 AM
My application used the old version of Sencha Touch which has the version description below:

Ext = {
platformVersion: '0.1',
platformVersionDetail: {
major: 0,
minor: 1,
patch: 0
}
};
I just downloaded the current version of Sencha touch.
There are some issues when running my app, somethings does not show.
I have some code like:

pwc.ux.PanelActu = Ext.extend(Ext.Panel, {
layout: 'card',
cls: 'pwc',
scroll: false,
initComponent: function(){
this.facebookButton = new Ext.Button({
text: 'Facebook',
value: 'facebook',
handler: this.switchToCard,
scope: this
});
this.twitterButton = new Ext.Button({
text: 'Twitter',
value: 'twitter',
handler: this.switchToCard,
scope: this
});
this.blogButton = new Ext.Button({
text: 'Le Blog',
value: 'blog',
handler: this.switchToCard,
scope: this
});
this.navigationBar = new Ext.Toolbar({
dock: 'top',
style: 'height:36px',
cls: 'pwc',
id: 'actu_nav',
layout: {
pack: 'justify',
},
items: [this.facebookButton, this.twitterButton, this.blogButton]
});

this.dockedItems = this.dockedItems || [];
this.dockedItems.unshift(this.navigationBar);
this.addListener('beforeactivate', this.preLoad);

pwc.ux.PanelActu.superclass.initComponent.call(this);
},
switchToCard: function(btn){
this.lastButtonSelected = btn;
var selected = btn.value;
for (i = 0; i < this.navigationItems.length; i++)
{
if (this.navigationItems[i].value == selected){
var card = this.navigationItems[i].card;
}
}
if (card)
{
card.setFeed();
console.log(this.layout);
this.setActiveItem(card, card.animation || 'fade');
card.onDisplayCard();
this.currentCard = card;

}

for (i = 0; i < this.navigationBar.items.items.length; i++){
this.navigationBar.items.items[i].removeCls('current');
}

btn.addCls('current');
},

I add a breakpoint at the line "this.setActiveItem(card, card.animation || 'fade' ".
In the javascript console, I write
this.layout
With the old version Sencha Touch, I obtain a type subclass with un id "ext-layout-1107" which is normal.
But with the new version, I obtain a string "card".
I verified in the documentation, I could not see where I did wrong.
I wish someone could help me.
Thanks!!

arthurakay
29 Aug 2011, 11:55 AM
Your question isn't nearly specific enough... I understand that you're not getting the expected output from "this.layout", but you aren't actually explaining what it's preventing you from doing.

For starters, you're expecting to jump from ST 0.1 to ST1.1 - which is a HUGE jump between versions. You should absolutely expect things to be broken.

Secondly, the result you get from "this.layout" is correct - the value should say something like "card". If you were expecting a string like "ext-layout-xxxx" then you need to rewrite whatever depends on that code.