PDA

View Full Version : Carousel after 0.94 doesn't work



dbottillo
13 Sep 2010, 1:45 AM
i have a lot of problem with sencha 0.94!!!
there are a lot of changes...so i have to rewrite my code completely :/

first i have some problem with carousel, code is:


Ext.setup({
tabletStartupScreen: 'assets/logo_portrait2.png',
phoneStartupScreen: 'assets/logo_portrait2.png',
icon: 'icon.png',
glossOnIcon: false,
onReady: function(){


var updateSession = function(){
for (i = 0; i < 5; i++) {
carousel.add(new Ext.Panel({
html:'card'+i
}));
}
carousel.update();
//carousel.setCard('0');
}


var carousel = new Ext.Carousel({
direction: 'horizontal',
activeItem: '1',
defaults: {
cls: 'card'
},
height: 180
});


var detail = new Ext.Panel({
layout: {
type: 'vbox',
align: 'stretch'
},
monitorOrientation: 'true',
items: [carousel]
});

var container = new Ext.Container({
layout: 'card',
title: 'Container',
iconCls: 'more',
items:[detail]
});

var panel = new Ext.TabPanel({
fullscreen: true,
ui: 'dark',
animation: { type: 'cube', direction: 'down' },
tabBar: { dock: 'bottom', layout: { pack: 'center'} },
items: [container],
listeners: {
afterrender: function(){
updateSession();

}
}
});

}

});

this code with 0.93 works fine
with 0.94 chrome inspector say nothing...but it display UNDEFINED and if i switch a card say: 'Uncaught TypeError: Cannot read property 'dom' of undefined'
documentation about carousel is completely different from the previous, there isn't any method to add something to carousel (just addevent and addlistener...!)

in code i try also carousel.doComponentLayout(); but it didn't change anything...

so where is the mistake?

Daniele

evant
13 Sep 2010, 1:49 AM
Ext.setup({
tabletStartupScreen: 'assets/logo_portrait2.png',
phoneStartupScreen: 'assets/logo_portrait2.png',
icon: 'icon.png',
glossOnIcon: false,
onReady: function(){


var updateSession = function(){
for (i = 0; i < 5; i++) {
carousel.add(new Ext.Panel({
html: 'card' + i
}));
}
carousel.doLayout();
carousel.setCard(0);
}


var carousel = new Ext.Carousel({
direction: 'horizontal'
});


var container = new Ext.Container({
layout: 'card',
title: 'Container',
iconCls: 'more',
items: [carousel]
});

var panel = new Ext.TabPanel({
fullscreen: true,
ui: 'dark',
animation: {
type: 'cube',
direction: 'down'
},
tabBar: {
dock: 'bottom',
layout: {
pack: 'center'
}
},
items: [container],
listeners: {
afterrender: updateSession
}
});
}
});

dbottillo
13 Sep 2010, 1:53 AM
ok thank you!

i have another question

how can i do a cyclic carousel (so user can go from last card to the first)?