Mercurial > lada > lada-client
comparison app/controller/Status.js @ 491:850ccfe5f3c4
Code style.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 31 Oct 2014 23:23:32 +0100 |
parents | 446e99cfd425 |
children | 8b4ec61c5752 |
comparison
equal
deleted
inserted
replaced
490:446e99cfd425 | 491:850ccfe5f3c4 |
---|---|
6 * the documentation coming with IMIS-Labordaten-Application for details. | 6 * the documentation coming with IMIS-Labordaten-Application for details. |
7 */ | 7 */ |
8 | 8 |
9 Ext.define('Lada.controller.Status', { | 9 Ext.define('Lada.controller.Status', { |
10 extend: 'Lada.controller.Base', | 10 extend: 'Lada.controller.Base', |
11 | |
11 views: [ | 12 views: [ |
12 'status.Create' | 13 'status.Create' |
13 ], | 14 ], |
15 | |
14 stores: [ | 16 stores: [ |
15 'Status' | 17 'Status' |
16 ], | 18 ], |
19 | |
17 init: function() { | 20 init: function() { |
18 console.log('Initialising the Status controller'); | 21 console.log('Initialising the Status controller'); |
19 this.callParent(); | 22 this.callParent(arguments); |
20 }, | 23 }, |
24 | |
21 addListeners: function() { | 25 addListeners: function() { |
22 this.control({ | 26 this.control({ |
23 'statuslist': { | 27 'statuslist': { |
24 itemdblclick: this.editItem | 28 itemdblclick: this.editItem |
25 }, | 29 }, |
40 savesuccess: this.editSuccess, | 44 savesuccess: this.editSuccess, |
41 savefailure: this.editFailure | 45 savefailure: this.editFailure |
42 } | 46 } |
43 }); | 47 }); |
44 }, | 48 }, |
49 | |
45 addItem: function(button) { | 50 addItem: function(button) { |
46 console.log('Adding new Status for Messung ' + button.parentId + ' in Probe ' + button.probeId); | |
47 var zusatzwert = Ext.create('Lada.model.Status'); | 51 var zusatzwert = Ext.create('Lada.model.Status'); |
48 zusatzwert.set('probeId', button.probeId); | 52 zusatzwert.set('probeId', button.probeId); |
49 zusatzwert.set('messungsId', button.parentId); | 53 zusatzwert.set('messungsId', button.parentId); |
50 var view = Ext.widget('statuscreate', {model: zusatzwert}); | 54 var view = Ext.widget('statuscreate', { |
55 model: zusatzwert | |
56 }); | |
51 }, | 57 }, |
58 | |
52 editItem: function(grid, record) { | 59 editItem: function(grid, record) { |
53 console.log('Editing Status'); | 60 console.log('Editing Status'); |
54 var mstore = Ext.data.StoreManager.get('Messungen'); | 61 var mstore = Ext.data.StoreManager.get('Messungen'); |
55 var messung = mstore.getById(record.get('messungsId')); | 62 var messung = mstore.getById(record.get('messungsId')); |
56 record.getAuthInfo(this.initEditWindow, messung.get('probeId')); | 63 record.getAuthInfo(this.initEditWindow, messung.get('probeId')); |
57 console.log("Loaded Status with ID " + record.getId()); //outputs ID | 64 console.log("Loaded Status with ID " + record.getId()); //outputs ID |
58 }, | 65 }, |
66 | |
59 initEditWindow: function(record, readonly, owner) { | 67 initEditWindow: function(record, readonly, owner) { |
60 var view = Ext.widget('statuscreate', {model: record}); | 68 var view = Ext.widget('statuscreate', { |
69 model: record | |
70 }); | |
61 var ignore = Array(); | 71 var ignore = Array(); |
62 if (readonly) { | 72 if (readonly) { |
63 var form = view.down('form'); | 73 var form = view.down('form'); |
64 form.setReadOnly(true, ignore); | 74 form.setReadOnly(true, ignore); |
65 } | 75 } |
66 }, | 76 }, |
77 | |
67 createSuccess: function(form, record, operation) { | 78 createSuccess: function(form, record, operation) { |
68 // Reload store | 79 // Reload store |
69 var store = this.getStatusStore(); | 80 var store = this.getStatusStore(); |
70 store.reload(); | 81 store.reload(); |
71 var win = form.up('window'); | 82 var win = form.up('window'); |
72 win.close(); | 83 win.close(); |
73 }, | 84 }, |
85 | |
74 editSuccess: function(form, record, operation) { | 86 editSuccess: function(form, record, operation) { |
75 // Reload store | 87 // Reload store |
76 var store = this.getStatusStore(); | 88 var store = this.getStatusStore(); |
77 store.reload(); | 89 store.reload(); |
78 var win = form.up('window'); | 90 var win = form.up('window'); |