comparison app/controller/form/Messprogramm.js @ 797:b8fd43021c29

Added a Window to alter Orte of a Messprogramm
author Dustin Demuth <dustin@intevation.de>
date Wed, 20 May 2015 16:48:03 +0200
parents f0b26df02157
children ff4330d4aba1
comparison
equal deleted inserted replaced
796:7267bae1d43f 797:b8fd43021c29
10 * A Controller for a Probe form 10 * A Controller for a Probe form
11 */ 11 */
12 Ext.define('Lada.controller.form.Messprogramm', { 12 Ext.define('Lada.controller.form.Messprogramm', {
13 extend: 'Ext.app.Controller', 13 extend: 'Ext.app.Controller',
14 14
15 requires: [
16 'Lada.view.window.MessprogrammOrt'
17 ],
18
15 /** 19 /**
16 * Initialize the Controller 20 * Initialize the Controller
17 */ 21 */
18 init: function() { 22 init: function() {
19 this.control({ 23 this.control({
21 click: this.save 25 click: this.save
22 }, 26 },
23 'messprogrammform button[action=discard]': { 27 'messprogrammform button[action=discard]': {
24 click: this.discard 28 click: this.discard
25 }, 29 },
30 'messprogrammform button[action=ort]': {
31 click: this.editOrtWindow
32 },
26 'messprogrammform': { 33 'messprogrammform': {
27 dirtychange: this.dirtyForm 34 dirtychange: this.dirtyForm
35 },
36 'messprogrammform location combobox': {
37 select: this.syncOrtWindow
28 }, 38 },
29 'messprogrammform datetime textfield': { 39 'messprogrammform datetime textfield': {
30 blur: this.checkDatePeriod 40 blur: this.checkDatePeriod
31 }, 41 },
32 'messprogrammform [name="teilintervallVon"]': { 42 'messprogrammform [name="teilintervallVon"]': {
52 updateIntervalls: function(field, records) { 62 updateIntervalls: function(field, records) {
53 console.log('update Intervalls'); 63 console.log('update Intervalls');
54 var form = field.up('messprogrammform'); 64 var form = field.up('messprogrammform');
55 var record = form.getRecord(); 65 var record = form.getRecord();
56 form.populateIntervall(record, field.getValue()); 66 form.populateIntervall(record, field.getValue());
67 },
68 /**
69 * The function will open a new Window to edit the Ort of a Messprogramm
70 */
71 editOrtWindow: function(button) {
72 var formPanel = button.up('form');
73 //Only Open if the WIndow does not exist, else focus
74 if (!formPanel.ortWindow) {
75 var data = formPanel.getForm().getFieldValues(true);
76 formPanel.ortWindow = Ext.create('Lada.view.window.MessprogrammOrt', {
77 record: formPanel.getRecord(),
78 parentWindow: formPanel.up('window')
79 });
80 formPanel.ortWindow.show();
81 formPanel.ortWindow.initData();
82 }
83 else {
84 formPanel.ortWindow.focus();
85 formPanel.ortWindow.setActive(true);
86 }
87 },
88
89 /**
90 * When a OrtWindow exist, and the value of the location combobox is changed, update the window.
91 */
92 syncOrtWindow: function(combo, record){
93 var formPanel = combo.up('messprogrammform');
94 if (formPanel.ortWindow) {
95 var ortwindowlocation = formPanel
96 .ortWindow.down('location')
97 var ortwindowcombo = ortwindowlocation
98 .down('combobox');
99
100 ortwindowcombo.select(combo.getValue());
101 ortwindowlocation.fireEvent('select',
102 ortwindowcombo, ortwindowcombo.record);
103 }
57 }, 104 },
58 105
59 /** 106 /**
60 * When the Slider was used, 107 * When the Slider was used,
61 * update the Value of the Teilintervallfields 108 * update the Value of the Teilintervallfields

http://lada.wald.intevation.org