Code:
var master = new Ext.Application({ launch: initApp });
Ext.regModel('Contact',{
fields: ['firstName','lastName']
});
var listStore = new Ext.data.JsonStore({
model: 'Contact',
sorters: 'lastName',
getGroupString: function(record){
return record.get('lastName')[0];
},
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'},
{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'}
]
});
function initApp(){
master.list = new Ext.List({
store: listStore,
itemTpl: '<div class="contact">{firstName} {lastName}</div>',
grouped: true,
indexBar: true
});
master.actionSheet = new Ext.ActionSheet({
items: [
{
text: 'Delete',
ui: 'decline'
},
{
text: 'Save'
},
{
text: 'Cancel',
ui: 'confirm',
handler: function(){
master.actionSheet.hide();
}
}
]
});
master.dock = new Ext.TabBar({
dock: 'bottom',
layout: {
pack: 'center'
},
ui: 'dark'
});
master.topBar = new Ext.Panel({
style: 'background: black; padding: 5px;',
dock: 'top',
items: [
new Ext.Button({
ui: 'action',
text: 'Open menu',
handler: function(){
master.actionSheet.show();
}
})
]
});
master.Form = new Ext.form.FormPanel({
title: 'Form',
iconCls: 'form',
scroll: 'vertical',
defaults: {
useClearIcon: true
},
items: [
{
xtype: 'fieldset',
title: 'Header 1',
instructions: 'Please enter accurate information.',
defaults: {
labelWidth: '35%'
},
items: [
{
xtype: 'textfield',
name: 'name',
label: 'Name',
placeHolder: 'Wild Bill',
autoCapitalize: true
},
{
xtype: 'passwordfield',
name: 'pass',
label: 'Password'
},
{
xtype: 'emailfield',
name: 'email',
label: 'Email',
placeholder: 'wildbill@willcrichton.net'
},
{
xtype: 'datepickerfield',
name: 'birthday',
label: 'Birthday',
picker: { yearFrom: 1900 }
}]
}]
});
master.mainScreen = new Ext.TabPanel({
fullscreen: true,
tabBar: master.dock,
defaults: { scoll: 'vertical' },
items: [
{
// Carousel page
title: 'Carousel',
iconCls: 'info',
layout: {
type: 'vbox',
align: 'stretch'
},
defaults: { flex: 1 },
items: [
{
xtype: 'carousel',
items: [
{ style: "background: green;" },
{ style: "background: red;" },
{ style: "background: yellow;" }
]
},
{
xtype: 'carousel',
direction: 'vertical',
items: [
{ style: "background: yellow;" },
{ style: "background: green;" },
{ style: "background: red;" }
]
}
]
},
{
// Map page
title: 'Maps',
iconCls: 'maps',
layout: 'fit',
items: [{ xtype: 'map', useCurrentLocation: true }]
},
{
// List page
title: 'List',
iconCls: 'list',
layout: 'fit',
items: [ master.list ]
},
master.Form
]
});
}