comparison app/controller/form/Ortszuordnung.js @ 1022:6d33a84979e4 stammdatengrids

More work on the Ortszuordnung grid. Saving does not work yet
author Dustin Demuth <dustin@intevation.de>
date Mon, 08 Feb 2016 10:33:25 +0100
parents 1df6b6210b42
children 2e7adc19b4fe
comparison
equal deleted inserted replaced
1021:1df6b6210b42 1022:6d33a84979e4
37 * On success it will reload the Store, 37 * On success it will reload the Store,
38 * on failure, it will display an Errormessage 38 * on failure, it will display an Errormessage
39 */ 39 */
40 save: function(button) { 40 save: function(button) {
41 41
42 var formPanel = button.up('ortszuordnungform');
43
42 //try to disable ortPickerButton: 44 //try to disable ortPickerButton:
43 try { 45 try {
44 var ob = this.up('form').down('ortszuordnungform button[action=setOrt]'); 46 formPanel.down('button[action=setOrt]').toggle(false);
45 if (ob.pressed) {
46 ob.toggle(false);
47 }
48 } 47 }
49 catch (e) { 48 catch (e) {
50 } 49 }
51 50
52 var formPanel = button.up('ortszuordnungform');
53 var data = formPanel.getForm().getFieldValues(true); 51 var data = formPanel.getForm().getFieldValues(true);
52 debugger;
53 console.log(data);
54 var i18n = Lada.getApplication().bundle; 54 var i18n = Lada.getApplication().bundle;
55 for (var key in data) { 55 for (var key in data) {
56 formPanel.getForm().getRecord().set(key, data[key]); 56 formPanel.getForm().getRecord().set(key, data[key]);
57 } 57 }
58 if (!formPanel.getForm().getRecord().get('letzteAenderung')) { 58 if (!formPanel.getForm().getRecord().get('letzteAenderung')) {
67 .setDisabled(true); 67 .setDisabled(true);
68 formPanel.clearMessages(); 68 formPanel.clearMessages();
69 formPanel.setRecord(record); 69 formPanel.setRecord(record);
70 formPanel.setMessages(json.errors, json.warnings); 70 formPanel.setMessages(json.errors, json.warnings);
71 formPanel.up('window').grid.store.reload(); 71 formPanel.up('window').grid.store.reload();
72 }
73 //try to refresh the Grid of the Probe
74 try {
75 formPanel.up('window').parentWindow
76 .down('ortszuordnunggrid').store.reload();
77 }
78 catch (e) {
79
72 } 80 }
73 }, 81 },
74 failure: function(record, response) { 82 failure: function(record, response) {
75 button.setDisabled(true); 83 button.setDisabled(true);
76 button.up('toolbar').down('button[action=discard]') 84 button.up('toolbar').down('button[action=discard]')
102 * The discard function resets the Location form 110 * The discard function resets the Location form
103 * to its original state. 111 * to its original state.
104 */ 112 */
105 discard: function(button) { 113 discard: function(button) {
106 var formPanel = button.up('form'); 114 var formPanel = button.up('form');
107 formPanel.getForm().loadRecord(formPanel.getForm().getRecord()); 115 var record = formPanel.getForm().getRecord();
116 formPanel.getForm().loadRecord(record);
117 try {
118 formPanel.refreshOrt(record.get('ortId'));
119 formPanel.down('button[action=setOrt]').toggle(false);
120 }
121 catch (e) {
122 }
123 //set undirty.
124 formPanel.fireEvent('dirtychange', formPanel.getForm(), false);
108 }, 125 },
109 126
110 /** 127 /**
111 * When the button is Active, a Record can be selected. 128 * When the button is Active, a Record can be selected.
112 * If the Record was selected from a grid this function 129 * If the Record was selected from a grid this function

http://lada.wald.intevation.org