PDA

View Full Version : carousel page number



hemant1
16 Jun 2011, 2:49 AM
i build the carousel application and in it i put a bottom toolbar
to keep the track of carousel page number i used the cardswitch event
and i got the page number whenever card is changed
now the problem is i want to show the current page number to the bottom toolbar for that i create a variable page_count (highlighted in the code) but when i initialize the page_count in a bottom toolbar it doen't show me the current page number value (it show me the initialization value)
how can i display the current page number value in bottom toolbar




new Ext.Panel({
fullscreen: true,
cls: 'card',
layout: {
type: 'hbox',
align: 'stretch'
},
defaults: {
flex: 1
},
items: [carousel2],

dockedItems: [{
xtype: 'toolbar',
dock: 'bottom',

items: [{
text: 'Home',
handler: function(){
carousel2.setActiveItem(0);
}
},{
text: 'Menu',
handler: function(){
popup.show();
}
},{ xtype: 'spacer' },{
ui: 'back',
text: 'Backward',
handler: function(){
var tmp1=carousel2.items.indexOf(carousel2.layout.activeItem);

tmp1=tmp1-1;
if(tmp1<0)
{
alert('There is no Previous Page availabe');
}
else
{
carousel2.setActiveItem(tmp1);
}
}
},{
text: 'Forward',
ui: 'forward',
handler: function(){
var tmp=carousel2.items.indexOf(carousel2.layout.activeItem);
tmp=tmp+1;

if(tmp>=i)
{
alert('Next Page is Not available');
}
else
{
carousel2.setActiveItem(tmp);
}
}
},{

text: 'Pages '+ page_count ,
handler:function()
{
}
}]
}]
});





carousel2.on('cardswitch', function(){
page_count= carousel2.items.indexOf(carousel2.layout.activeItem);
alert(page_count);
});