Created
February 4, 2011 23:06
-
-
Save mauriciosilva/811974 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.ns("demos"); | |
Ext.setup({ | |
tabletStartupScreen: 'tablet_startup.png', | |
phoneStartupScreen: 'phone_startup.png', | |
icon: 'icon.png', | |
glossOnIcon: false, | |
onReady: function() { | |
var panel = new Ext.Panel({ | |
fullscreen: true, | |
layout: 'fit', | |
dockedItems: [{ | |
xtype: 'toolbar', | |
dock: 'top', | |
items: [{ | |
text: 'First card', | |
handler: function(){ | |
var carousel = panel.getComponent('carousel'); | |
carousel.setActiveItem(0, 'fade'); | |
} | |
},{ | |
text: 'Last Card', | |
handler: function(){ | |
var carousel = panel.getComponent('carousel'); | |
carousel.setActiveItem(carousel.items.getCount() - 1, 'fade'); | |
} | |
}] | |
}] | |
}); | |
Ext.regModel('Room', { | |
fields: [{name: 'text', type: 'string'}], | |
proxy: { | |
type: 'ajax', | |
url: 'rooms.js', | |
reader: { | |
type: 'json', | |
root: 'rooms' | |
} | |
}, | |
autoLoad: false | |
}); | |
var store = new Ext.data.Store({ | |
model: 'Room', | |
listeners: { | |
single: true, | |
datachanged: function(){ | |
Ext.getBody().unmask(); | |
var items = []; | |
store.each(function(rec){ | |
items.push({ | |
html: "<span>"+rec.get('text')+"</span>", | |
}); | |
}); | |
var carousel = new Ext.Carousel({ | |
items: items, | |
itemId: 'carousel' | |
}); | |
panel.add(carousel); | |
panel.doLayout(); | |
} | |
} | |
}); | |
store.read(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment