[Lada-commits] [PATCH] LadaPrint Fixes an Issue where empty cells could not be printed bc NULL has no toString method

Wald Commits scm-commit at wald.intevation.org
Wed Sep 30 11:54:03 CEST 2015


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1443606832 -7200
# Node ID e7270963947cfc44abb348277d41fb28fea735fa
# Parent  cd809e56dff685a84aebbb5ffae4d4cc38d9869c
LadaPrint Fixes an Issue where empty cells could not be printed bc NULL has no toString method

diff -r cd809e56dff6 -r e7270963947c app/controller/FilterResult.js
--- 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',


More information about the Lada-commits mailing list