1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
var cbx;
function createComboBox(){
var store = Ext.create('Ext.data.JsonStore', {
autoLoad : true,
url : 'SourceType',
method : 'POST'
fields : ['sourceName'],
proxy : {
type : 'memory',
reader : {
type : 'json',
root : 'data',
}
}
});
store.load();
return store;
}
function createForm(){
var store = createComboBox();
Ext.create('Ext.form.Panel', {
renderTo : 'addSourceForm',
title : 'Add a new source event ',
height : 130,
width : 280,
boddyPadding : 10,
defaultType : 'textfield',
items : [
{
fieldLabel : 'Name ',
name : 'sourceEventName',
allowBlank : false,
}, {
xtype : 'datefield',
fieldLabel : 'Date ',
name : 'sourceEventDate',
allowBlank : false,
}, {
xtype : 'combo',
name : 'comboBox',
fieldLabel : 'Select a source type ',
editable : 'false',
queryMode : 'local',
displayField : 'sourceName',
store : store
}
]
});
} |
Partager