Below code works in chrome, but it getting syntax error in IE 11 because of expression =>
i used the => expression to filter data,
Any suggestions
Thanks
<SPAN class="keyword token">function</SPAN> <SPAN class="token function">customExportCSV</SPAN><SPAN class="punctuation token">(</SPAN>evt<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">var</SPAN> data <SPAN class="operator token">=</SPAN> propertylayer<SPAN class="punctuation token">.</SPAN>_graphicsVal<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> csv <SPAN class="operator token">=</SPAN> <SPAN class="token function">convertArrayOfObjectsToCSV</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN>
data<SPAN class="punctuation token">:</SPAN> data
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="operator token">!</SPAN>csv<SPAN class="punctuation token">.</SPAN><SPAN class="token function">match</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="regex token">/^data:text\/csv/i</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
csv <SPAN class="operator token">=</SPAN> <SPAN class="string token">'data:text/csv;charset=utf-8,'</SPAN> <SPAN class="operator token">+</SPAN> csv<SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="comment token">//var blob = new Blob([csv], { type: "text/csv" });</SPAN>
<SPAN class="comment token">//if (navigator.msSaveBlob) { // IE 10+</SPAN>
<SPAN class="comment token">// //var blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });</SPAN>
<SPAN class="comment token">// //navigator.msSaveBlob(blob, "Exportdata.csv");</SPAN>
<SPAN class="comment token">// navigator.msSaveBlob(blob, "csvname.csv")</SPAN>
<SPAN class="comment token">//}</SPAN>
<SPAN class="keyword token">var</SPAN> encodedUri <SPAN class="operator token">=</SPAN> <SPAN class="token function">encodeURI</SPAN><SPAN class="punctuation token">(</SPAN>csv<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> link <SPAN class="operator token">=</SPAN> document<SPAN class="punctuation token">.</SPAN><SPAN class="token function">createElement</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">'a'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
link<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setAttribute</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">'href'</SPAN><SPAN class="punctuation token">,</SPAN> encodedUri<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
link<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setAttribute</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">'download'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"Exportdata.csv"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
link<SPAN class="punctuation token">.</SPAN><SPAN class="token function">click</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">function</SPAN> <SPAN class="token function">convertArrayOfObjectsToCSV</SPAN><SPAN class="punctuation token">(</SPAN>value<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">var</SPAN> result<SPAN class="punctuation token">,</SPAN> ctr<SPAN class="punctuation token">,</SPAN> keys<SPAN class="punctuation token">,</SPAN> columnDelimiter<SPAN class="punctuation token">,</SPAN> lineDelimiter<SPAN class="punctuation token">,</SPAN> data<SPAN class="punctuation token">;</SPAN>
data <SPAN class="operator token">=</SPAN> Array<SPAN class="punctuation token">.</SPAN><SPAN class="keyword token">from</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Set</SPAN><SPAN class="punctuation token">(</SPAN>value<SPAN class="punctuation token">.</SPAN>data<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">filter</SPAN><SPAN class="punctuation token">(</SPAN>d <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> d<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">map</SPAN><SPAN class="punctuation token">(</SPAN>d <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> d<SPAN class="punctuation token">.</SPAN>attributes<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">||</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="operator token">!</SPAN>data <SPAN class="operator token">||</SPAN> <SPAN class="operator token">!</SPAN>data<SPAN class="punctuation token">.</SPAN>length<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
columnDelimiter <SPAN class="operator token">=</SPAN> value<SPAN class="punctuation token">.</SPAN>columnDelimiter <SPAN class="operator token">||</SPAN> <SPAN class="string token">','</SPAN><SPAN class="punctuation token">;</SPAN>
lineDelimiter <SPAN class="operator token">=</SPAN> value<SPAN class="punctuation token">.</SPAN>lineDelimiter <SPAN class="operator token">||</SPAN> <SPAN class="string token">'\n'</SPAN><SPAN class="punctuation token">;</SPAN>
keys <SPAN class="operator token">=</SPAN> Object<SPAN class="punctuation token">.</SPAN><SPAN class="token function">keys</SPAN><SPAN class="punctuation token">(</SPAN>data<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
result <SPAN class="operator token">=</SPAN> <SPAN class="string token">''</SPAN><SPAN class="punctuation token">;</SPAN>
result <SPAN class="operator token">+</SPAN><SPAN class="operator token">=</SPAN> keys<SPAN class="punctuation token">.</SPAN><SPAN class="token function">join</SPAN><SPAN class="punctuation token">(</SPAN>columnDelimiter<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
result <SPAN class="operator token">+</SPAN><SPAN class="operator token">=</SPAN> lineDelimiter<SPAN class="punctuation token">;</SPAN>
data<SPAN class="punctuation token">.</SPAN><SPAN class="token function">forEach</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">function</SPAN> <SPAN class="punctuation token">(</SPAN>item<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
ctr <SPAN class="operator token">=</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">;</SPAN>
keys<SPAN class="punctuation token">.</SPAN><SPAN class="token function">forEach</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">function</SPAN> <SPAN class="punctuation token">(</SPAN>key<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>ctr <SPAN class="operator token">></SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN>
result <SPAN class="operator token">+</SPAN><SPAN class="operator token">=</SPAN> columnDelimiter<SPAN class="punctuation token">;</SPAN>
result <SPAN class="operator token">+</SPAN><SPAN class="operator token">=</SPAN> item<SPAN class="punctuation token">[</SPAN>key<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">;</SPAN>
ctr<SPAN class="operator token">++</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
result <SPAN class="operator token">+</SPAN><SPAN class="operator token">=</SPAN> lineDelimiter<SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">return</SPAN> result<SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>