comparison app/controller/Messwert.js @ 284:c32be5f97b5d

Fix for issue58. Get the related probe for the messwert and check if the probe is set readonly. If so set the messwert dialog to readonly true.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Thu, 08 Aug 2013 15:50:07 +0200
parents 82f8b5638f26
children fe51239321d9
comparison
equal deleted inserted replaced
283:dec0893d38e3 284:c32be5f97b5d
2 extend: 'Ext.app.Controller', 2 extend: 'Ext.app.Controller',
3 views: [ 3 views: [
4 'messwerte.Create' 4 'messwerte.Create'
5 ], 5 ],
6 stores: [ 6 stores: [
7 'Proben',
7 'Messungen', 8 'Messungen',
8 'Messwerte', 9 'Messwerte',
9 'Messeinheit', 10 'Messeinheit',
10 'Messgroessen' 11 'Messgroessen'
11 ], 12 ],
44 messung.set('messungsId', button.parentId); 45 messung.set('messungsId', button.parentId);
45 var view = Ext.widget('messwertecreate', {model: messung}); 46 var view = Ext.widget('messwertecreate', {model: messung});
46 }, 47 },
47 editMesswert: function(grid, record) { 48 editMesswert: function(grid, record) {
48 console.log('Editing Messwert'); 49 console.log('Editing Messwert');
50 var probe = this.getProbenStore().getById(record.get('probeId'));
49 var view = Ext.widget('messwertecreate', {model: record}); 51 var view = Ext.widget('messwertecreate', {model: record});
52 if (probe.get('readonly') === true) {
53 var form = view.down('form');
54 form.setReadOnly(true);
55 }
56
50 console.log("Loaded Messwert with ID " + record.getId()); //outputs ID 57 console.log("Loaded Messwert with ID " + record.getId()); //outputs ID
51 }, 58 },
52 deleteMesswert: function(button) { 59 deleteMesswert: function(button) {
53 var grid = button.up('grid'); 60 var grid = button.up('grid');
54 var selection = grid.getView().getSelectionModel().getSelection()[0]; 61 var selection = grid.getView().getSelectionModel().getSelection()[0];

http://lada.wald.intevation.org