Экспорт вывода в файл CSV в IE 11 - PullRequest
0 голосов
/ 11 марта 2019
var perrow = 1, // 1 item per row
    html = "<table><tr>";

     // Loop through array and add table cells
    for (var i=0; i<uniqueData.length; i++) {
      html += "<td>" + uniqueData[i] + "</td>";
     // Break into next row
    var next = i+1;
    if (next%perrow==0 && next!=uniqueData.length) {
     html += "</tr><tr>";
     }
    }
    html += "</tr></table>";

    // ATTACH HTML TO CONTAINER
    document.getElementById("output").innerHTML = html;
}

    // when "export" button is clicked
    $("#export").click(function () {         
       var htmltable= document.getElementById("output");
       var html2 = htmltable.outerHTML;
       window.open('data:application/vnd.ms-excel,' + encodeURIComponent(html2));
    })

Как я могу экспортировать "выходные данные" (то есть мою таблицу) в виде файла CSV?То, что у меня есть выше, не работает на IE11.

...