AnsweredAssumed Answered

Export grid data to CSV file

Question asked by natasha85 on Dec 14, 2016

Hi all!

I'm trying to export data from a grid / custom widget I create...but I still have problem with Internet Explorer...

This code works fine on Firefox and Chrome but in IE I get the error Access is denied.

How can I fix it?

Thanks, Naty

dojo.connect(dom.byId("myButton"), "onclick", function(evt){
   
   dijit.byId("myGrid").exportGrid("csv", function(str){
   var csvContent = "data:text/csv;charset=utf-8,";
  csvContent +=str;
  var encodedUri = encodeURI(csvContent);
      var link = document.createElement('a');
      link.download = "export.csv";
      link.href = encodedUri;
       document.body.appendChild(link);
      link.click();
      document.body.removeChild(link);
   });
});

Outcomes