Skip to content

Commit

Permalink
Merge pull request #7008 from Blue3957/feat/column-footer-style
Browse files Browse the repository at this point in the history
Column-specific footerStyle added
  • Loading branch information
wenzhixin authored Oct 7, 2023
2 parents 7e960c9 + 795e907 commit 165ad0a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export interface BootstrapTableColumn {
cellStyle?: any;
searchable?: boolean;
footerFormatter?: any;
footerStyle?: any;
formatter?: any;
checkboxEnabled?: boolean;
field?: any;
Expand Down
27 changes: 27 additions & 0 deletions site/docs/api/column-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
1 change: 1 addition & 0 deletions src/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ const COLUMN_DEFAULTS = {
searchable: true,
formatter: undefined,
footerFormatter: undefined,
footerStyle: undefined,
detailFormatter: undefined,
searchFormatter: true,
searchHighlightFormatter: false,
Expand Down

0 comments on commit 165ad0a

Please sign in to comment.