Mercurial > lada > lada-client
annotate app/controller/Proben.js @ 70:1a943947a7d2
Added new listeners for events comming from the Probenforms.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Wed, 05 Jun 2013 15:43:42 +0200 |
parents | cb1138f5cea7 |
children | db26aeebe521 |
rev | line source |
---|---|
1
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
1 Ext.define('Lada.controller.Proben', { |
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
2 extend: 'Ext.app.Controller', |
4
b8e56e880f02
Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
1
diff
changeset
|
3 views: [ |
18
9e1a40312bbe
Implemented a basic edit dialog. Data will be set to data/proben2.json url
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
4 'proben.List', |
65
9e2e09e819fd
Added a new Dialog to create proben without any kommentare or other additional
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
64
diff
changeset
|
5 'proben.Edit', |
9e2e09e819fd
Added a new Dialog to create proben without any kommentare or other additional
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
64
diff
changeset
|
6 'proben.Create' |
4
b8e56e880f02
Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
1
diff
changeset
|
7 ], |
13
a8efc4b96888
Added model for Proben and a Store.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
5
diff
changeset
|
8 stores: [ |
40
f9b6de636ad0
Added probenart combobox
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
18
diff
changeset
|
9 'Proben', |
42
5ed477590736
Added missiong code for uwb.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
41
diff
changeset
|
10 'Uwb', |
41
a1be7ccd4d0c
Added datenbasis combobox
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
40
diff
changeset
|
11 'Datenbasis', |
46
39f5f1529847
Added combotbox for Betriebsart.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
42
diff
changeset
|
12 'Probenart', |
49
792c34b3f5a9
Added combobox for field "testdatensatz"
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
46
diff
changeset
|
13 'Betriebsart', |
54
3c7bfff8bd64
Added Controller for kommentare
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
53
diff
changeset
|
14 'Testdatensatz' |
13
a8efc4b96888
Added model for Proben and a Store.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
5
diff
changeset
|
15 ], |
a8efc4b96888
Added model for Proben and a Store.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
5
diff
changeset
|
16 models: [ |
a8efc4b96888
Added model for Proben and a Store.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
5
diff
changeset
|
17 'Probe' |
a8efc4b96888
Added model for Proben and a Store.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
5
diff
changeset
|
18 ], |
1
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
19 init: function() { |
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
20 console.log('Initialising the Proben controller'); |
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
21 this.control({ |
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
22 // CSS like selector to select element in the viewport. See |
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
23 // ComponentQuery documentation for more details. |
18
9e1a40312bbe
Implemented a basic edit dialog. Data will be set to data/proben2.json url
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
24 'probenlist': { |
5
039584709fa7
Map double click event on rows of the userlist to the editProben function.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
4
diff
changeset
|
25 itemdblclick: this.editProbe |
18
9e1a40312bbe
Implemented a basic edit dialog. Data will be set to data/proben2.json url
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
26 }, |
64
a4a24e737deb
Added listener to open a new window to enter data fpr the new probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
54
diff
changeset
|
27 'probenlist toolbar button[action=add]': { |
a4a24e737deb
Added listener to open a new window to enter data fpr the new probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
54
diff
changeset
|
28 click: this.addProbe |
a4a24e737deb
Added listener to open a new window to enter data fpr the new probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
54
diff
changeset
|
29 }, |
70
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
30 'probencreate form': { |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
31 savesuccess: this.createSuccess, |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
32 savefailure: this.createFailure |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
33 }, |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
34 'probenedit form': { |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
35 savesuccess: this.editSuccess, |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
36 savefailure: this.editFailure |
1
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
37 } |
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
38 }); |
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
39 }, |
64
a4a24e737deb
Added listener to open a new window to enter data fpr the new probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
54
diff
changeset
|
40 addProbe: function(button) { |
70
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
41 console.log('Adding new Probe 1'); |
65
9e2e09e819fd
Added a new Dialog to create proben without any kommentare or other additional
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
64
diff
changeset
|
42 var view = Ext.widget('probencreate'); |
64
a4a24e737deb
Added listener to open a new window to enter data fpr the new probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
54
diff
changeset
|
43 }, |
5
039584709fa7
Map double click event on rows of the userlist to the editProben function.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
4
diff
changeset
|
44 editProbe: function(grid, record) { |
51
230bac063b0b
Fixed debug output of the selected probe on doubleclick in grid.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
49
diff
changeset
|
45 console.log('Double click on ' + record.get('probeId')); |
18
9e1a40312bbe
Implemented a basic edit dialog. Data will be set to data/proben2.json url
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
46 // Create new window to edit the seletced record. |
9e1a40312bbe
Implemented a basic edit dialog. Data will be set to data/proben2.json url
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
47 var view = Ext.widget('probenedit'); |
53
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
52
diff
changeset
|
48 var form = view.down('form'); |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
52
diff
changeset
|
49 form.loadRecord(record); |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
52
diff
changeset
|
50 |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
52
diff
changeset
|
51 // Load kommentare |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
52
diff
changeset
|
52 var kommentare = form.down('kommentarelist'); //form.down('kommentare'); |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
52
diff
changeset
|
53 var kstore = kommentare.getStore(); |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
52
diff
changeset
|
54 kstore.load({ |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
52
diff
changeset
|
55 params: { |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
52
diff
changeset
|
56 probe: record.data['probeId'] |
52
af418743e1f4
Load Proben form with detailed version of the proben record.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
51
diff
changeset
|
57 } |
af418743e1f4
Load Proben form with detailed version of the proben record.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
51
diff
changeset
|
58 }); |
53
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
52
diff
changeset
|
59 |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
52
diff
changeset
|
60 // Set form data |
73bc17de6ff2
Added store, view and model for kommentare. Load kommentare when opening a probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
52
diff
changeset
|
61 console.log("Loaded probe with ID " + record.getId()); //outputs ID |
18
9e1a40312bbe
Implemented a basic edit dialog. Data will be set to data/proben2.json url
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
62 }, |
69
cb1138f5cea7
Removed old code
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
65
diff
changeset
|
63 createSuccess: function(form, record, operation) { |
cb1138f5cea7
Removed old code
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
65
diff
changeset
|
64 var win = form.up('window'); |
18
9e1a40312bbe
Implemented a basic edit dialog. Data will be set to data/proben2.json url
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
13
diff
changeset
|
65 win.close(); |
70
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
66 }, |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
67 createFailure: function(form, record, operation) { |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
68 Ext.MessageBox.show({ |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
69 title: 'Fehler beim Speichern', |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
70 msg: 'Es gab Fehler beim Anlegen der Probe', |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
71 icon: Ext.MessageBox.ERROR, |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
72 buttons: Ext.Msg.OK |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
73 }); |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
74 }, |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
75 editSuccess: function(form, record, operation) { |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
76 var win = form.up('window'); |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
77 win.close(); |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
78 }, |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
79 editFailure: function(form, record, operation) { |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
80 Ext.MessageBox.show({ |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
81 title: 'Fehler beim Speichern', |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
82 msg: 'Es gab Fehler beim Speichern der Probe', |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
83 icon: Ext.MessageBox.ERROR, |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
84 buttons: Ext.Msg.OK |
1a943947a7d2
Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
69
diff
changeset
|
85 }); |
1
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
86 } |
af8d7217521d
Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
87 }); |