Mercurial > lada > lada-client
comparison app/controller/MKommentare.js @ 490:446e99cfd425
Updated views and controllers using the new model and stores.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 31 Oct 2014 21:28:31 +0100 |
parents | debfcc7713e3 |
children | 850ccfe5f3c4 |
comparison
equal
deleted
inserted
replaced
489:6056a7fd9aa2 | 490:446e99cfd425 |
---|---|
13 extend: 'Lada.controller.Base', | 13 extend: 'Lada.controller.Base', |
14 views: [ | 14 views: [ |
15 'mkommentare.Create' | 15 'mkommentare.Create' |
16 ], | 16 ], |
17 stores: [ | 17 stores: [ |
18 'MKommentare' | 18 'KommentareM' |
19 ], | 19 ], |
20 models: [ | 20 models: [ |
21 'MKommentar' | 21 'KommentarM' |
22 ], | 22 ], |
23 init: function() { | 23 init: function() { |
24 console.log('Initialising the MKommentare controller'); | 24 console.log('Initialising the MKommentare controller'); |
25 this.callParent(); | 25 this.callParent(); |
26 }, | 26 }, |
44 } | 44 } |
45 }); | 45 }); |
46 }, | 46 }, |
47 addItem: function(button) { | 47 addItem: function(button) { |
48 console.log('Adding new MKommentar for Messung ' + button.parentId + ' Probe ' + button.probeId); | 48 console.log('Adding new MKommentar for Messung ' + button.parentId + ' Probe ' + button.probeId); |
49 var kommentar = Ext.create('Lada.model.MKommentar'); | 49 var kommentar = Ext.create('Lada.model.KommentarM'); |
50 kommentar.set('probeId', button.probeId); | 50 kommentar.set('probeId', button.probeId); |
51 kommentar.set('messungsId', button.parentId); | 51 kommentar.set('messungsId', button.parentId); |
52 var view = Ext.widget('mkommentarecreate', {model: kommentar}); | 52 var view = Ext.widget('mkommentarecreate', {model: kommentar}); |
53 }, | 53 }, |
54 editItem: function(grid, record) { | 54 editItem: function(grid, record) { |
55 console.log('Editing Kommentar'); | 55 console.log('Editing Kommentar'); |
56 record.getAuthInfo(this.initEditWindow) | 56 var mstore = Ext.data.StoreManager.get('Messungen'); |
57 var messung = mstore.getById(record.get('messungsId')); | |
58 record.getAuthInfo(this.initEditWindow, messung.get('probeId')) | |
57 console.log("Loaded MKommentar with ID " + record.getId()); //outputs ID | 59 console.log("Loaded MKommentar with ID " + record.getId()); //outputs ID |
58 }, | 60 }, |
59 initEditWindow: function(record, readonly, owner) { | 61 initEditWindow: function(record, readonly, owner) { |
60 var view = Ext.widget('mkommentarecreate', {model: record}); | 62 var view = Ext.widget('mkommentarecreate', {model: record}); |
61 var ignore = Array(); | 63 var ignore = Array(); |
64 form.setReadOnly(true, ignore); | 66 form.setReadOnly(true, ignore); |
65 } | 67 } |
66 }, | 68 }, |
67 createSuccess: function(form, record, operation) { | 69 createSuccess: function(form, record, operation) { |
68 // Reload store | 70 // Reload store |
69 var store = this.getMKommentareStore(); | 71 var store = this.getKommentareMStore(); |
70 store.reload(); | 72 store.reload(); |
71 var win = form.up('window'); | 73 var win = form.up('window'); |
72 win.close(); | 74 win.close(); |
73 } | 75 } |
74 }); | 76 }); |