Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added card-view-field class to card-view #7611

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/bootstrap-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -1569,6 +1569,7 @@ class BootstrapTable {
class: this.header.classes[j] ? [this.header.classes[j]] : [],
style: this.header.styles[j] ? [this.header.styles[j]] : []
}
const cardViewClass = `card-view card-view-field-${field}`

if ((this.fromHtml || this.autoMergeCells) && typeof value_ === 'undefined') {
if (!column.checkbox && !column.radio) {
Expand Down Expand Up @@ -1660,7 +1661,7 @@ class BootstrapTable {
item[this.header.stateField] = value === true || (!!value_ || value && value.checked)

return Utils.h(this.options.cardView ? 'div' : 'td', {
class: [this.options.cardView ? 'card-view' : 'bs-checkbox', column.class],
class: [this.options.cardView ? cardViewClass : 'bs-checkbox', column.class],
style: this.options.cardView ? undefined : attrs.style
}, [
Utils.h('label', {}, [
Expand All @@ -1680,7 +1681,7 @@ class BootstrapTable {

if (this.options.cardView) {
if (this.options.smartDisplay && value === '') {
return Utils.h('div', { class: 'card-view' })
return Utils.h('div', { class: cardViewClass })
}

const cardTitle = this.options.showHeader ?
Expand All @@ -1690,7 +1691,7 @@ class BootstrapTable {
html: Utils.getFieldTitle(this.columns, field)
}) : ''

return Utils.h('div', { class: 'card-view' }, [
return Utils.h('div', { class: cardViewClass }, [
cardTitle,
Utils.h('span', {
class: ['card-view-value', cellStyle.classes],
Expand Down
Loading