jquery - Export CSV using jqxgrid in Safari browser and iOS is not working -
in web application have option export "jqxgrid" data ".csv" format.
it working expected in chrome & firefox browsers. but, if, tried export option in 'safari' browser opening in tab, instead of download separate file.
is possible download separate file?
sample code:
$("#gridexport").click(function () { exportdata = []; var exporttype = getexportformat(); //csv (or) xls exportinfo = $("#jqxgrid").jqxgrid('exportdata', exporttype); exportinfo = replaceall(exportinfo, '<br/>', ' '); try { var prm = {}; prm.exportinfo = exportinfo; savemyfile("$('submitform')", "test" + "." + exporttype, exportinfo, "text/" + exporttype + ";charset=utf-8"); } catch (e) { console.log('export error: ' + e); } }); function savemyfile(ref, fname, text, mime) { try { var blob = new blob([text], { type: mime }); saveas(blob, fname); return false; } catch (e) { console.log('savemyfile: ' + e.message); } } function getexportformat() { var strplatform = navigator.platform; if (strplatform.tolowercase().indexof('ipad') > -1 || strplatform.tolowercase().indexof('iphone') > -1 || strplatform.tolowercase().indexof('mac') > -1) return "csv"; else return "xls"; }
Comments
Post a Comment