comparison app/view/window/GenProbenFromMessprogramm.js @ 1162:b98e3af27424

Show generated objects in grid when using messprogramm to create proben
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 24 Jun 2016 13:47:11 +0200
parents ea5774447e49
children 62f374ea7ab7
comparison
equal deleted inserted replaced
1161:f56f3970d755 1162:b98e3af27424
59 url: 'lada-server/rest/probe/messprogramm', 59 url: 'lada-server/rest/probe/messprogramm',
60 method: 'POST', 60 method: 'POST',
61 jsonData: jsondata, 61 jsonData: jsondata,
62 success: function(response) { 62 success: function(response) {
63 var json = Ext.JSON.decode(response.responseText); 63 var json = Ext.JSON.decode(response.responseText);
64 var radio = Ext.ComponentQuery.query('modeswitcher')[0].down('radiofield[inputValue=proben]');
65 radio.setValue(true);
66
67 var contentPanel = Ext.ComponentQuery.query('panel[name=main]')[0].down('panel[name=contentpanel]');
68 contentPanel.removeAll(); //clear the panel: make space for new grids
69 var gridstore = Ext.create('Lada.store.Proben');
70 var frgrid = Ext.create('Lada.view.grid.ProbeList', {
71 plugins: [{
72 ptype: 'gridrowexpander',
73 gridType: 'Lada.view.grid.Messung',
74 expandOnDblClick: false,
75 gridConfig: {
76 bottomBar: false
77 }
78 }]
79 });
80
81 var columns = [{
82 header: i18n.getMsg('prnId'),
83 dataIndex: 'probeIdAlt'
84 }, {
85 header: i18n.getMsg('netzbetreiberId'),
86 dataIndex: 'netzbetreiberId',
87 renderer: function(value) {
88 var r = '';
89 if (!value || value === '') {
90 r = 'Error';
91 }
92 var store = Ext.data.StoreManager.get('netzbetreiber');
93 var record = store.getById(value);
94 if (record) {
95 r = record.get('netzbetreiber');
96 }
97 return r;
98 }
99 }, {
100 header: i18n.getMsg('mstId'),
101 dataIndex: 'mstId',
102 renderer: function(value) {
103 var r = '';
104 if (!value || value === '') {
105 r = 'Error';
106 }
107 var store = Ext.data.StoreManager.get('messstellen');
108 var record = store.getById(value);
109 if (record) {
110 r = record.get('messStelle');
111 }
112 return r;
113 }
114 }, {
115 header: i18n.getMsg('datenbasisId'),
116 dataIndex: 'datenbasisId',
117 renderer: function(value) {
118 var r = '';
119 if (!value || value === '') {
120 r = value;
121 }
122 var store = Ext.data.StoreManager.get('datenbasis');
123 var record = store.getById(value);
124 if (record) {
125 r = record.get('datenbasis');
126 }
127 return r;
128 }
129 }, {
130 header: i18n.getMsg('baId'),
131 dataIndex: 'baId',
132 renderer: function(value) {
133 var r = '';
134 if (!value || value === '') {
135 r = '';
136 }
137 var store = Ext.create('Ext.data.Store', {
138 fields: ['betriebsartId', 'betriebsart'],
139 data: [{
140 'betriebsartId': '1',
141 'betriebsart': 'Normal-/Routinebetrieb'
142 }, {
143 'betriebsartId': '2',
144 'betriebsart': 'Störfall/Intensivbetrieb'
145 }]
146 });
147 var record = store.getById(value);
148 if (record) {
149 r = record.get('betriebsart');
150 }
151 return r;
152 }
153 }, {
154 header: i18n.getMsg('probenartId'),
155 dataIndex: 'probenartId',
156 renderer: function(value) {
157 var r = '';
158 if (!value || value === '') {
159 r = value;
160 }
161 var store = Ext.data.StoreManager.get('probenarten');
162 var record = store.getById(value);
163 if (record) {
164 r = record.get('probenart');
165 }
166 return r;
167 }
168 }, {
169 header: i18n.getMsg('sollVon'),
170 dataIndex: 'solldatumBeginn',
171 renderer: function(value) {
172 console.log(value);
173 if (!value) {
174 return '';
175 }
176 return Ext.Date.format(value, 'd.m.Y');
177 }
178 }, {
179 header: i18n.getMsg('sollBis'),
180 dataIndex: 'solldatumEnde',
181 renderer: function(value) {
182 if (!value) {
183 return '';
184 }
185 return Ext.Date.format(value, 'd.m.Y');
186 }
187 }];
188 frgrid.reconfigure(gridstore, columns);
189
190 gridstore.loadData(json.data);
191 contentPanel.add(frgrid);
64 Ext.Msg.show({ 192 Ext.Msg.show({
65 title: i18n.getMsg('success'), 193 title: i18n.getMsg('success'),
66 autoScroll: true, 194 autoScroll: true,
67 msg: me.evalResponse(json), 195 msg: me.evalResponse(json),
68 buttons: Ext.Msg.OK 196 buttons: Ext.Msg.OK
190 var i18n = Lada.getApplication().bundle; 318 var i18n = Lada.getApplication().bundle;
191 var r = ''; 319 var r = '';
192 r += response.data.length; 320 r += response.data.length;
193 r += ' ' + i18n.getMsg('probecreated'); 321 r += ' ' + i18n.getMsg('probecreated');
194 r += '<br/>'; 322 r += '<br/>';
195 r += i18n.getMsg('probeids');
196 var i;
197 for (i in response.data){
198 r += '<br/>';
199 r += response.data[i].probeIdAlt
200 }
201 return r; 323 return r;
202 }, 324 },
203 325
204 /** 326 /**
205 * Reload the Application 327 * Reload the Application

http://lada.wald.intevation.org