comparison app/controller/Messwert.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
16 ], 16 ],
17 stores: [ 17 stores: [
18 'Proben', 18 'Proben',
19 'Messungen', 19 'Messungen',
20 'Messwerte', 20 'Messwerte',
21 'Messeinheit', 21 'StaMesseinheiten',
22 'Messgroessen' 22 'StaMessgroessen'
23 ], 23 ],
24 init: function() { 24 init: function() {
25 console.log('Initialising the Messwert controller'); 25 console.log('Initialising the Messwert controller');
26 this.callParent(); 26 this.callParent();
27 }, 27 },
57 messung.set('messungsId', button.parentId); 57 messung.set('messungsId', button.parentId);
58 var view = Ext.widget('messwertecreate', {model: messung}); 58 var view = Ext.widget('messwertecreate', {model: messung});
59 }, 59 },
60 editItem: function(grid, record) { 60 editItem: function(grid, record) {
61 console.log('Editing Messwert'); 61 console.log('Editing Messwert');
62 record.getAuthInfo(this.initEditWindow); 62 var mstore = Ext.data.StoreManager.get('Messungen');
63 var pstore = Ext.data.StoreManager.get('Proben');
64 var messung = mstore.getById(record.get('messungsId'))
65 record.getAuthInfo(this.initEditWindow, messung.get('probeId'));
63 console.log("Loaded Messwert with ID " + record.getId()); //outputs ID 66 console.log("Loaded Messwert with ID " + record.getId()); //outputs ID
64 }, 67 },
65 initEditWindow: function(record, readonly, owner) { 68 initEditWindow: function(record, readonly, owner) {
66 var view = Ext.widget('messwertecreate', {model: record}); 69 var view = Ext.widget('messwertecreate', {model: record});
67 var ignore = Array(); 70 var ignore = Array();
74 var grid = button.up('grid'); 77 var grid = button.up('grid');
75 var selection = grid.getView().getSelectionModel().getSelection()[0]; 78 var selection = grid.getView().getSelectionModel().getSelection()[0];
76 Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn){ 79 Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn){
77 if(btn === 'yes'){ 80 if(btn === 'yes'){
78 var store = grid.getStore(); 81 var store = grid.getStore();
79 var deleteUrl = selection.getProxy().url + selection.getEidi(); 82 var deleteUrl = selection.getProxy().url + selection.getId();
80 Ext.Ajax.request({ 83 Ext.Ajax.request({
81 url: deleteUrl, 84 url: deleteUrl,
82 method: 'DELETE', 85 method: 'DELETE',
83 success: function(response, opts) { 86 success: function(response, opts) {
84 store.reload(); 87 store.reload();

http://lada.wald.intevation.org