comparison app/view/widgets/Uwb.js @ 490:446e99cfd425

Updated views and controllers using the new model and stores.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 31 Oct 2014 21:28:31 +0100
parents e45f4df57938
children 850ccfe5f3c4
comparison
equal deleted inserted replaced
489:6056a7fd9aa2 490:446e99cfd425
4 * This file is Free Software under the GNU GPL (v>=3) 4 * This file is Free Software under the GNU GPL (v>=3)
5 * and comes with ABSOLUTELY NO WARRANTY! Check out 5 * and comes with ABSOLUTELY NO WARRANTY! Check out
6 * the documentation coming with IMIS-Labordaten-Application for details. 6 * the documentation coming with IMIS-Labordaten-Application for details.
7 */ 7 */
8 8
9 var uwbStore = Ext.create('Ext.data.Store', {
10 fields: ['umwId', 'umweltBereich'],
11 sorters: [{
12 property: 'umwId'
13 }],
14 autoLoad: true,
15 proxy: {
16 type: 'ajax',
17 api: {
18 read: 'server/rest/uwb'
19 },
20 reader: {
21 type: 'json',
22 root: 'data'
23 }
24 }
25 });
26
27 /** 9 /**
28 * Combobox for Umweltbereich 10 * Combobox for Umweltbereich
29 */ 11 */
30 Ext.define('Lada.view.widgets.Uwb' ,{ 12 Ext.define('Lada.view.widgets.Uwb' ,{
31 tpl: '<tpl for="."><div class="x-combo-list-item x-boundlist-item" >{umwId} - {umweltBereich}</div></tpl>', 13 extend: 'Ext.form.ComboBox',
32 extend: 'Ext.form.ComboBox', 14 require: ['Lada.store.StaUmwelt'],
33 alias: 'widget.uwb', 15 alias: 'widget.uwb',
34 store: uwbStore, 16 store: 'StaUmwelt',
35 displayField:'umwId', 17 displayField:'id',
36 valueField: 'umwId', 18 valueField: 'id',
37 emptyText:'Wählen Sie einen Umweltbereich', 19 emptyText:'Wählen Sie einen Umweltbereich',
38 // Enable filtering of comboboxes 20 // Enable filtering of comboboxes
39 autoSelect: false, 21 autoSelect: false,
40 queryMode: 'local', 22 queryMode: 'local',
41 triggerAction : 'all', 23 triggerAction : 'all',
42 typeAhead: false, 24 typeAhead: false,
43 minChars: 0, 25 minChars: 0,
44 // TODO: Set value in disply after selection. Can not figure out why 26 tpl: '<tpl for="."><div class="x-combo-list-item x-boundlist-item" >{id} - {umweltBereich}</div></tpl>',
45 // accessing the recored.data attribute fails here (ti) <2013-08-06 16:52> 27 // TODO: Set value in disply after selection. Can not figure out why
46 //listeners: { 28 // accessing the recored.data attribute fails here (ti) <2013-08-06 16:52>
47 // select: function(combo, record, index) { 29 //listeners: {
48 // console.log("1"); 30 // select: function(combo, record, index) {
49 // console.log(record); 31 // console.log("1");
50 // console.log("2"); 32 // console.log(record);
51 // var text = record.data['umwId'] + " - " + record.data['umweltBereich']; 33 // console.log("2");
52 // console.log("3"); 34 // var text = record.data['umwId'] + " - " + record.data['umweltBereich'];
53 // Ext.form.ComboBox.superclass.setValue.call(this, text); 35 // console.log("3");
54 // combo.value = record.id; 36 // Ext.form.ComboBox.superclass.setValue.call(this, text);
55 // } 37 // combo.value = record.id;
56 //}, 38 // }
39 //},
57 initComponent: function() { 40 initComponent: function() {
41 this.store = Ext.data.StoreManager.get('StaUmwelt');
42 if (!this.store) {
43 this.store = Ext.create('Lada.store.StaUmwelt');
44 }
58 this.callParent(arguments); 45 this.callParent(arguments);
59 } 46 }
60 }); 47 });

http://lada.wald.intevation.org