Mercurial > lada > lada-client
annotate app/controller/Zusatzwerte.js @ 330:9b9e98dacb7c
Inherit form model.base. Formatting
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Tue, 13 Aug 2013 08:54:24 +0200 |
parents | 529da633b8e3 |
children | 6a7a9267e00f |
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': { |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
18 itemdblclick: this.editZusatzwert |
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]': { |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
21 click: this.addZusatzwert |
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]': { |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
24 click: this.deleteZusatzwert |
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]': { |
a7bfaeb1655d
Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
110
diff
changeset
|
31 click: this.saveZusatzwert |
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 }, |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
39 addZusatzwert: 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
|
40 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
|
41 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
|
42 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
|
43 var view = Ext.widget('zusatzwertecreate', {model: zusatzwert}); |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
44 }, |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
45 editZusatzwert: function(grid, record) { |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
46 console.log('Editing Zusatzwert'); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
47 var view = Ext.widget('zusatzwertecreate', {model: record}); |
264
6aaf43f881cd
Fixed Issue17.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
172
diff
changeset
|
48 // Mark PZW Selection readonly. |
6aaf43f881cd
Fixed Issue17.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
172
diff
changeset
|
49 view.down('probenzusatzwert').disabled = true; |
110
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
50 console.log("Loaded Zusatzwert with ID " + record.getId()); //outputs ID |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
51 }, |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
52 createSuccess: function(form, record, operation) { |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
53 // Reload store |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
54 var store = this.getZusatzwerteStore(); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
55 store.reload(); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
56 var win = form.up('window'); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
57 win.close(); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
58 }, |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
59 editSuccess: function(form, record, operation) { |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
60 // Reload store |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
61 var store = this.getZusatzwerteStore(); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
62 store.reload(); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
63 var win = form.up('window'); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
64 win.close(); |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
65 } |
c4f97a5a9939
Added Forms to add Zusatzwerte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
66 }); |