Mercurial > lada > lada-client
comparison app/controller/Zusatzwerte.js @ 491:850ccfe5f3c4
Code style.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 31 Oct 2014 23:23:32 +0100 |
parents | 446e99cfd425 |
children | d07e5086a64b |
comparison
equal
deleted
inserted
replaced
490:446e99cfd425 | 491:850ccfe5f3c4 |
---|---|
9 Ext.define('Lada.controller.Zusatzwerte', { | 9 Ext.define('Lada.controller.Zusatzwerte', { |
10 extend: 'Lada.controller.Base', | 10 extend: 'Lada.controller.Base', |
11 views: [ | 11 views: [ |
12 'zusatzwerte.Create' | 12 'zusatzwerte.Create' |
13 ], | 13 ], |
14 | |
14 stores: [ | 15 stores: [ |
15 'Zusatzwerte', | 16 'Zusatzwerte', |
16 'StaProbenzusaetze', | 17 'StaProbenzusaetze', |
17 'StaMesseinheiten' | 18 'StaMesseinheiten' |
18 ], | 19 ], |
20 | |
19 init: function() { | 21 init: function() { |
20 console.log('Initialising the Zusatzwerte controller'); | 22 console.log('Initialising the Zusatzwerte controller'); |
21 this.callParent(); | 23 this.callParent(arguments); |
22 }, | 24 }, |
25 | |
23 addListeners: function() { | 26 addListeners: function() { |
24 this.control({ | 27 this.control({ |
25 'zusatzwertelist': { | 28 'zusatzwertelist': { |
26 itemdblclick: this.editItem | 29 itemdblclick: this.editItem |
27 }, | 30 }, |
42 savesuccess: this.editSuccess, | 45 savesuccess: this.editSuccess, |
43 savefailure: this.editFailure | 46 savefailure: this.editFailure |
44 } | 47 } |
45 }); | 48 }); |
46 }, | 49 }, |
50 | |
47 saveItem: function(button) { | 51 saveItem: function(button) { |
48 console.log('Saving new Zusatzwert for Probe ' + button.probeId); | 52 console.log('Saving new Zusatzwert for Probe ' + button.probeId); |
49 var form = button.up('window').down('form'); | 53 var form = button.up('window').down('form'); |
50 form.commit(); | 54 form.commit(); |
51 }, | 55 }, |
56 | |
52 addItem: function(button) { | 57 addItem: function(button) { |
53 console.log('Adding new Zusatzwert for Probe' + button.probeId); | 58 console.log('Adding new Zusatzwert for Probe' + button.probeId); |
54 var zusatzwert = Ext.create('Lada.model.Zusatzwert'); | 59 var zusatzwert = Ext.create('Lada.model.Zusatzwert'); |
55 zusatzwert.set('probeId', button.probeId); | 60 zusatzwert.set('probeId', button.probeId); |
56 var view = Ext.widget('zusatzwertecreate', {model: zusatzwert}); | 61 var view = Ext.widget('zusatzwertecreate', { |
62 model: zusatzwert | |
63 }); | |
57 }, | 64 }, |
65 | |
58 editItem: function(grid, record) { | 66 editItem: function(grid, record) { |
59 console.log('Editing Zusatzwert'); | 67 console.log('Editing Zusatzwert'); |
60 record.getAuthInfo(this.initEditWindow) | 68 record.getAuthInfo(this.initEditWindow) |
61 console.log("Loaded Zusatzwert with ID " + record.getId()); //outputs ID | 69 console.log("Loaded Zusatzwert with ID " + record.getId()); //outputs ID |
62 }, | 70 }, |
71 | |
63 initEditWindow: function(record, readonly, owner) { | 72 initEditWindow: function(record, readonly, owner) { |
64 var view = Ext.widget('zusatzwertecreate', {model: record}); | 73 var view = Ext.widget('zusatzwertecreate', { |
74 model: record | |
75 }); | |
65 // Mark PZW Selection readonly. | 76 // Mark PZW Selection readonly. |
66 view.down('probenzusatzwert').disabled = true; | 77 view.down('probenzusatzwert').disabled = true; |
67 var ignore = Array(); | 78 var ignore = Array(); |
68 if (readonly) { | 79 if (readonly) { |
69 var form = view.down('form'); | 80 var form = view.down('form'); |
70 form.setReadOnly(true, ignore); | 81 form.setReadOnly(true, ignore); |
71 } | 82 } |
72 }, | 83 }, |
84 | |
73 createSuccess: function(form, record, operation) { | 85 createSuccess: function(form, record, operation) { |
74 // Reload store | 86 // Reload store |
75 var store = this.getZusatzwerteStore(); | 87 var store = this.getZusatzwerteStore(); |
76 store.reload(); | 88 store.reload(); |
77 var win = form.up('window'); | 89 var win = form.up('window'); |
78 win.close(); | 90 win.close(); |
79 }, | 91 }, |
92 | |
80 editSuccess: function(form, record, operation) { | 93 editSuccess: function(form, record, operation) { |
81 // Reload store | 94 // Reload store |
82 var store = this.getZusatzwerteStore(); | 95 var store = this.getZusatzwerteStore(); |
83 store.reload(); | 96 store.reload(); |
84 var win = form.up('window'); | 97 var win = form.up('window'); |