Mercurial > lada > lada-client
comparison app/controller/form/Ortserstellung.js @ 1339:1a2cd9bef6d7
messprogramm zuordnung now functional
author | Maximilian Krambach <mkrambach@intevation.de> |
---|---|
date | Fri, 03 Feb 2017 19:37:28 +0100 |
parents | 7194964183f4 |
children | d5e270fa91e4 |
comparison
equal
deleted
inserted
replaced
1338:d2f06ce4d43a | 1339:1a2cd9bef6d7 |
---|---|
39 change: this.checkCommitEnabled | 39 change: this.checkCommitEnabled |
40 } | 40 } |
41 }); | 41 }); |
42 }, | 42 }, |
43 | 43 |
44 save: function() { | 44 save: function(button) { |
45 var this_panel = this.up('panel'); | 45 var me = button.up('panel'); |
46 var me = this; | 46 var form = me.getForm(); |
47 var form = this_panel.getForm(); | |
48 var record = form.getRecord(); | 47 var record = form.getRecord(); |
49 var data = form.getFieldValues(true); | 48 var data = form.getFieldValues(true); |
50 for (var key in data) { | 49 for (var key in data) { |
51 record.set(key, data[key]); | 50 record.set(key, data[key]); |
52 } | 51 } |
53 record.set('id', null); | 52 record.set('id', null); |
54 record.set('netzbetreiberId', Lada.netzbetreiber[0]); | 53 record.set('netzbetreiberId', Lada.netzbetreiber[0]); |
55 record.save({ | 54 record.save({ |
56 success: function(newrecord, response) { | 55 success: function(newrecord, response) { |
57 form.loadRecord(newrecord); | 56 form.loadRecord(newrecord); |
58 this_panel.down('verwaltungseinheit').store.load( | 57 me.down('verwaltungseinheit').store.load( |
59 { id:newrecord.get('gemId') }); | 58 { id:newrecord.get('gemId') }); |
60 this_panel.down('staat').store.load( | 59 me.down('staat').store.load( |
61 { id : newrecord.get('staat') }); | 60 { id : newrecord.get('staat') }); |
62 me.setDisabled(true); | 61 button.setDisabled(true); |
63 me.hide(); | 62 me.down('button[action=revert]').setDisabled(true); |
64 var ozw = this_panel.up().parentWindow; | 63 button.hide(); |
64 var ozw = me.up().parentWindow; | |
65 var json = Ext.decode(response.response.responseText); | 65 var json = Ext.decode(response.response.responseText); |
66 if (json) { | 66 if (json) { |
67 this_panel.clearMessages(); | 67 me.clearMessages(); |
68 this_panel.setMessages(json.errors, json.warnings); | 68 me.setMessages(json.errors, json.warnings); |
69 } | 69 } |
70 ozw.ortstore.load({ | 70 ozw.ortstore.load({ |
71 callback: function(records, operation, success) { | 71 callback: function(records, operation, success) { |
72 ozw.down('map').addLocations(ozw.ortstore); | 72 ozw.down('map').addLocations(ozw.ortstore); |
73 var osg = ozw.down('ortstammdatengrid'); | 73 var osg = ozw.down('ortstammdatengrid'); |
118 } | 118 } |
119 }); | 119 }); |
120 }, | 120 }, |
121 | 121 |
122 discard: function(button) { | 122 discard: function(button) { |
123 this.up('panel').getForm().reset(); | 123 button.up('panel').reset(); |
124 this.up('toolbar').down('button [action=save]').setDisabled(true); | 124 button.up('panel').down('button [action=save]').setDisabled(true); |
125 }, | 125 }, |
126 | 126 |
127 /** | 127 /** |
128 * checks if the Messpunkt can be committed. | 128 * checks if the Messpunkt can be committed. |
129 * Disables the save button if false | 129 * Disables the save button if false |