comparison app/view/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 1bd4c0709bd6
comparison
equal deleted inserted replaced
1021:1df6b6210b42 1022:6d33a84979e4
24 margin: 5, 24 margin: 5,
25 border: 0, 25 border: 0,
26 26
27 record: null, 27 record: null,
28 28
29 //trackResetOnLoad: true, 29 trackResetOnLoad: true,
30 30
31 initComponent: function() { 31 initComponent: function() {
32 var i18n = Lada.getApplication().bundle; 32 var i18n = Lada.getApplication().bundle;
33 this.items = [{ 33 this.items = [{
34 xtype: 'fieldset', 34 xtype: 'fieldset',
81 maxLength: 100, 81 maxLength: 100,
82 name: 'ortszuordnungTyp', 82 name: 'ortszuordnungTyp',
83 fieldLabel: i18n.getMsg('ortszuordnung.form.field.ortszuordnungtyp'), 83 fieldLabel: i18n.getMsg('ortszuordnung.form.field.ortszuordnungtyp'),
84 }, { 84 }, {
85 xtype: 'textfield', 85 xtype: 'textfield',
86 submitValue: true,
86 readOnly: true, 87 readOnly: true,
87 hidden: true, 88 hidden: true,
88 name: 'ortId' 89 name: 'ortId'
89 }] 90 }]
90 }, { 91 }, {
117 this.setReadOnly(false); 118 this.setReadOnly(false);
118 } 119 }
119 else { 120 else {
120 this.setReadOnly(true); 121 this.setReadOnly(true);
121 } 122 }
122 this.refreshOrt();
123 },
124
125 refreshOrt: function() {
126 var ortId = this.getRecord().get('ortId'); 123 var ortId = this.getRecord().get('ortId');
127 124 this.refreshOrt(ortId);
125 },
126
127 refreshOrt: function(ortId) {
128 var orteStore = Ext.StoreManager.get('orte'); 128 var orteStore = Ext.StoreManager.get('orte');
129 var ort = orteStore.getById(ortId); 129 var ort = orteStore.getById(ortId);
130 var verwStore = Ext.StoreManager.get('verwaltungseinheiten'); 130 var verwStore = Ext.StoreManager.get('verwaltungseinheiten');
131 var verw = verwStore.getById(ort.get('gemId')); 131 var verw = verwStore.getById(ort.get('gemId'));
132 var staatStore = Ext.StoreManager.get('staaten'); 132 var staatStore = Ext.StoreManager.get('staaten');
143 * setOrt can be called from a CallbackFunction, ie select from a grid. 143 * setOrt can be called from a CallbackFunction, ie select from a grid.
144 * it will set the ortId of this record 144 * it will set the ortId of this record
145 */ 145 */
146 setOrt: function(row, selRecord, index, opts) { 146 setOrt: function(row, selRecord, index, opts) {
147 147
148 console.log('setOrt' + Date.now());
149 var newOrtId = selRecord.get('id'); 148 var newOrtId = selRecord.get('id');
150 var r = this.getRecord(); 149 var r = this.getRecord();
151 if (newOrtId) { 150 if (newOrtId) {
152 if (newOrtId != r.get('ortId')) { 151 if (newOrtId != r.get('ortId')) {
153 this.getForm().setValues({ ortId: newOrtId}); 152 this.getForm().setValues({ ortId: newOrtId});
154 this.refreshOrt(); 153 this.refreshOrt(newOrtId);
155 //set dirty... 154 //set dirty...
156 //this.fireEvent('dirtychange', this.getForm(), true); 155 this.fireEvent('dirtychange', this.getForm(), true);
157 } 156 }
158 } 157 }
159 console.log('setOrtEnd' + Date.now());
160 }, 158 },
161 159
162 setMessages: function(errors, warnings) { 160 setMessages: function(errors, warnings) {
163 var key; 161 var key;
164 var element; 162 var element;

http://lada.wald.intevation.org