changeset 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 cd809e56dff6
children 6739bfdb743e
files app/controller/FilterResult.js
diffstat 1 files changed, 12 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/FilterResult.js	Tue Sep 29 17:29:09 2015 +0200
+++ b/app/controller/FilterResult.js	Wed Sep 30 11:53:52 2015 +0200
@@ -219,28 +219,9 @@
     printSelection: function(button) {
         var grid = button.up('grid');
         var selection = grid.getView().getSelectionModel().getSelection();
+        console.log(selection);
         var i18n = Lada.getApplication().bundle;
         var me = this;
-        /*Example: {
-                    "layout": "A4 landscape",
-                    "outputFormat": "pdf",
-                    "attributes": {
-                        "title": "Auszug aus Lada",
-                        "datasource": [
-                        {
-                        "displayName": "Proben",
-                        "table" : {
-                            "columns": ["ProbeId", "MST", "Proben-Nr"],
-                            "data": [
-                            [1, "LiLiblah", "icon_pan"],
-                            [2, "LiLiblip", "icon_zoomin"]
-                            ]
-                        }
-                        }
-                    ]
-                    }
-                }; */
-
         var columns = [];
         var data = [];
         // Write the columns to an array
@@ -252,8 +233,10 @@
                 }
             }
         } catch (e) {
+            console.log(e);
         }
 
+
         // Retrieve Data from selection
         try {
             for (item in selection) {
@@ -262,12 +245,20 @@
                 //Lookup every column and write to data array.
                 for (key in columns){
                     var attr = columns[key];
-                    out.push(row[attr].toString());
+                    if (row[attr] != null) {
+                        out.push(row[attr].toString());
+                    }
+                    else {
+                        out.push('');
+                    }
                 }
                 data.push(out);
             }
         } catch (e){
+            console.log(e);
         }
+        console.log(columns);
+        console.log(data);
 
         var printData = {
             'layout': 'A4 landscape',

http://lada.wald.intevation.org