|
1 | 1 | /*! |
2 | | - * TableExport.js v3.2.0 (http://www.clarketravis.com) |
| 2 | + * TableExport.js v3.2.1 (http://www.clarketravis.com) |
3 | 3 | * Copyright 2015 Travis Clarke |
4 | 4 | * Licensed under the MIT license |
5 | 5 | */ |
|
15 | 15 | rowD = $.fn.tableExport.rowDel, |
16 | 16 | ignoreRows = settings.ignoreRows instanceof Array ? settings.ignoreRows : [settings.ignoreRows], |
17 | 17 | ignoreCols = settings.ignoreCols instanceof Array ? settings.ignoreCols : [settings.ignoreCols], |
| 18 | + ignoreCSS = settings.ignoreCSS instanceof Array ? settings.ignoreCSS.join(", ") : settings.ignoreCSS, |
18 | 19 | bootstrapClass, bootstrapTheme, bootstrapSpacing; |
19 | 20 |
|
20 | 21 | if (settings.bootstrap) { |
|
36 | 37 | exporters = { |
37 | 38 | xlsx: function (rDel, name) { |
38 | 39 | var dataURL = $rows.map(function (i, val) { |
39 | | - if (!!~ignoreRows.indexOf(i-thAdj)) { return;} |
| 40 | + if (!!~ignoreRows.indexOf(i-thAdj) || $(val).is(ignoreCSS)) { return;} |
40 | 41 | var $cols = $(val).find('th, td'); |
41 | 42 | return [$cols.map(function (i, val) { |
42 | | - if (!!~ignoreCols.indexOf(i)) { return;} |
| 43 | + if (!!~ignoreCols.indexOf(i) || $(val).is(ignoreCSS)) { return;} |
| 44 | + console.log($(val).is(ignoreCSS)); |
43 | 45 | return $(val).text(); |
44 | 46 | }).get()]; |
45 | 47 | }).get(), |
|
57 | 59 | xls: function (rdel, name) { |
58 | 60 | var colD = $.fn.tableExport.xls.separator, |
59 | 61 | dataURL = $rows.map(function (i, val) { |
60 | | - if (!!~ignoreRows.indexOf(i-thAdj)) { return;} |
| 62 | + if (!!~ignoreRows.indexOf(i-thAdj) || $(val).is(ignoreCSS)) { return;} |
61 | 63 | var $cols = $(val).find('th, td'); |
62 | 64 | return $cols.map(function (i, val) { |
63 | | - if (!!~ignoreCols.indexOf(i)) { return;} |
| 65 | + if (!!~ignoreCols.indexOf(i) || $(val).is(ignoreCSS)) { return;} |
64 | 66 | return $(val).text(); |
65 | 67 | }).get().join(colD); |
66 | 68 | }).get().join(rdel), |
|
78 | 80 | csv: function (rdel, name) { |
79 | 81 | var colD = $.fn.tableExport.csv.separator, |
80 | 82 | dataURL = $rows.map(function (i, val) { |
81 | | - if (!!~ignoreRows.indexOf(i-thAdj)) { return;} |
| 83 | + if (!!~ignoreRows.indexOf(i-thAdj) || $(val).is(ignoreCSS)) { return;} |
82 | 84 | var $cols = $(val).find('th, td'); |
83 | 85 | return $cols.map(function (i, val) { |
84 | | - if (!!~ignoreCols.indexOf(i)) { return;} |
| 86 | + if (!!~ignoreCols.indexOf(i) || $(val).is(ignoreCSS)) { return;} |
85 | 87 | return $(val).text(); |
86 | 88 | }).get().join(colD); |
87 | 89 | }).get().join(rdel), |
|
99 | 101 | txt: function (rdel, name) { |
100 | 102 | var colD = $.fn.tableExport.txt.separator, |
101 | 103 | dataURL = $rows.map(function (i, val) { |
102 | | - if (!!~ignoreRows.indexOf(i-thAdj)) { return;} |
| 104 | + if (!!~ignoreRows.indexOf(i-thAdj) || $(val).is(ignoreCSS)) { return;} |
103 | 105 | var $cols = $(val).find('th, td'); |
104 | 106 | return $cols.map(function (i, val) { |
105 | | - if (!!~ignoreCols.indexOf(i)) { return;} |
| 107 | + if (!!~ignoreCols.indexOf(i) || $(val).is(ignoreCSS)) { return;} |
106 | 108 | return $(val).text(); |
107 | 109 | }).get().join(colD); |
108 | 110 | }).get().join(rdel), |
|
136 | 138 | } |
137 | 139 | }); |
138 | 140 |
|
139 | | - $("button[data-fileblob]").on("click", function () { |
140 | | - var object = $(this).data("fileblob"), |
141 | | - data = object.data, |
142 | | - fileName = object.fileName, |
143 | | - mimeType = object.mimeType, |
144 | | - fileExtension = object.fileExtension; |
145 | | - export2file(data, mimeType, fileName, fileExtension); |
146 | | - }); |
| 141 | + $("button[data-fileblob]") |
| 142 | + .off("click") |
| 143 | + .on("click", function () { |
| 144 | + var object = $(this).data("fileblob"), |
| 145 | + data = object.data, |
| 146 | + fileName = object.fileName, |
| 147 | + mimeType = object.mimeType, |
| 148 | + fileExtension = object.fileExtension; |
| 149 | + export2file(data, mimeType, fileName, fileExtension); |
| 150 | + }); |
147 | 151 | }; |
148 | 152 |
|
149 | 153 | // Define the plugin default properties. |
|
155 | 159 | bootstrap: true, // (Boolean), style buttons using bootstrap, (default: true) |
156 | 160 | position: "bottom", // (top, bottom), position of the caption element relative to table, (default: "bottom") |
157 | 161 | ignoreRows: null, // (Number, Number[]), row indices to exclude from the exported file (default: null) |
158 | | - ignoreCols: null // (Number, Number[]), column indices to exclude from the exported file (default: null) |
| 162 | + ignoreCols: null, // (Number, Number[]), column indices to exclude from the exported file (default: null) |
| 163 | + ignoreCSS: ".tableexport-ignore" // (selector, selector[]), selector(s) to exclude from the exported file (default: ".tableexport-ignore") |
159 | 164 | }; |
160 | 165 |
|
161 | 166 | $.fn.tableExport.charset = "charset=utf-8"; |
|
0 commit comments