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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
//Modèle app/model/column.js
Ext.define('app.model.column', {
extend: 'Ext.data.Model',
fields: [
{name: 'nom', type:'string'}
]
});
//Magasin app/store/column.js
Ext.define('app.store.column', {
extend: 'Ext.data.Store',
model: 'app.model.column',
autoLoad: false,
proxy: {
type: 'ajax',
url: 'test.json',
reader: {
type: 'json',
model: 'app.model.column',
root: 'result'
}
}
});
//Controlleur app/controller/column.js
Ext.define('app.controller.column', {
extend: 'Ext.app.Controller',
init: function() {
this.control({
'.comboperso': {
render: this.load,
added: this.load
}
});
},
load: function(cmp, opts) {
cmp.store.load();
}
});
//Vue app/view/column.js
Ext.define('app.view.column', {
extend: 'Ext.form.field.ComboBox',
alias : 'widget.comboperso',
name: 'champs',
fieldLabel: 'Column',
queryMode: 'local',
editable: false,
store: Ext.create('app.store.column'),
id: 'nom',
// typeAhead: true,
// triggerAction: 'all',
// selectOnFocus:true,
emptyText : 'choisissez',
renderTo: document.body,
displayField: 'nom',
valueField: 'nom',
x: 295,
y: 10
});
//point d'entrée de l'appli app.js
Ext.application({
name: 'app',
autoCreateViewport: false,
controllers: ['app.controller.column'],
models: ['app.model.column'],
stores: ['app.store.column'],
views: ['app.view.column'],
launch: function() {
Ext.create('app.view.column');
}
}); |
Partager