Mercurial > lada > lada-client
comparison app/controller/FilterResult.js @ 936:e7270963947c
LadaPrint Fixes an Issue where empty cells could not be printed bc NULL has no toString method
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Wed, 30 Sep 2015 11:53:52 +0200 |
parents | 3e3e737050b7 |
children | 6739bfdb743e |
comparison
equal
deleted
inserted
replaced
935:cd809e56dff6 | 936:e7270963947c |
---|---|
217 * Send the selection to a Printservice | 217 * Send the selection to a Printservice |
218 */ | 218 */ |
219 printSelection: function(button) { | 219 printSelection: function(button) { |
220 var grid = button.up('grid'); | 220 var grid = button.up('grid'); |
221 var selection = grid.getView().getSelectionModel().getSelection(); | 221 var selection = grid.getView().getSelectionModel().getSelection(); |
222 console.log(selection); | |
222 var i18n = Lada.getApplication().bundle; | 223 var i18n = Lada.getApplication().bundle; |
223 var me = this; | 224 var me = this; |
224 /*Example: { | |
225 "layout": "A4 landscape", | |
226 "outputFormat": "pdf", | |
227 "attributes": { | |
228 "title": "Auszug aus Lada", | |
229 "datasource": [ | |
230 { | |
231 "displayName": "Proben", | |
232 "table" : { | |
233 "columns": ["ProbeId", "MST", "Proben-Nr"], | |
234 "data": [ | |
235 [1, "LiLiblah", "icon_pan"], | |
236 [2, "LiLiblip", "icon_zoomin"] | |
237 ] | |
238 } | |
239 } | |
240 ] | |
241 } | |
242 }; */ | |
243 | |
244 var columns = []; | 225 var columns = []; |
245 var data = []; | 226 var data = []; |
246 // Write the columns to an array | 227 // Write the columns to an array |
247 try { | 228 try { |
248 for (key in selection[0].data) { | 229 for (key in selection[0].data) { |
250 if (["owner", "readonly"].indexOf(key) == -1){ | 231 if (["owner", "readonly"].indexOf(key) == -1){ |
251 columns.push(key); | 232 columns.push(key); |
252 } | 233 } |
253 } | 234 } |
254 } catch (e) { | 235 } catch (e) { |
255 } | 236 console.log(e); |
237 } | |
238 | |
256 | 239 |
257 // Retrieve Data from selection | 240 // Retrieve Data from selection |
258 try { | 241 try { |
259 for (item in selection) { | 242 for (item in selection) { |
260 var row = selection[item].data; | 243 var row = selection[item].data; |
261 var out = []; | 244 var out = []; |
262 //Lookup every column and write to data array. | 245 //Lookup every column and write to data array. |
263 for (key in columns){ | 246 for (key in columns){ |
264 var attr = columns[key]; | 247 var attr = columns[key]; |
265 out.push(row[attr].toString()); | 248 if (row[attr] != null) { |
249 out.push(row[attr].toString()); | |
250 } | |
251 else { | |
252 out.push(''); | |
253 } | |
266 } | 254 } |
267 data.push(out); | 255 data.push(out); |
268 } | 256 } |
269 } catch (e){ | 257 } catch (e){ |
270 } | 258 console.log(e); |
259 } | |
260 console.log(columns); | |
261 console.log(data); | |
271 | 262 |
272 var printData = { | 263 var printData = { |
273 'layout': 'A4 landscape', | 264 'layout': 'A4 landscape', |
274 'outputFormat': 'pdf', | 265 'outputFormat': 'pdf', |
275 'attributes': { | 266 'attributes': { |