Carousel Built for EXT 4.0, but should be easy to convert...
Code:
//
// UX Carousel
// DS Gould
// 04-11-2013
//
Ext.define('Ext.ux.Carousel',
{
bodyCls : 'carousel',
//cls : 'carousel',
extend : 'Ext.panel.Panel',
alias : 'widget.carousel',
layout :
{
type : 'card'
},
defaultType : 'image',
currentIndex : 0,
// Initialize Component
initComponent : function()
{
this.items = this.buildItems(this.initialConfig.items);
this.dockedItems = this.buildDockedItems();
this.callParent(arguments);
},
// Factory Methods
buildItems : function(items)
{
var returnItems = [];
if (items.length > 0)
{
returnItems = items;
}
else
{
returnItems.push(Ext.create('Ext.panel.Panel',
{
html : 'No Items To Display'
}));
}
return returnItems;
},
buildDockedItems: function ()
{
return [
{
xtype: 'toolbar',
dock: 'left',
cls: 'teeTimesButtonLeft',
//baseCls : 'testCls',
items:
[
// {
// xtype : 'tbfill'
// },
{
xtype: 'button',
cls: 'carouselButtonLeft',
// margin: '125 0 0 0',
scope: this,
handler: function ()
{
this.previousImage();
}
},
//{
// xtype : 'tbfill'
//}
]
},
{
xtype: 'toolbar',
dock: 'right',
cls: 'carouselButtonRight',
items:
[
// {
// xtype : 'tbfill',
// bodyCls : 'transparentBody'
// },
{
xtype: 'button',
cls: 'teeTimesButtonRight',
// margin: '125 0 0 0',
scope: this,
handler: function ()
{
this.nextImage();
}
},
// {
// xtype : 'tbfill',
// bodyCls : 'transparentBody'
// }
]
}];
},
previousImage : function()
{
this.currentIndex --;
if(this.currentIndex < 0) this.currentIndex = this.items.getCount() - 1;
this.displayImage(this.currentIndex);
},
nextImage : function()
{
this.currentIndex ++;
if(this.currentIndex > this.items.getCount() - 1) this.currentIndex = 0;
this.displayImage(this.currentIndex);
},
displayImage : function(index)
{
if(this.items.length > 0)
{
this.getLayout().setActiveItem(index);
}
}
})