Mercurial > lada > lada-client
annotate app/controller/Zusatzwerte.js @ 468:59f8a9a20e44
Added tag 1.0 for changeset fa2a7a37a248
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Tue, 14 Jan 2014 12:29:07 +0100 |
parents | d49a6fcd9f57 |
children | debfcc7713e3 |
rev | line source |
---|---|
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
1 Ext.define('Lada.controller.Zusatzwerte', { |
296
529da633b8e3
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
264
diff
changeset
|
2 extend: 'Lada.controller.Base', |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
3 views: [ |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
4 'zusatzwerte.Create' |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
5 ], |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
6 stores: [ |
122
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
110
diff
changeset
|
7 'Zusatzwerte', |
141
1fb79e16149f
Displaye Messeinheit in the Zusatzwerte Overview.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
137
diff
changeset
|
8 'Probenzusatzwerte', |
1fb79e16149f
Displaye Messeinheit in the Zusatzwerte Overview.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
137
diff
changeset
|
9 'Messeinheit' |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
10 ], |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
11 init: function() { |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
12 console.log('Initialising the Zusatzwerte controller'); |
296
529da633b8e3
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
264
diff
changeset
|
13 this.callParent(); |
529da633b8e3
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
264
diff
changeset
|
14 }, |
529da633b8e3
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
264
diff
changeset
|
15 addListeners: function() { |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
16 this.control({ |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
17 'zusatzwertelist': { |
451
d49a6fcd9f57
Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
362
diff
changeset
|
18 itemdblclick: this.editItem |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
19 }, |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
20 'zusatzwertelist toolbar button[action=add]': { |
451
d49a6fcd9f57
Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
362
diff
changeset
|
21 click: this.addItem |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
22 }, |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
23 'zusatzwertelist toolbar button[action=delete]': { |
451
d49a6fcd9f57
Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
362
diff
changeset
|
24 click: this.deleteItem |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
25 }, |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
26 'zusatzwertecreate form': { |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
27 savesuccess: this.createSuccess, |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
28 savefailure: this.createFailure |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
29 }, |
122
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
110
diff
changeset
|
30 'zusatzwertecreate button[action=save]': { |
451
d49a6fcd9f57
Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
362
diff
changeset
|
31 click: this.saveItem |
122
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
110
diff
changeset
|
32 }, |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
33 'zusatzwerteedit form': { |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
34 savesuccess: this.editSuccess, |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
35 savefailure: this.editFailure |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
36 } |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
37 }); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
38 }, |
451
d49a6fcd9f57
Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
362
diff
changeset
|
39 saveItem: function(button) { |
d49a6fcd9f57
Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
362
diff
changeset
|
40 console.log('Saving new Zusatzwert for Probe ' + button.probeId); |
d49a6fcd9f57
Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
362
diff
changeset
|
41 var form = button.up('window').down('form'); |
d49a6fcd9f57
Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
362
diff
changeset
|
42 form.commit(); |
d49a6fcd9f57
Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
362
diff
changeset
|
43 }, |
d49a6fcd9f57
Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
362
diff
changeset
|
44 addItem: function(button) { |
172
cfa0cc437781
Implemented opening a new Messungen form when clicking and the "Add Button" on
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
141
diff
changeset
|
45 console.log('Adding new Zusatzwert for Probe' + button.probeId); |
126
3d8cbc2d0dc1
Use probeId value of the add button to set the probeId of new created Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
122
diff
changeset
|
46 var zusatzwert = Ext.create('Lada.model.Zusatzwert'); |
3d8cbc2d0dc1
Use probeId value of the add button to set the probeId of new created Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
122
diff
changeset
|
47 zusatzwert.set('probeId', button.probeId); |
3d8cbc2d0dc1
Use probeId value of the add button to set the probeId of new created Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
122
diff
changeset
|
48 var view = Ext.widget('zusatzwertecreate', {model: zusatzwert}); |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
49 }, |
451
d49a6fcd9f57
Fix Creating, editing and deleting of Zusatzwerte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
362
diff
changeset
|
50 editItem: function(grid, record) { |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
51 console.log('Editing Zusatzwert'); |
362
6a7a9267e00f
Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
296
diff
changeset
|
52 record.getAuthInfo(this.initEditWindow) |
6a7a9267e00f
Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
296
diff
changeset
|
53 console.log("Loaded Zusatzwert with ID " + record.getId()); //outputs ID |
6a7a9267e00f
Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
296
diff
changeset
|
54 }, |
6a7a9267e00f
Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
296
diff
changeset
|
55 initEditWindow: function(record, readonly, owner) { |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
56 var view = Ext.widget('zusatzwertecreate', {model: record}); |
264
6aaf43f881cd
Fixed Issue17.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
172
diff
changeset
|
57 // Mark PZW Selection readonly. |
6aaf43f881cd
Fixed Issue17.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
172
diff
changeset
|
58 view.down('probenzusatzwert').disabled = true; |
362
6a7a9267e00f
Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
296
diff
changeset
|
59 var ignore = Array(); |
6a7a9267e00f
Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
296
diff
changeset
|
60 if (readonly) { |
6a7a9267e00f
Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
296
diff
changeset
|
61 var form = view.down('form'); |
6a7a9267e00f
Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
296
diff
changeset
|
62 form.setReadOnly(true, ignore); |
6a7a9267e00f
Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
296
diff
changeset
|
63 } |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
64 }, |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
65 createSuccess: function(form, record, operation) { |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
66 // Reload store |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
67 var store = this.getZusatzwerteStore(); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
68 store.reload(); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
69 var win = form.up('window'); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
70 win.close(); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
71 }, |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
72 editSuccess: function(form, record, operation) { |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
73 // Reload store |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
74 var store = this.getZusatzwerteStore(); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
75 store.reload(); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
76 var win = form.up('window'); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
77 win.close(); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
78 } |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
79 }); |