Code:
Ext.require([
'Ext.*'
]);
Ext.onReady(function(){
Ext.tip.QuickTipManager.init();
var items1 = [];
var items2 = [];
// The data for all states
var states = [
{"abbr":"AL","name":"Alabama","slogan":"The Heart of Dixie"},
{"abbr":"AK","name":"Alaska","slogan":"The Land of the Midnight Sun"}
];
// simple array store
// Define the model for a State
Ext.define('State', {
extend: 'Ext.data.Model',
fields: [
{type: 'string', name: 'abbr'},
{type: 'string', name: 'name'},
{type: 'string', name: 'slogan'}
]
});
for(var i = 0; i < 100; i++) {
// The data store holding the states; shared by each of the ComboBox examples below
var store = Ext.create('Ext.data.Store', {
model: 'State',
data: states
});
items1.push({
xtype:'textfield',
fieldLabel: 'First Name',
name: 'first'
});
items1.push({
xtype:'combo',
fieldLabel: 'State',
hiddenName: 'state',
store: store,
displayField:'state',
valueField: 'abbr',
typeAhead: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
value: 'OK',
selectOnFocus:true
});
items2.push({
xtype:'textfield',
fieldLabel: 'Last Name',
name: 'last',
value: 'abaf'
});
items2.push({
xtype:'datefield',
fieldLabel: 'Date',
name: 'date',
value: '10/14/2001'
});
}
var viewport = Ext.create('Ext.Viewport', {
layout: 'border',
items: [
Ext.create('Ext.Panel', {
region: 'center',
autoScroll: true,
layout: 'anchor',
items: Ext.create('Ext.form.Panel', {
frame:true,
title: 'Multi Column, Nested Layouts and Anchoring',
bodyStyle:'padding:5px 5px 0',
items: [{
xtype: 'container',
layout:'column',
items:[{
columnWidth: 0.5,
xtype: 'container',
layout: 'anchor',
defaults: {
value: '',
anchor: '100%'
},
items: items1
},{
columnWidth: 0.5,
xtype: 'container',
layout: 'anchor',
defaults: {
value: '',
anchor: '100%'
},
items: items2
}]
}]
})
})]
});
});