|
1 | 1 | /*! |
2 | | - * TableExport.js v3.2.4 (http://www.clarketravis.com) |
| 2 | + * TableExport.js v3.2.5 (http://www.clarketravis.com) |
3 | 3 | * Copyright 2016 Travis Clarke |
4 | 4 | * Licensed under the MIT license |
5 | 5 | */ |
|
9 | 9 | /*--- GLOBALS ---*/ |
10 | 10 | var $ = window.jQuery; |
11 | 11 |
|
12 | | - $.fn.tableExport = function (options) { |
| 12 | + $.fn.tableExport = function (options, isUpdate) { |
13 | 13 |
|
14 | | - var settings = $.extend({}, $.fn.tableExport.defaults, options), |
| 14 | + var $this = this, |
| 15 | + settings = isUpdate ? options : $.extend({}, $.fn.tableExport.defaults, options), |
15 | 16 | rowD = $.fn.tableExport.rowDel, |
16 | 17 | ignoreRows = settings.ignoreRows instanceof Array ? settings.ignoreRows : [settings.ignoreRows], |
17 | 18 | ignoreCols = settings.ignoreCols instanceof Array ? settings.ignoreCols : [settings.ignoreCols], |
|
27 | 28 | bootstrapTheme = bootstrapSpacing = ""; |
28 | 29 | } |
29 | 30 |
|
30 | | - this.each(function () { |
31 | | - var $el = $(this), |
32 | | - $rows = $el.find('tbody').find('tr'), |
| 31 | + $this.each(function () { |
| 32 | + var $el = $(this); |
| 33 | + if (isUpdate) { $el.find('caption:not(.head)').remove();} |
| 34 | + var $rows = $el.find('tbody').find('tr'), |
33 | 35 | $rows = settings.headings ? $rows.add($el.find('thead>tr')) : $rows, |
34 | | - $rows = settings.footers ? $rows.add($el.find('tfoor>tr')) : $rows, |
| 36 | + $rows = settings.footers ? $rows.add($el.find('tfoot>tr')) : $rows, |
35 | 37 | thAdj = settings.headings ? $el.find('thead>tr').length : 0, |
36 | 38 | fileName = settings.fileName === "id" ? ($el.attr('id') ? $el.attr('id') : $.fn.tableExport.defaultFileName) : settings.fileName, |
37 | 39 | exporters = { |
|
147 | 149 | fileExtension = object.fileExtension; |
148 | 150 | export2file(data, mimeType, fileName, fileExtension); |
149 | 151 | }); |
| 152 | + |
| 153 | + $.fn.tableExport.update = function (options) { |
| 154 | + $this.tableExport($.extend({}, settings, options), true) |
| 155 | + }; |
| 156 | + |
| 157 | + $.fn.tableExport.reset = function (options) { |
| 158 | + $this.tableExport(settings, true) |
| 159 | + }; |
| 160 | + |
| 161 | + $.fn.tableExport.remove = function (options) { |
| 162 | + $this.each(function () { |
| 163 | + $(this).find('caption:not(.head)').remove(); |
| 164 | + }); |
| 165 | + }; |
| 166 | + |
| 167 | + return $this; |
150 | 168 | }; |
151 | 169 |
|
152 | 170 | // Define the plugin default properties. |
|
0 commit comments