|
37 | 37 | })
|
38 | 38 |
|
39 | 39 | $.extend($.fn.bootstrapTable.locales, {
|
40 |
| - formatExport() { |
| 40 | + formatExport () { |
41 | 41 | return 'Export data'
|
42 | 42 | }
|
43 | 43 | })
|
|
82 | 82 | const types = exportTypes.slice(1, -1).replace(/ /g, '').split(',')
|
83 | 83 | exportTypes = types.map(t => t.slice(1, -1))
|
84 | 84 | }
|
85 |
| - for (type of exportTypes) { |
| 85 | + for (let type of exportTypes) { |
86 | 86 | if (TYPE_NAME.hasOwnProperty(type)) {
|
87 |
| - const item = utils.bootstrapVersion === 4 ? |
88 |
| - TYPE_NAME[type] : `<a href="javascript:void(0)">${TYPE_NAME[type]}</a>` |
| 87 | + const item = utils.bootstrapVersion === 4 |
| 88 | + ? TYPE_NAME[type] : `<a href="javascript:void(0)">${TYPE_NAME[type]}</a>` |
89 | 89 | const $item = $(utils.sprintf(utils.bs.toobarDropdowItemHtml, item))
|
90 | 90 | $item.attr('data-type', type)
|
91 | 91 | $menu.append($item)
|
|
95 | 95 | $menu.find('>li, >label').click(e => {
|
96 | 96 | const type = $(e.currentTarget).data('type')
|
97 | 97 | const doExport = () => {
|
| 98 | + const data = this.getData() |
98 | 99 | if (o.exportFooter) {
|
99 |
| - const data = this.getData() |
100 | 100 | const $footerRow = this.$tableFooter.find('tr').first()
|
101 |
| - |
102 | 101 | const footerData = {}
|
103 | 102 | const footerHtml = []
|
104 | 103 |
|
105 |
| - $.each($footerRow.children(), function(index, footerCell) { |
106 |
| - |
107 |
| - var footerCellHtml = $(footerCell).children(".th-inner").first().html() |
108 |
| - footerData[this.columns[index].field] = footerCellHtml == ' ' ? null : footerCellHtml |
| 104 | + $.each($footerRow.children(), function (index, footerCell) { |
| 105 | + var footerCellHtml = $(footerCell).children('.th-inner').first().html() |
| 106 | + footerData[this.columns[index].field] = footerCellHtml === ' ' ? null : footerCellHtml |
109 | 107 |
|
110 | 108 | // grab footer cell text into cell index-based array
|
111 | 109 | footerHtml.push(footerCellHtml)
|
|
115 | 113 |
|
116 | 114 | var $lastTableRow = this.$body.children().last()
|
117 | 115 |
|
118 |
| - $.each($lastTableRow.children(), function(index, lastTableRowCell) { |
119 |
| - |
| 116 | + $.each($lastTableRow.children(), function (index, lastTableRowCell) { |
120 | 117 | $(lastTableRowCell).html(footerHtml[index])
|
121 | 118 | })
|
122 | 119 | }
|
|
143 | 140 | })
|
144 | 141 | this.togglePagination()
|
145 | 142 | } else if (o.exportDataType === 'selected') {
|
146 |
| - const data = this.getData() |
147 |
| - const selectedData = this.getSelections() |
| 143 | + let data = this.getData() |
| 144 | + let selectedData = this.getSelections() |
148 | 145 | if (!selectedData.length) {
|
149 | 146 | return
|
150 | 147 | }
|
|
178 | 175 | })
|
179 | 176 | }
|
180 | 177 | }
|
181 |
| - |
182 | 178 | })(jQuery)
|
0 commit comments