diff --git a/index.d.ts b/index.d.ts index 101622393f..25ed80a7ab 100644 --- a/index.d.ts +++ b/index.d.ts @@ -75,6 +75,7 @@ export interface BootstrapTableColumn { cellStyle?: any; searchable?: boolean; footerFormatter?: any; + footerStyle?: any; formatter?: any; checkboxEnabled?: boolean; field?: any; diff --git a/site/docs/api/column-options.md b/site/docs/api/column-options.md index 919ae1239e..3bdc692aa8 100644 --- a/site/docs/api/column-options.md +++ b/site/docs/api/column-options.md @@ -238,6 +238,33 @@ The column options is defined in `jQuery.fn.bootstrapTable.columnDefaults`. - **Example:** [Footer Formatter](https://examples.bootstrap-table.com/#column-options/footer-formatter.html) +## footerStyle + +- **Attribute:** `data-footer-style` + +- **Type:** `Function` + +- **Detail:** + + The footer style formatter function, takes one parameter: + + * `column`: the column object. + + Support `classes` or `css`. Example usage: + + {% highlight javascript %} + function footerStyle(column) { + return { + css: { 'font-weight': 'normal' }, + classes: 'my-class' + } + } + {% endhighlight %} + +- **Default:** `{}` + +- **Example:** [Footer Style](https://examples.bootstrap-table.com/#options/footer-style.html) + ## formatter - **Attribute:** `data-formatter` diff --git a/src/bootstrap-table.js b/src/bootstrap-table.js index ee733bdcce..a17ecc4ec5 100644 --- a/src/bootstrap-table.js +++ b/src/bootstrap-table.js @@ -2292,7 +2292,7 @@ class BootstrapTable { falign = Utils.sprintf('text-align: %s; ', column.falign ? column.falign : column.align) valign = Utils.sprintf('vertical-align: %s; ', column.valign) - style = Utils.calculateObjectValue(null, this.options.footerStyle, [column]) + style = Utils.calculateObjectValue(null, column.footerStyle || this.options.footerStyle, [column]) if (style && style.css) { for (const [key, value] of Object.entries(style.css)) { diff --git a/src/constants/index.js b/src/constants/index.js index 65305f278c..e6a2e6d761 100644 --- a/src/constants/index.js +++ b/src/constants/index.js @@ -447,6 +447,7 @@ const COLUMN_DEFAULTS = { searchable: true, formatter: undefined, footerFormatter: undefined, + footerStyle: undefined, detailFormatter: undefined, searchFormatter: true, searchHighlightFormatter: false,