[chronojump-server] Enabling export in Firefox



commit 6b6f04a183409dae6ee88ff2eed0c8f0fbfc3e03
Author: Marcos Venteo <mventeo gmail com>
Date:   Mon Oct 16 17:58:23 2017 +0200

    Enabling export in Firefox

 chronojumpserver/templates/results.html |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/chronojumpserver/templates/results.html b/chronojumpserver/templates/results.html
index 4873225..0167f2b 100755
--- a/chronojumpserver/templates/results.html
+++ b/chronojumpserver/templates/results.html
@@ -53,6 +53,7 @@
 <div class="row" style="margin-top:20px">
        <table id="results" class="table table-hovered" cellspacing="0" width="100%">
        </table>
+       <div id="hiddenContainer" style="display:none"/>
 </div>
 
 
@@ -248,8 +249,8 @@ $(document).ready(function() {
        ],
        "dom": "<'row'<'resultsFilter'>><'row'<'col-sm-6'B><'col-sm-6'f>>rtip",
        buttons: [
-                       { extend: "csv", text: "Exportar resultats", className: "btn btn-primary",
-                               action: function( e, dt, button, config ) {
+                       { text: "Exportar resultats", className: "btn btn-primary",
+                               action: function( e, dt, node, config ) {
                                        var columns = ["Data", "Jugador", "EstaciĆ³", "Exercici",
                                                "RL", "Carrega", "n", "Perdua", "Rep", "Rang", "Vm", "VM", 
"Pm", "PM"];
 
@@ -290,23 +291,25 @@ $(document).ready(function() {
                                                var csvData = 'data:text/csv;charset=utf-8,' + "\uFEFF" + 
encodeURI(csv);
                                                // For IE (tested 10+)
                                                //console.log(filename);
-                                               //console.log(csv);
+                                               console.log(csv);
             if (window.navigator.msSaveOrOpenBlob) {
-                var blob = new Blob([decodeURIComponent(encodeURI(csv))], {
+                                                               var blob = new 
Blob([decodeURIComponent(encodeURI(csv))], {
                     type: "text/csv;charset=utf-8;"
                 });
                 navigator.msSaveBlob(blob, filename);
                                                                alert();
             } else {
-                                                       var link=document.createElement('a');
-                $(link)
+                                                         var link=document.createElement('a');
+                /*$(link)
                     .attr({
                         'download': filename
                         ,'href': csvData
                         //,'target' : '_blank' //if you want it to open in a new window
-                });
+                });*/
+                                                               link.href= csvData;
+                                                               link.download=filename;
+                                                               
document.getElementById('hiddenContainer').appendChild(link);
                                                                link.click();
-                                                               //alert(filename);
             }
                                                return csv;
             }},


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]