diff --git a/CHANGELOG.md b/CHANGELOG.md index a2f9bd9781..29dfb20248 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ ChangeLog --------- +### Next + +#### Breaking changes in 1.25.x + +- Remove `toolbarAlign` in favour of flexbox. To migrate, simply override CSS. IE if you previously specified right alignment, using Bootstrap: +``` +@media(min-width: "992px") { + .bs-bars { + margin-right: none; /** Instead of margin-right: auto */ + } +} +``` ### 1.24.1 #### Core diff --git a/dist/bootstrap-table.js b/dist/bootstrap-table.js index 0680d417f4..c5126765dc 100644 --- a/dist/bootstrap-table.js +++ b/dist/bootstrap-table.js @@ -8558,7 +8558,7 @@ } this.$toolbar.html(''); if (typeof opts.toolbar === 'string' || _typeof(opts.toolbar) === 'object') { - $(Utils.sprintf('
', this.constants.classes.pull, opts.toolbarAlign)).appendTo(this.$toolbar).append($(opts.toolbar)); + $('
').appendTo(this.$toolbar).append($(opts.toolbar)); } // showColumns, showToggle, showRefresh diff --git a/index.d.ts b/index.d.ts index feb021ebe3..86f5b4644d 100644 --- a/index.d.ts +++ b/index.d.ts @@ -213,7 +213,6 @@ export interface BootstrapTableOptions { searchOnEnterKey?: boolean; searchText?: string; responseHandler?: (res: any) => any; - toolbarAlign?: string; paginationParts?: string[]; cardView?: boolean; showSearchButton?: boolean; diff --git a/site/docs/api/table-options.md b/site/docs/api/table-options.md index eb14cea0c3..dc0dfe7013 100644 --- a/site/docs/api/table-options.md +++ b/site/docs/api/table-options.md @@ -1825,20 +1825,6 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`. - **Example:** [Custom Toolbar](https://examples.bootstrap-table.com/#options/custom-toolbar.html) -## toolbarAlign - -- **Attribute:** `data-toolbar-align` - -- **Type:** `String` - -- **Detail:** - - Indicate how to align the custom toolbar. `'left'`, `'right'` can be used. - -- **Default:** `'left'` - -- **Example:** [Toolbar Align](https://examples.bootstrap-table.com/#options/toolbar-align.html) - ## totalField - **Attribute:** `data-total-field` diff --git a/src/bootstrap-table.js b/src/bootstrap-table.js index 0b95a258a9..cb2cae29c1 100644 --- a/src/bootstrap-table.js +++ b/src/bootstrap-table.js @@ -608,6 +608,51 @@ class BootstrapTable { this.initBody() } + renderButton (buttonName, buttonConfig) { + let buttonHtml + + if (buttonConfig.hasOwnProperty('html')) { + if (typeof buttonConfig.html === 'function') { + buttonHtml = buttonConfig.html() + } else if (typeof buttonConfig.html === 'string') { + buttonHtml = buttonConfig.html + } + } else { + let buttonClass = this.constants.buttonsClass + + if (buttonConfig.hasOwnProperty('attributes') && buttonConfig.attributes.class) { + buttonClass += ` ${buttonConfig.attributes.class}` + } + buttonHtml = `