annotate app/controller/Status.js @ 413:e1af66012ef0 0.6

Reverse displayFields Array before configuring the columns of the result list. Now the displayed columns are in the same order as defined in the query configuration file.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Mon, 23 Sep 2013 14:26:09 +0200
parents 6a7a9267e00f
children f9bb1ecf6462
rev   line source
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
1 Ext.define('Lada.controller.Status', {
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
2 extend: 'Lada.controller.Base',
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
3 views: [
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
4 'status.Create'
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
5 ],
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
6 stores: [
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
7 'Status'
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
8 ],
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
9 init: function() {
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
10 console.log('Initialising the Status controller');
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
11 this.callParent();
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
12 },
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
13 addListeners: function() {
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
14 this.control({
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
15 'statuslist': {
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
16 itemdblclick: this.editItem
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
17 },
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
18 'statuslist toolbar button[action=add]': {
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
19 click: this.addItem
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
20 },
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
21 'statuslist toolbar button[action=delete]': {
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
22 click: this.deleteItem
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
23 },
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
24 'statuscreate form': {
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
25 savesuccess: this.createSuccess,
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
26 savefailure: this.createFailure
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
27 },
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
28 'statuscreate button[action=save]': {
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
29 click: this.saveItem
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
30 },
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
31 'statusedit form': {
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
32 savesuccess: this.editSuccess,
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
33 savefailure: this.editFailure
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
34 }
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
35 });
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
36 },
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
37 addItem: function(button) {
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
38 console.log('Adding new Status for Messung ' + button.parentId + ' in Probe ' + button.probeId);
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
39 var zusatzwert = Ext.create('Lada.model.Status');
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
40 zusatzwert.set('probeId', button.probeId);
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
41 zusatzwert.set('messungsId', button.parentId);
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
42 var view = Ext.widget('statuscreate', {model: zusatzwert});
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
43 },
295
841dc60824b5 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 202
diff changeset
44 editItem: function(grid, record) {
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
45 console.log('Editing Status');
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: 295
diff changeset
46 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: 295
diff changeset
47 console.log("Loaded Status 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: 295
diff changeset
48 },
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: 295
diff changeset
49 initEditWindow: function(record, readonly, owner) {
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
50 var view = Ext.widget('statuscreate', {model: record});
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: 295
diff changeset
51 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: 295
diff changeset
52 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: 295
diff changeset
53 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: 295
diff changeset
54 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: 295
diff changeset
55 }
202
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
56 },
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
57 createSuccess: function(form, record, operation) {
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
58 // Reload store
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
59 var store = this.getStatusStore();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
60 store.reload();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
61 var win = form.up('window');
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
62 win.close();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
63 },
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
64 editSuccess: function(form, record, operation) {
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
65 // Reload store
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
66 var store = this.getStatusStore();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
67 store.reload();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
68 var win = form.up('window');
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
69 win.close();
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
70 },
7a4d93c9b0ff Added status controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
71 });

http://lada.wald.intevation.org