PDA

View Full Version : Can you put a list inside a carousel?



profunctional
28 Jan 2011, 10:43 AM
If so how is it done?

AndreaCammarata
28 Jan 2011, 11:00 AM
Hi profunctional.
Yes you can!
Take a look at the following example.



Ext.setup({
onReady: function() {

Ext.regModel('Contact', {
fields: ['firstName', 'lastName']
});

var store = new Ext.data.JsonStore({
model : 'Contact',
sorters: 'lastName',
data: [
{firstName: 'Tommy', lastName: 'Maintz'},
{firstName: 'Rob', lastName: 'Dougan'},
{firstName: 'Ed', lastName: 'Spencer'},
{firstName: 'Jamie', lastName: 'Avins'},
{firstName: 'Aaron', lastName: 'Conran'},
{firstName: 'Dave', lastName: 'Kaneda'},
{firstName: 'Michael', lastName: 'Mullany'},
{firstName: 'Abraham', lastName: 'Elias'},
{firstName: 'Jay', lastName: 'Robinson'}
]
});


var list = new Ext.List({
store: store,
itemTpl : '{firstName} {lastName}'
});

var simplePanel = new Ext.Panel({
html: 'Scroll to view the list',
dockedItems: [{
xtype: 'toolbar',
dock: 'top',
title: 'Simple Panel'
}]
});

var carousel = new Ext.Carousel({
fullscreen: true,
items: [simplePanel, list]
});
}
});


Hope this helps.