comparison app/controller/form/Ortszuordnung.js @ 1328:cf73b7d7cf99

reinserted discard button and functionality
author Maximilian Krambach <mkrambach@intevation.de>
date Fri, 03 Feb 2017 15:31:18 +0100
parents c413ec1aaa2e
children cba4e0b0e336
comparison
equal deleted inserted replaced
1327:c413ec1aaa2e 1328:cf73b7d7cf99
21 toggle: this.chooseLocation 21 toggle: this.chooseLocation
22 }, 22 },
23 'ortszuordnungform button[action=save]': { 23 'ortszuordnungform button[action=save]': {
24 click: this.save 24 click: this.save
25 }, 25 },
26 'ortszuordnungform button[action=revert]': {
27 click: this.revert
28 },
26 'ortszuordnungform': { 29 'ortszuordnungform': {
27 validitychange: this.validityChange, 30 validitychange: this.validityChange,
28 dirtychange: this.validityChange 31 dirtychange: this.validityChange
29 } 32 }
30 }); 33 });
45 } 48 }
46 catch (e) { 49 catch (e) {
47 } 50 }
48 var data = formPanel.getForm().getFieldValues(false); 51 var data = formPanel.getForm().getFieldValues(false);
49 var i18n = Lada.getApplication().bundle; 52 var i18n = Lada.getApplication().bundle;
50 //TODO: the forms seem not to submit anything into record.
51 var recordData = formPanel.getForm().getRecord().data; 53 var recordData = formPanel.getForm().getRecord().data;
52 if (recordData['probeId'] !== undefined) { 54 if (recordData['probeId'] !== undefined) {
53 // TODO: as model.ort.ortId and model.ortszuordnung.ortId coexist, 55 // TODO: as model.ort.ortId and model.ortszuordnung.ortId coexist,
54 // but mean different things, data.ortId is an array here, of 56 // but mean different things, data.ortId is an array here, of
55 // which we need the first entry 57 // which we need the first entry
105 Ext.Msg.alert(i18n.getMsg('err.msg.save.title'), 107 Ext.Msg.alert(i18n.getMsg('err.msg.save.title'),
106 i18n.getMsg('err.msg.response.body')); 108 i18n.getMsg('err.msg.response.body'));
107 } 109 }
108 } 110 }
109 }); 111 });
112 },
113
114 /**
115 * reverts the form to the currently saved state
116 */
117 revert: function(button) {
118 var form = button.up('form');
119 var osg = button.up('window').down('ortstammdatengrid');
120 var recordData = form.getForm().getRecord().data;
121 var currentOrt = null;
122 if (recordData.ortId !== undefined) {
123 currentOrt = recordData.ortId;
124 } else {
125 currentOrt = recordData.ort;
126 }
127 var record = osg.store.getById(currentOrt);
128 var selmod = osg.getView().getSelectionModel();
129 form.getForm().reset();
130 var selmod = osg.getView().getSelectionModel();
131 selmod.select(record);
110 }, 132 },
111 133
112 /** 134 /**
113 * When the button is Active, a Record can be selected. 135 * When the button is Active, a Record can be selected.
114 * If the Record was selected from a grid this function 136 * If the Record was selected from a grid this function

http://lada.wald.intevation.org