- ]
- });
- datefield.render('datefield');
-
- // shorthand alias
- var fm = Ext.form, Ed = Ext.grid.GridEditor;
-
- var monthArray = Date.monthNames.map(function (e) { return [e]; });
-
- var ds = new Ext.data.Store({
- proxy: new Ext.ux.data.PagingMemoryProxy(monthArray),
- reader: new Ext.data.ArrayReader({}, [
- {name: 'month'}
- ])
- });
-
- var cm = new Ext.grid.ColumnModel([{
- header: "Months of the year",
- dataIndex: 'month',
- editor: new Ed(new fm.TextField({
- allowBlank: false
- })),
- width: 240
- }]);
-
- cm.defaultSortable = true;
-
- var grid = new Ext.grid.GridPanel({
- width: 360,
- height: 203,
- title:'Month Browser',
- store: ds,
- cm: cm,
- sm: new Ext.grid.RowSelectionModel({selectRow:Ext.emptyFn}),
-
- bbar: new Ext.PagingToolbar({
- pageSize: 6,
- store: ds,
- displayInfo: true
- })
- });
+ },
+ onSuccess: function(response, opts) {
+ eval(response.responseText);
+ this.setupDemo();
+ },
+ onFailure: function() {
+ Ext.Msg.alert('Failure', 'Failed to load locale file.');
+ this.setupDemo();
+ },
+ setupDemo: function() {
+ /* Email field */
+ var emailfield = new Ext.FormPanel({
+ renderTo: 'emailfield',
+ labelWidth: 100, // label settings here cascade unless overridden
+ frame: true,
+ title: 'Email Field',
+ bodyStyle: 'padding:5px 5px 0',
+ width: 360,
+ defaults: {width: 220},
+ defaultType: 'textfield',
+
+ items: [{
+ fieldLabel: 'Email',
+ name: 'email',
+ vtype: 'email'
+ }]
+ });
+
+ /* Datepicker */
+ var datefield = new Ext.FormPanel({
+ renderTo: 'datefield',
+ labelWidth: 100, // label settings here cascade unless overridden
+ frame: true,
+ title: 'Datepicker',
+ bodyStyle: 'padding:5px 5px 0',
+ width: 360,
+ defaults: {width: 220},
+ defaultType: 'datefield',
+ items: [{
+ fieldLabel: 'Date',
+ name: 'date'
+ }]
+ });
+
+ // shorthand alias
+ var fm = Ext.form, Ed = Ext.grid.GridEditor;
+
+ var monthArray = Date.monthNames.map(function (e) { return [e]; });
+
+ var ds = new Ext.data.Store({
+ proxy: new Ext.ux.data.PagingMemoryProxy(monthArray),
+ reader: new Ext.data.ArrayReader({}, [
+ {name: 'month'}
+ ])
+ });
+
+ var cm = new Ext.grid.ColumnModel([{
+ header: "Months of the year",
+ dataIndex: 'month',
+ editor: new Ed(new fm.TextField({
+ allowBlank: false
+ })),
+ width: 240,
+ defaultSortable: true
+ }]);
+
+ var grid = new Ext.grid.GridPanel({
+ renderTo: 'grid',
+ width: 360,
+ height: 203,
+ title:'Month Browser',
+ store: ds,
+ cm: cm,
+ sm: new Ext.grid.RowSelectionModel({selectRow:Ext.emptyFn}),
+
+ bbar: new Ext.PagingToolbar({
+ pageSize: 6,
+ store: ds,
+ displayInfo: true
+ })
+ });
+
+ // trigger the data store load
+ ds.load({params:{start:0, limit:6}});
+ }
+ };