comparison app/controller/form/Ort.js @ 615:3d33c65319f3

Update feature selection on 'ort' selection change.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 13 Mar 2015 16:28:37 +0100
parents 9d0113bc2f70
children 5b5bba1d8e6a
comparison
equal deleted inserted replaced
614:04e380ce4d73 615:3d33c65319f3
55 if (json) { 55 if (json) {
56 formPanel.setMessages(json.errors, json.warnings); 56 formPanel.setMessages(json.errors, json.warnings);
57 } 57 }
58 } 58 }
59 }); 59 });
60 console.log('save');
61 }, 60 },
62 61
63 discard: function(button) { 62 discard: function(button) {
64 var formPanel = button.up('form'); 63 var formPanel = button.up('form');
65 formPanel.getForm().loadRecord(formPanel.getForm().getRecord()); 64 formPanel.getForm().loadRecord(formPanel.getForm().getRecord());
65 var win = button.up('window');
66 var id = formPanel.getForm().getRecord().get('ort');
67 var toLoad = Ext.data.StoreManager.get('locations').getById(id);
68 win.down('locationform').setRecord(toLoad);
69 win.down('map').selectFeature(id);
66 }, 70 },
67 71
68 dirtyForm: function(form, dirty) { 72 dirtyForm: function(form, dirty) {
69 if (dirty) { 73 if (dirty) {
70 form.owner.down('button[action=save]').setDisabled(false); 74 form.owner.down('button[action=save]').setDisabled(false);
75 form.owner.down('button[action=discard]').setDisabled(true); 79 form.owner.down('button[action=discard]').setDisabled(true);
76 } 80 }
77 }, 81 },
78 82
79 updateDetails: function(combobox, record) { 83 updateDetails: function(combobox, record) {
80 console.log(record);
81 var win = combobox.up('window'); 84 var win = combobox.up('window');
82 var details = win.down('locationform'); 85 var details = win.down('locationform');
83 var id = record[0].get('id'); 86 var id = record[0].get('id');
84 if (details) { 87 if (details) {
85 Ext.ClassManager.get('Lada.model.Location').load(id, { 88 var toLoad = Ext.data.StoreManager.get('locations').getById(id);
86 failure: function(record, action) { 89 win.down('locationform').setRecord(toLoad);
87 // TODO 90 win.down('map').selectFeature(id);
88 },
89 success: function(record, response) {
90 win.down('locationform').setRecord(record);
91 },
92 scope: this
93 });
94 } 91 }
95 } 92 }
96 }); 93 });

http://lada.wald.intevation.org