[Lada-commits] [PATCH 2 of 2] Added action in controller to download the file in a new window

Wald Commits scm-commit at wald.intevation.org
Tue Aug 27 10:41:45 CEST 2013


# HG changeset patch
# User Torsten Irländer <torsten.irlaender at intevation.de>
# Date 1377592814 -7200
# Node ID 9bc080ecdbc9d82998c1c2002c844f1c71156feb
# Parent  eb79d9bf3929b63bc043bdbac0687f25fd3d4f99
Added action in controller to download the file in a new window.

diff -r eb79d9bf3929 -r 9bc080ecdbc9 app/controller/Proben.js
--- a/app/controller/Proben.js	Tue Aug 27 10:14:30 2013 +0200
+++ b/app/controller/Proben.js	Tue Aug 27 10:40:14 2013 +0200
@@ -68,6 +68,9 @@
             'probenlist toolbar button[action=import]': {
                 click: this.selectUploadFile
             },
+            'probenlist toolbar button[action=export]': {
+                click: this.downloadFile
+            },
             'probencreate button[action=save]': {
                 click: this.saveItem
             },
@@ -128,6 +131,15 @@
             });
         }
     },
+    /**
+     * Will download the selected Probe in LAF format in a new window (tab).
+     */
+    downloadFile: function(button) {
+        var grid = button.up('grid');
+        var selection = grid.getView().getSelectionModel().getSelection()[0];
+        var url = "server/rest/export/laf/" + selection.get('probeId');
+        window.open(url, "_blank");
+    },
     editItem: function(grid, record) {
         console.log('Editing Probe');
         var id = record.get('probeId');
diff -r eb79d9bf3929 -r 9bc080ecdbc9 gfx/document-save-as-6.png
Binary file gfx/document-save-as-6.png has changed


More information about the Lada-commits mailing list