Skip to content

Commit

Permalink
Fixed compatibility issues when colspan is set as string
Browse files Browse the repository at this point in the history
  • Loading branch information
wenzhixin committed Sep 9, 2024
1 parent f422a05 commit 0bbe4c7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/bootstrap-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -2899,8 +2899,8 @@ class BootstrapTable {
mergeCells (options) {
const row = options.index
let col = this.getVisibleFields().indexOf(options.field)
const rowspan = options.rowspan || 1
const colspan = options.colspan || 1
const rowspan = +options.rowspan || 1
const colspan = +options.colspan || 1
let i
let j
const $tr = this.$body.find('>tr[data-index]')
Expand Down
4 changes: 2 additions & 2 deletions src/extensions/print/bootstrap-table-print.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ $.BootstrapTable = class extends $.BootstrapTable {
this.mergedCells.push({
row: options.index,
col,
rowspan: options.rowspan || 1,
colspan: options.colspan || 1
rowspan: +options.rowspan || 1,
colspan: +options.colspan || 1
})
}

Expand Down
8 changes: 4 additions & 4 deletions src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export default {
const flag = []

for (const column of columns[0]) {
totalCol += column.colspan || 1
totalCol += +column.colspan || 1
}

for (let i = 0; i < columns.length; i++) {
Expand All @@ -259,8 +259,8 @@ export default {

for (let i = 0; i < columns.length; i++) {
for (const r of columns[i]) {
const rowspan = r.rowspan || 1
const colspan = r.colspan || 1
const rowspan = +r.rowspan || 1
const colspan = +r.colspan || 1
const index = flag[i].indexOf(false)

r.colspanIndex = index
Expand All @@ -272,7 +272,7 @@ export default {
r.field = index
}
} else {
r.colspanGroup = r.colspan
r.colspanGroup = +r.colspan
}

for (let j = 0; j < rowspan; j++) {
Expand Down

0 comments on commit 0bbe4c7

Please sign in to comment.