diff 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
line wrap: on
line diff
--- a/app/controller/MKommentare.js	Fri Oct 31 21:11:25 2014 +0100
+++ b/app/controller/MKommentare.js	Fri Oct 31 21:28:31 2014 +0100
@@ -15,10 +15,10 @@
         'mkommentare.Create'
     ],
     stores: [
-        'MKommentare'
+        'KommentareM'
     ],
     models: [
-        'MKommentar'
+        'KommentarM'
     ],
     init: function() {
         console.log('Initialising the MKommentare controller');
@@ -46,14 +46,16 @@
     },
     addItem: function(button) {
         console.log('Adding new MKommentar for Messung ' + button.parentId + ' Probe ' + button.probeId);
-        var kommentar = Ext.create('Lada.model.MKommentar');
+        var kommentar = Ext.create('Lada.model.KommentarM');
         kommentar.set('probeId', button.probeId);
         kommentar.set('messungsId', button.parentId);
         var view = Ext.widget('mkommentarecreate', {model: kommentar});
     },
     editItem: function(grid, record) {
         console.log('Editing Kommentar');
-        record.getAuthInfo(this.initEditWindow)
+        var mstore = Ext.data.StoreManager.get('Messungen');
+        var messung = mstore.getById(record.get('messungsId'));
+        record.getAuthInfo(this.initEditWindow, messung.get('probeId'))
         console.log("Loaded MKommentar with ID " + record.getId()); //outputs ID
     },
     initEditWindow: function(record, readonly, owner) {
@@ -66,7 +68,7 @@
     },
     createSuccess: function(form, record, operation) {
         // Reload store
-        var store = this.getMKommentareStore();
+        var store = this.getKommentareMStore();
         store.reload();
         var win = form.up('window');
         win.close();

http://lada.wald.intevation.org