diff --git a/README.md b/README.md index 1c15737..b541f32 100755 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ Notice that by default, TableExport will create export buttons for three differe ```js /* Defaults */ $("table").tableExport({ - headings: true, // (Boolean), display table headings (th/td elements) in the > + headings: true, // (Boolean), display table headings (th/td elements) in the footers: true, // (Boolean), display table footers (th/td elements) in the formats: ["xls", "csv", "txt"], // (String[]), filetype(s) for the export fileName: "id", // (id, String), filename for the downloaded file diff --git a/dist/js/tableexport.js b/dist/js/tableexport.js index b221889..b2ed266 100755 --- a/dist/js/tableexport.js +++ b/dist/js/tableexport.js @@ -148,14 +148,14 @@ // Define the plugin default properties. $.fn.tableExport.defaults = { - headings: true, // (Boolean), display table headings (th or td elements) in the , (default: true) - footers: false, // (Boolean), display table footers (th or td elements) in the , (default: false) - formats: ["xls", "csv", "txt"], // (String[]), filetype(s) for the export, (default: ["xls", "csv", "txt"]) - fileName: "id", // (id, String), filename for the downloaded file, (default: "id") - bootstrap: true, // (Boolean), style buttons using bootstrap, (default: true) - position: "bottom", // (top, bottom), position of the caption element relative to table, (default: "bottom") - ignoreRows: null, // (Number, Number[]), row indices to exclude from the exported file (default: null) - ignoreCols: null // (Number, Number[]), column indices to exclude from the exported file (default: null) + headings: true, // (Boolean), display table headings (th or td elements) in the , (default: true) + footers: true, // (Boolean), display table footers (th or td elements) in the , (default: false) + formats: ["xls", "csv", "txt"], // (String[]), filetype(s) for the export, (default: ["xls", "csv", "txt"]) + fileName: "id", // (id, String), filename for the downloaded file, (default: "id") + bootstrap: true, // (Boolean), style buttons using bootstrap, (default: true) + position: "bottom", // (top, bottom), position of the caption element relative to table, (default: "bottom") + ignoreRows: null, // (Number, Number[]), row indices to exclude from the exported file (default: null) + ignoreCols: null // (Number, Number[]), column indices to exclude from the exported file (default: null) }; $.fn.tableExport.charset = "charset=utf-8"; diff --git a/dist/js/tableexport.min.js b/dist/js/tableexport.min.js index 9f14765..756aa8a 100755 --- a/dist/js/tableexport.min.js +++ b/dist/js/tableexport.min.js @@ -3,4 +3,4 @@ * Copyright 2015 Travis Clarke * Licensed under the MIT license */ -!function(t,e){function n(t){return String(t).replace(/[&<>'\/]/g,function(t){return l.fn.tableExport.entityMap[t]})}function o(t,e){e&&(t+=1462);var n=Date.parse(t);return(n-new Date(Date.UTC(1899,11,30)))/864e5}function a(t,e){for(var n={},a={s:{c:1e7,r:1e7},e:{c:0,r:0}},r=0;r!=t.length;++r)for(var i=0;i!=t[r].length;++i){a.s.r>r&&(a.s.r=r),a.s.c>i&&(a.s.c=i),a.e.r'+t+"")}function f(n,a,r){var i="";t(i)}var p=l(this),u=p.find("tbody").find("tr"),u=r.headings?u.add(p.find("thead>tr")):u,u=r.footers?u.add(p.find("tfoor>tr")):u,b=r.headings?p.find("thead>tr").length:0,d="id"===r.fileName?p.attr("id")?p.attr("id"):l.fn.tableExport.defaultFileName:r.fileName,c={xlsx:function(t,e){var o=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return[n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get()]}}).get(),a=n(JSON.stringify({data:o,fileName:e,mimeType:l.fn.tableExport.xlsx.mimeType,fileExtension:l.fn.tableExport.xlsx.fileExtension})),r=l.fn.tableExport.xlsx.buttonContent,i=l.fn.tableExport.xlsx.defaultClass;f(a,r,i)},xls:function(t,e){var o=l.fn.tableExport.xls.separator,a=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get().join(o)}}).get().join(t),r=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.xls.mimeType,fileExtension:l.fn.tableExport.xls.fileExtension})),i=l.fn.tableExport.xls.buttonContent,p=l.fn.tableExport.xls.defaultClass;f(r,i,p)},csv:function(t,e){var o=l.fn.tableExport.csv.separator,a=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get().join(o)}}).get().join(t),r=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.csv.mimeType,fileExtension:l.fn.tableExport.csv.fileExtension})),i=l.fn.tableExport.csv.buttonContent,p=l.fn.tableExport.csv.defaultClass;f(r,i,p)},txt:function(t,e){var o=l.fn.tableExport.txt.separator,a=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get().join(o)}}).get().join(t),r=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.txt.mimeType,fileExtension:l.fn.tableExport.txt.fileExtension})),i=l.fn.tableExport.txt.buttonContent,p=l.fn.tableExport.txt.defaultClass;f(r,i,p)}};r.formats.forEach(function(t){c[t](i,d)})}),l("button[data-fileblob]").on("click",function(){var t=l(this).data("fileblob"),e=t.data,n=t.fileName,o=t.mimeType,a=t.fileExtension;f(e,o,n,a)})},l.fn.tableExport.defaults={headings:!0,footers:!1,formats:["xls","csv","txt"],fileName:"id",bootstrap:!0,position:"bottom",ignoreRows:null,ignoreCols:null},l.fn.tableExport.charset="charset=utf-8",l.fn.tableExport.xlsx={defaultClass:"xlsx",buttonContent:"Export to xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileExtension:".xlsx"},l.fn.tableExport.xls={defaultClass:"xls",buttonContent:"Export to xls",separator:" ",mimeType:"application/vnd.ms-excel",fileExtension:".xls"},l.fn.tableExport.csv={defaultClass:"csv",buttonContent:"Export to csv",separator:",",mimeType:"application/csv",fileExtension:".csv"},l.fn.tableExport.txt={defaultClass:"txt",buttonContent:"Export to txt",separator:" ",mimeType:"text/plain",fileExtension:".txt"},l.fn.tableExport.defaultFileName="myDownload",l.fn.tableExport.defaultButton="button-default",l.fn.tableExport.bootstrap=["btn","btn-default","btn-toolbar"],l.fn.tableExport.rowDel="\r\n",l.fn.tableExport.entityMap={"&":"&","<":"<",">":">","'":"'","/":"/"}}(window); \ No newline at end of file +!function(t,e){function n(t){return String(t).replace(/[&<>'\/]/g,function(t){return l.fn.tableExport.entityMap[t]})}function o(t,e){e&&(t+=1462);var n=Date.parse(t);return(n-new Date(Date.UTC(1899,11,30)))/864e5}function a(t,e){for(var n={},a={s:{c:1e7,r:1e7},e:{c:0,r:0}},r=0;r!=t.length;++r)for(var i=0;i!=t[r].length;++i){a.s.r>r&&(a.s.r=r),a.s.c>i&&(a.s.c=i),a.e.r'+t+"")}function f(n,a,r){var i="";t(i)}var p=l(this),u=p.find("tbody").find("tr"),u=r.headings?u.add(p.find("thead>tr")):u,u=r.footers?u.add(p.find("tfoor>tr")):u,b=r.headings?p.find("thead>tr").length:0,d="id"===r.fileName?p.attr("id")?p.attr("id"):l.fn.tableExport.defaultFileName:r.fileName,c={xlsx:function(t,e){var o=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return[n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get()]}}).get(),a=n(JSON.stringify({data:o,fileName:e,mimeType:l.fn.tableExport.xlsx.mimeType,fileExtension:l.fn.tableExport.xlsx.fileExtension})),r=l.fn.tableExport.xlsx.buttonContent,i=l.fn.tableExport.xlsx.defaultClass;f(a,r,i)},xls:function(t,e){var o=l.fn.tableExport.xls.separator,a=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get().join(o)}}).get().join(t),r=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.xls.mimeType,fileExtension:l.fn.tableExport.xls.fileExtension})),i=l.fn.tableExport.xls.buttonContent,p=l.fn.tableExport.xls.defaultClass;f(r,i,p)},csv:function(t,e){var o=l.fn.tableExport.csv.separator,a=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get().join(o)}}).get().join(t),r=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.csv.mimeType,fileExtension:l.fn.tableExport.csv.fileExtension})),i=l.fn.tableExport.csv.buttonContent,p=l.fn.tableExport.csv.defaultClass;f(r,i,p)},txt:function(t,e){var o=l.fn.tableExport.txt.separator,a=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get().join(o)}}).get().join(t),r=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.txt.mimeType,fileExtension:l.fn.tableExport.txt.fileExtension})),i=l.fn.tableExport.txt.buttonContent,p=l.fn.tableExport.txt.defaultClass;f(r,i,p)}};r.formats.forEach(function(t){c[t](i,d)})}),l("button[data-fileblob]").on("click",function(){var t=l(this).data("fileblob"),e=t.data,n=t.fileName,o=t.mimeType,a=t.fileExtension;f(e,o,n,a)})},l.fn.tableExport.defaults={headings:!0,footers:!0,formats:["xls","csv","txt"],fileName:"id",bootstrap:!0,position:"bottom",ignoreRows:null,ignoreCols:null},l.fn.tableExport.charset="charset=utf-8",l.fn.tableExport.xlsx={defaultClass:"xlsx",buttonContent:"Export to xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileExtension:".xlsx"},l.fn.tableExport.xls={defaultClass:"xls",buttonContent:"Export to xls",separator:" ",mimeType:"application/vnd.ms-excel",fileExtension:".xls"},l.fn.tableExport.csv={defaultClass:"csv",buttonContent:"Export to csv",separator:",",mimeType:"application/csv",fileExtension:".csv"},l.fn.tableExport.txt={defaultClass:"txt",buttonContent:"Export to txt",separator:" ",mimeType:"text/plain",fileExtension:".txt"},l.fn.tableExport.defaultFileName="myDownload",l.fn.tableExport.defaultButton="button-default",l.fn.tableExport.bootstrap=["btn","btn-default","btn-toolbar"],l.fn.tableExport.rowDel="\r\n",l.fn.tableExport.entityMap={"&":"&","<":"<",">":">","'":"'","/":"/"}}(window); \ No newline at end of file diff --git a/src/stable/js/tableexport.js b/src/stable/js/tableexport.js index b221889..b2ed266 100755 --- a/src/stable/js/tableexport.js +++ b/src/stable/js/tableexport.js @@ -148,14 +148,14 @@ // Define the plugin default properties. $.fn.tableExport.defaults = { - headings: true, // (Boolean), display table headings (th or td elements) in the , (default: true) - footers: false, // (Boolean), display table footers (th or td elements) in the , (default: false) - formats: ["xls", "csv", "txt"], // (String[]), filetype(s) for the export, (default: ["xls", "csv", "txt"]) - fileName: "id", // (id, String), filename for the downloaded file, (default: "id") - bootstrap: true, // (Boolean), style buttons using bootstrap, (default: true) - position: "bottom", // (top, bottom), position of the caption element relative to table, (default: "bottom") - ignoreRows: null, // (Number, Number[]), row indices to exclude from the exported file (default: null) - ignoreCols: null // (Number, Number[]), column indices to exclude from the exported file (default: null) + headings: true, // (Boolean), display table headings (th or td elements) in the , (default: true) + footers: true, // (Boolean), display table footers (th or td elements) in the , (default: false) + formats: ["xls", "csv", "txt"], // (String[]), filetype(s) for the export, (default: ["xls", "csv", "txt"]) + fileName: "id", // (id, String), filename for the downloaded file, (default: "id") + bootstrap: true, // (Boolean), style buttons using bootstrap, (default: true) + position: "bottom", // (top, bottom), position of the caption element relative to table, (default: "bottom") + ignoreRows: null, // (Number, Number[]), row indices to exclude from the exported file (default: null) + ignoreCols: null // (Number, Number[]), column indices to exclude from the exported file (default: null) }; $.fn.tableExport.charset = "charset=utf-8"; diff --git a/src/stable/js/tableexport.min.js b/src/stable/js/tableexport.min.js index 9f14765..756aa8a 100755 --- a/src/stable/js/tableexport.min.js +++ b/src/stable/js/tableexport.min.js @@ -3,4 +3,4 @@ * Copyright 2015 Travis Clarke * Licensed under the MIT license */ -!function(t,e){function n(t){return String(t).replace(/[&<>'\/]/g,function(t){return l.fn.tableExport.entityMap[t]})}function o(t,e){e&&(t+=1462);var n=Date.parse(t);return(n-new Date(Date.UTC(1899,11,30)))/864e5}function a(t,e){for(var n={},a={s:{c:1e7,r:1e7},e:{c:0,r:0}},r=0;r!=t.length;++r)for(var i=0;i!=t[r].length;++i){a.s.r>r&&(a.s.r=r),a.s.c>i&&(a.s.c=i),a.e.r'+t+"")}function f(n,a,r){var i="";t(i)}var p=l(this),u=p.find("tbody").find("tr"),u=r.headings?u.add(p.find("thead>tr")):u,u=r.footers?u.add(p.find("tfoor>tr")):u,b=r.headings?p.find("thead>tr").length:0,d="id"===r.fileName?p.attr("id")?p.attr("id"):l.fn.tableExport.defaultFileName:r.fileName,c={xlsx:function(t,e){var o=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return[n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get()]}}).get(),a=n(JSON.stringify({data:o,fileName:e,mimeType:l.fn.tableExport.xlsx.mimeType,fileExtension:l.fn.tableExport.xlsx.fileExtension})),r=l.fn.tableExport.xlsx.buttonContent,i=l.fn.tableExport.xlsx.defaultClass;f(a,r,i)},xls:function(t,e){var o=l.fn.tableExport.xls.separator,a=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get().join(o)}}).get().join(t),r=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.xls.mimeType,fileExtension:l.fn.tableExport.xls.fileExtension})),i=l.fn.tableExport.xls.buttonContent,p=l.fn.tableExport.xls.defaultClass;f(r,i,p)},csv:function(t,e){var o=l.fn.tableExport.csv.separator,a=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get().join(o)}}).get().join(t),r=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.csv.mimeType,fileExtension:l.fn.tableExport.csv.fileExtension})),i=l.fn.tableExport.csv.buttonContent,p=l.fn.tableExport.csv.defaultClass;f(r,i,p)},txt:function(t,e){var o=l.fn.tableExport.txt.separator,a=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get().join(o)}}).get().join(t),r=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.txt.mimeType,fileExtension:l.fn.tableExport.txt.fileExtension})),i=l.fn.tableExport.txt.buttonContent,p=l.fn.tableExport.txt.defaultClass;f(r,i,p)}};r.formats.forEach(function(t){c[t](i,d)})}),l("button[data-fileblob]").on("click",function(){var t=l(this).data("fileblob"),e=t.data,n=t.fileName,o=t.mimeType,a=t.fileExtension;f(e,o,n,a)})},l.fn.tableExport.defaults={headings:!0,footers:!1,formats:["xls","csv","txt"],fileName:"id",bootstrap:!0,position:"bottom",ignoreRows:null,ignoreCols:null},l.fn.tableExport.charset="charset=utf-8",l.fn.tableExport.xlsx={defaultClass:"xlsx",buttonContent:"Export to xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileExtension:".xlsx"},l.fn.tableExport.xls={defaultClass:"xls",buttonContent:"Export to xls",separator:" ",mimeType:"application/vnd.ms-excel",fileExtension:".xls"},l.fn.tableExport.csv={defaultClass:"csv",buttonContent:"Export to csv",separator:",",mimeType:"application/csv",fileExtension:".csv"},l.fn.tableExport.txt={defaultClass:"txt",buttonContent:"Export to txt",separator:" ",mimeType:"text/plain",fileExtension:".txt"},l.fn.tableExport.defaultFileName="myDownload",l.fn.tableExport.defaultButton="button-default",l.fn.tableExport.bootstrap=["btn","btn-default","btn-toolbar"],l.fn.tableExport.rowDel="\r\n",l.fn.tableExport.entityMap={"&":"&","<":"<",">":">","'":"'","/":"/"}}(window); \ No newline at end of file +!function(t,e){function n(t){return String(t).replace(/[&<>'\/]/g,function(t){return l.fn.tableExport.entityMap[t]})}function o(t,e){e&&(t+=1462);var n=Date.parse(t);return(n-new Date(Date.UTC(1899,11,30)))/864e5}function a(t,e){for(var n={},a={s:{c:1e7,r:1e7},e:{c:0,r:0}},r=0;r!=t.length;++r)for(var i=0;i!=t[r].length;++i){a.s.r>r&&(a.s.r=r),a.s.c>i&&(a.s.c=i),a.e.r'+t+"")}function f(n,a,r){var i="";t(i)}var p=l(this),u=p.find("tbody").find("tr"),u=r.headings?u.add(p.find("thead>tr")):u,u=r.footers?u.add(p.find("tfoor>tr")):u,b=r.headings?p.find("thead>tr").length:0,d="id"===r.fileName?p.attr("id")?p.attr("id"):l.fn.tableExport.defaultFileName:r.fileName,c={xlsx:function(t,e){var o=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return[n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get()]}}).get(),a=n(JSON.stringify({data:o,fileName:e,mimeType:l.fn.tableExport.xlsx.mimeType,fileExtension:l.fn.tableExport.xlsx.fileExtension})),r=l.fn.tableExport.xlsx.buttonContent,i=l.fn.tableExport.xlsx.defaultClass;f(a,r,i)},xls:function(t,e){var o=l.fn.tableExport.xls.separator,a=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get().join(o)}}).get().join(t),r=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.xls.mimeType,fileExtension:l.fn.tableExport.xls.fileExtension})),i=l.fn.tableExport.xls.buttonContent,p=l.fn.tableExport.xls.defaultClass;f(r,i,p)},csv:function(t,e){var o=l.fn.tableExport.csv.separator,a=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get().join(o)}}).get().join(t),r=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.csv.mimeType,fileExtension:l.fn.tableExport.csv.fileExtension})),i=l.fn.tableExport.csv.buttonContent,p=l.fn.tableExport.csv.defaultClass;f(r,i,p)},txt:function(t,e){var o=l.fn.tableExport.txt.separator,a=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get().join(o)}}).get().join(t),r=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.txt.mimeType,fileExtension:l.fn.tableExport.txt.fileExtension})),i=l.fn.tableExport.txt.buttonContent,p=l.fn.tableExport.txt.defaultClass;f(r,i,p)}};r.formats.forEach(function(t){c[t](i,d)})}),l("button[data-fileblob]").on("click",function(){var t=l(this).data("fileblob"),e=t.data,n=t.fileName,o=t.mimeType,a=t.fileExtension;f(e,o,n,a)})},l.fn.tableExport.defaults={headings:!0,footers:!0,formats:["xls","csv","txt"],fileName:"id",bootstrap:!0,position:"bottom",ignoreRows:null,ignoreCols:null},l.fn.tableExport.charset="charset=utf-8",l.fn.tableExport.xlsx={defaultClass:"xlsx",buttonContent:"Export to xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileExtension:".xlsx"},l.fn.tableExport.xls={defaultClass:"xls",buttonContent:"Export to xls",separator:" ",mimeType:"application/vnd.ms-excel",fileExtension:".xls"},l.fn.tableExport.csv={defaultClass:"csv",buttonContent:"Export to csv",separator:",",mimeType:"application/csv",fileExtension:".csv"},l.fn.tableExport.txt={defaultClass:"txt",buttonContent:"Export to txt",separator:" ",mimeType:"text/plain",fileExtension:".txt"},l.fn.tableExport.defaultFileName="myDownload",l.fn.tableExport.defaultButton="button-default",l.fn.tableExport.bootstrap=["btn","btn-default","btn-toolbar"],l.fn.tableExport.rowDel="\r\n",l.fn.tableExport.entityMap={"&":"&","<":"<",">":">","'":"'","/":"/"}}(window); \ No newline at end of file diff --git a/src/v3/tableexport-3.2.js b/src/v3/tableexport-3.2.js index b221889..b2ed266 100755 --- a/src/v3/tableexport-3.2.js +++ b/src/v3/tableexport-3.2.js @@ -148,14 +148,14 @@ // Define the plugin default properties. $.fn.tableExport.defaults = { - headings: true, // (Boolean), display table headings (th or td elements) in the , (default: true) - footers: false, // (Boolean), display table footers (th or td elements) in the , (default: false) - formats: ["xls", "csv", "txt"], // (String[]), filetype(s) for the export, (default: ["xls", "csv", "txt"]) - fileName: "id", // (id, String), filename for the downloaded file, (default: "id") - bootstrap: true, // (Boolean), style buttons using bootstrap, (default: true) - position: "bottom", // (top, bottom), position of the caption element relative to table, (default: "bottom") - ignoreRows: null, // (Number, Number[]), row indices to exclude from the exported file (default: null) - ignoreCols: null // (Number, Number[]), column indices to exclude from the exported file (default: null) + headings: true, // (Boolean), display table headings (th or td elements) in the , (default: true) + footers: true, // (Boolean), display table footers (th or td elements) in the , (default: false) + formats: ["xls", "csv", "txt"], // (String[]), filetype(s) for the export, (default: ["xls", "csv", "txt"]) + fileName: "id", // (id, String), filename for the downloaded file, (default: "id") + bootstrap: true, // (Boolean), style buttons using bootstrap, (default: true) + position: "bottom", // (top, bottom), position of the caption element relative to table, (default: "bottom") + ignoreRows: null, // (Number, Number[]), row indices to exclude from the exported file (default: null) + ignoreCols: null // (Number, Number[]), column indices to exclude from the exported file (default: null) }; $.fn.tableExport.charset = "charset=utf-8"; diff --git a/src/v3/tableexport-3.2.min.js b/src/v3/tableexport-3.2.min.js index 9f14765..756aa8a 100755 --- a/src/v3/tableexport-3.2.min.js +++ b/src/v3/tableexport-3.2.min.js @@ -3,4 +3,4 @@ * Copyright 2015 Travis Clarke * Licensed under the MIT license */ -!function(t,e){function n(t){return String(t).replace(/[&<>'\/]/g,function(t){return l.fn.tableExport.entityMap[t]})}function o(t,e){e&&(t+=1462);var n=Date.parse(t);return(n-new Date(Date.UTC(1899,11,30)))/864e5}function a(t,e){for(var n={},a={s:{c:1e7,r:1e7},e:{c:0,r:0}},r=0;r!=t.length;++r)for(var i=0;i!=t[r].length;++i){a.s.r>r&&(a.s.r=r),a.s.c>i&&(a.s.c=i),a.e.r'+t+"")}function f(n,a,r){var i="";t(i)}var p=l(this),u=p.find("tbody").find("tr"),u=r.headings?u.add(p.find("thead>tr")):u,u=r.footers?u.add(p.find("tfoor>tr")):u,b=r.headings?p.find("thead>tr").length:0,d="id"===r.fileName?p.attr("id")?p.attr("id"):l.fn.tableExport.defaultFileName:r.fileName,c={xlsx:function(t,e){var o=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return[n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get()]}}).get(),a=n(JSON.stringify({data:o,fileName:e,mimeType:l.fn.tableExport.xlsx.mimeType,fileExtension:l.fn.tableExport.xlsx.fileExtension})),r=l.fn.tableExport.xlsx.buttonContent,i=l.fn.tableExport.xlsx.defaultClass;f(a,r,i)},xls:function(t,e){var o=l.fn.tableExport.xls.separator,a=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get().join(o)}}).get().join(t),r=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.xls.mimeType,fileExtension:l.fn.tableExport.xls.fileExtension})),i=l.fn.tableExport.xls.buttonContent,p=l.fn.tableExport.xls.defaultClass;f(r,i,p)},csv:function(t,e){var o=l.fn.tableExport.csv.separator,a=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get().join(o)}}).get().join(t),r=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.csv.mimeType,fileExtension:l.fn.tableExport.csv.fileExtension})),i=l.fn.tableExport.csv.buttonContent,p=l.fn.tableExport.csv.defaultClass;f(r,i,p)},txt:function(t,e){var o=l.fn.tableExport.txt.separator,a=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get().join(o)}}).get().join(t),r=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.txt.mimeType,fileExtension:l.fn.tableExport.txt.fileExtension})),i=l.fn.tableExport.txt.buttonContent,p=l.fn.tableExport.txt.defaultClass;f(r,i,p)}};r.formats.forEach(function(t){c[t](i,d)})}),l("button[data-fileblob]").on("click",function(){var t=l(this).data("fileblob"),e=t.data,n=t.fileName,o=t.mimeType,a=t.fileExtension;f(e,o,n,a)})},l.fn.tableExport.defaults={headings:!0,footers:!1,formats:["xls","csv","txt"],fileName:"id",bootstrap:!0,position:"bottom",ignoreRows:null,ignoreCols:null},l.fn.tableExport.charset="charset=utf-8",l.fn.tableExport.xlsx={defaultClass:"xlsx",buttonContent:"Export to xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileExtension:".xlsx"},l.fn.tableExport.xls={defaultClass:"xls",buttonContent:"Export to xls",separator:" ",mimeType:"application/vnd.ms-excel",fileExtension:".xls"},l.fn.tableExport.csv={defaultClass:"csv",buttonContent:"Export to csv",separator:",",mimeType:"application/csv",fileExtension:".csv"},l.fn.tableExport.txt={defaultClass:"txt",buttonContent:"Export to txt",separator:" ",mimeType:"text/plain",fileExtension:".txt"},l.fn.tableExport.defaultFileName="myDownload",l.fn.tableExport.defaultButton="button-default",l.fn.tableExport.bootstrap=["btn","btn-default","btn-toolbar"],l.fn.tableExport.rowDel="\r\n",l.fn.tableExport.entityMap={"&":"&","<":"<",">":">","'":"'","/":"/"}}(window); \ No newline at end of file +!function(t,e){function n(t){return String(t).replace(/[&<>'\/]/g,function(t){return l.fn.tableExport.entityMap[t]})}function o(t,e){e&&(t+=1462);var n=Date.parse(t);return(n-new Date(Date.UTC(1899,11,30)))/864e5}function a(t,e){for(var n={},a={s:{c:1e7,r:1e7},e:{c:0,r:0}},r=0;r!=t.length;++r)for(var i=0;i!=t[r].length;++i){a.s.r>r&&(a.s.r=r),a.s.c>i&&(a.s.c=i),a.e.r'+t+"")}function f(n,a,r){var i="";t(i)}var p=l(this),u=p.find("tbody").find("tr"),u=r.headings?u.add(p.find("thead>tr")):u,u=r.footers?u.add(p.find("tfoor>tr")):u,b=r.headings?p.find("thead>tr").length:0,d="id"===r.fileName?p.attr("id")?p.attr("id"):l.fn.tableExport.defaultFileName:r.fileName,c={xlsx:function(t,e){var o=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return[n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get()]}}).get(),a=n(JSON.stringify({data:o,fileName:e,mimeType:l.fn.tableExport.xlsx.mimeType,fileExtension:l.fn.tableExport.xlsx.fileExtension})),r=l.fn.tableExport.xlsx.buttonContent,i=l.fn.tableExport.xlsx.defaultClass;f(a,r,i)},xls:function(t,e){var o=l.fn.tableExport.xls.separator,a=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get().join(o)}}).get().join(t),r=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.xls.mimeType,fileExtension:l.fn.tableExport.xls.fileExtension})),i=l.fn.tableExport.xls.buttonContent,p=l.fn.tableExport.xls.defaultClass;f(r,i,p)},csv:function(t,e){var o=l.fn.tableExport.csv.separator,a=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get().join(o)}}).get().join(t),r=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.csv.mimeType,fileExtension:l.fn.tableExport.csv.fileExtension})),i=l.fn.tableExport.csv.buttonContent,p=l.fn.tableExport.csv.defaultClass;f(r,i,p)},txt:function(t,e){var o=l.fn.tableExport.txt.separator,a=u.map(function(t,e){if(!~s.indexOf(t-b)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)?void 0:l(e).text()}).get().join(o)}}).get().join(t),r=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.txt.mimeType,fileExtension:l.fn.tableExport.txt.fileExtension})),i=l.fn.tableExport.txt.buttonContent,p=l.fn.tableExport.txt.defaultClass;f(r,i,p)}};r.formats.forEach(function(t){c[t](i,d)})}),l("button[data-fileblob]").on("click",function(){var t=l(this).data("fileblob"),e=t.data,n=t.fileName,o=t.mimeType,a=t.fileExtension;f(e,o,n,a)})},l.fn.tableExport.defaults={headings:!0,footers:!0,formats:["xls","csv","txt"],fileName:"id",bootstrap:!0,position:"bottom",ignoreRows:null,ignoreCols:null},l.fn.tableExport.charset="charset=utf-8",l.fn.tableExport.xlsx={defaultClass:"xlsx",buttonContent:"Export to xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileExtension:".xlsx"},l.fn.tableExport.xls={defaultClass:"xls",buttonContent:"Export to xls",separator:" ",mimeType:"application/vnd.ms-excel",fileExtension:".xls"},l.fn.tableExport.csv={defaultClass:"csv",buttonContent:"Export to csv",separator:",",mimeType:"application/csv",fileExtension:".csv"},l.fn.tableExport.txt={defaultClass:"txt",buttonContent:"Export to txt",separator:" ",mimeType:"text/plain",fileExtension:".txt"},l.fn.tableExport.defaultFileName="myDownload",l.fn.tableExport.defaultButton="button-default",l.fn.tableExport.bootstrap=["btn","btn-default","btn-toolbar"],l.fn.tableExport.rowDel="\r\n",l.fn.tableExport.entityMap={"&":"&","<":"<",">":">","'":"'","/":"/"}}(window); \ No newline at end of file