Mercurial > lada > lada-client
comparison app/controller/MKommentare.js @ 491:850ccfe5f3c4
Code style.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 31 Oct 2014 23:23:32 +0100 |
parents | 446e99cfd425 |
children | 7c0653e8d9f7 |
comparison
equal
deleted
inserted
replaced
490:446e99cfd425 | 491:850ccfe5f3c4 |
---|---|
9 /** | 9 /** |
10 * Controller for Kommentare on Messungen | 10 * Controller for Kommentare on Messungen |
11 */ | 11 */ |
12 Ext.define('Lada.controller.MKommentare', { | 12 Ext.define('Lada.controller.MKommentare', { |
13 extend: 'Lada.controller.Base', | 13 extend: 'Lada.controller.Base', |
14 | |
14 views: [ | 15 views: [ |
15 'mkommentare.Create' | 16 'mkommentare.Create' |
16 ], | 17 ], |
18 | |
17 stores: [ | 19 stores: [ |
18 'KommentareM' | 20 'KommentareM' |
19 ], | 21 ], |
22 | |
20 models: [ | 23 models: [ |
21 'KommentarM' | 24 'KommentarM' |
22 ], | 25 ], |
26 | |
23 init: function() { | 27 init: function() { |
24 console.log('Initialising the MKommentare controller'); | 28 console.log('Initialising the MKommentare controller'); |
25 this.callParent(); | 29 this.callParent(arguments); |
26 }, | 30 }, |
31 | |
27 addListeners: function() { | 32 addListeners: function() { |
28 this.control({ | 33 this.control({ |
29 'mkommentarelist': { | 34 'mkommentarelist': { |
30 itemdblclick: this.editItem | 35 itemdblclick: this.editItem |
31 }, | 36 }, |
42 savesuccess: this.createSuccess, | 47 savesuccess: this.createSuccess, |
43 savefailure: this.createFailure | 48 savefailure: this.createFailure |
44 } | 49 } |
45 }); | 50 }); |
46 }, | 51 }, |
52 | |
47 addItem: function(button) { | 53 addItem: function(button) { |
48 console.log('Adding new MKommentar for Messung ' + button.parentId + ' Probe ' + button.probeId); | |
49 var kommentar = Ext.create('Lada.model.KommentarM'); | 54 var kommentar = Ext.create('Lada.model.KommentarM'); |
50 kommentar.set('probeId', button.probeId); | 55 kommentar.set('probeId', button.probeId); |
51 kommentar.set('messungsId', button.parentId); | 56 kommentar.set('messungsId', button.parentId); |
52 var view = Ext.widget('mkommentarecreate', {model: kommentar}); | 57 var view = Ext.widget('mkommentarecreate', {model: kommentar}); |
53 }, | 58 }, |
59 | |
54 editItem: function(grid, record) { | 60 editItem: function(grid, record) { |
55 console.log('Editing Kommentar'); | 61 console.log('Editing Kommentar'); |
56 var mstore = Ext.data.StoreManager.get('Messungen'); | 62 var mstore = Ext.data.StoreManager.get('Messungen'); |
57 var messung = mstore.getById(record.get('messungsId')); | 63 var messung = mstore.getById(record.get('messungsId')); |
58 record.getAuthInfo(this.initEditWindow, messung.get('probeId')) | 64 record.getAuthInfo(this.initEditWindow, messung.get('probeId')) |
59 console.log("Loaded MKommentar with ID " + record.getId()); //outputs ID | 65 console.log("Loaded MKommentar with ID " + record.getId()); //outputs ID |
60 }, | 66 }, |
67 | |
61 initEditWindow: function(record, readonly, owner) { | 68 initEditWindow: function(record, readonly, owner) { |
62 var view = Ext.widget('mkommentarecreate', {model: record}); | 69 var view = Ext.widget('mkommentarecreate', { |
70 model: record | |
71 }); | |
63 var ignore = Array(); | 72 var ignore = Array(); |
64 if (readonly) { | 73 if (readonly) { |
65 var form = view.down('form'); | 74 var form = view.down('form'); |
66 form.setReadOnly(true, ignore); | 75 form.setReadOnly(true, ignore); |
67 } | 76 } |
68 }, | 77 }, |
78 | |
69 createSuccess: function(form, record, operation) { | 79 createSuccess: function(form, record, operation) { |
70 // Reload store | 80 // Reload store |
71 var store = this.getKommentareMStore(); | 81 var store = this.getKommentareMStore(); |
72 store.reload(); | 82 store.reload(); |
73 var win = form.up('window'); | 83 var win = form.up('window'); |