comparison app/controller/Messungen.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
17 ], 17 ],
18 stores: [ 18 stores: [
19 'Proben', 19 'Proben',
20 'Messungen', 20 'Messungen',
21 'Messwerte', 21 'Messwerte',
22 'MKommentare', 22 'KommentareM',
23 'Status', 23 'Status',
24 'Messgroessen' 24 'StaMessgroessen'
25 ], 25 ],
26 init: function() { 26 init: function() {
27 console.log('Initialising the Messungen controller'); 27 console.log('Initialising the Messungen controller');
28 this.callParent(); 28 this.callParent();
29 }, 29 },
65 messung.set('probeId', button.probeId); 65 messung.set('probeId', button.probeId);
66 var view = Ext.widget('messungencreate', {model: messung}); 66 var view = Ext.widget('messungencreate', {model: messung});
67 }, 67 },
68 editItem: function(grid, record) { 68 editItem: function(grid, record) {
69 console.log('Editing Messung'); 69 console.log('Editing Messung');
70 var kstore = this.getMKommentareStore(); 70 var kstore = this.getKommentareMStore();
71 kstore.load({ 71 kstore.load({
72 params: { 72 params: {
73 probeId: record.get('probeId'), 73 probeId: record.get('probeId'),
74 messungsId: record.get('messungsId') 74 messungsId: record.get('id')
75 } 75 }
76 }); 76 });
77 var sstore = this.getStatusStore(); 77 var sstore = this.getStatusStore();
78 sstore.load({ 78 sstore.load({
79 params: { 79 params: {
80 probeId: record.get('probeId'), 80 probeId: record.get('probeId'),
81 messungsId: record.get('messungsId') 81 messungsId: record.get('id')
82 } 82 }
83 }); 83 });
84 var mstore = this.getMesswerteStore(); 84 var mstore = this.getMesswerteStore();
85 mstore.load({ 85 mstore.load({
86 params: { 86 params: {
87 probeId: record.get('probeId'), 87 probeId: record.get('probeId'),
88 messungsId: record.get('messungsId') 88 messungsId: record.get('id')
89 } 89 }
90 }); 90 });
91 record.getAuthInfo(this.initEditWindow); 91 record.getAuthInfo(this.initEditWindow);
92 console.log("Loaded Messung with ID " + record.getId()); //outputs ID 92 console.log("Loaded Messung with ID " + record.getId()); //outputs ID
93 }, 93 },
107 var grid = button.up('grid'); 107 var grid = button.up('grid');
108 var selection = grid.getView().getSelectionModel().getSelection()[0]; 108 var selection = grid.getView().getSelectionModel().getSelection()[0];
109 Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn){ 109 Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn){
110 if(btn === 'yes'){ 110 if(btn === 'yes'){
111 var store = grid.getStore(); 111 var store = grid.getStore();
112 var deleteUrl = selection.getProxy().url + selection.getEidi(); 112 var deleteUrl = selection.getProxy().url + selection.getId();
113 Ext.Ajax.request({ 113 Ext.Ajax.request({
114 url: deleteUrl, 114 url: deleteUrl,
115 method: 'DELETE', 115 method: 'DELETE',
116 success: function(response, opts) { 116 success: function(response, opts) {
117 store.reload(); 117 store.reload();

http://lada.wald.intevation.org