diff --git a/docs/_i18n/en/documentation/localizations.md b/docs/_i18n/en/documentation/localizations.md index 34a03bdc14..a342d5e4f2 100644 --- a/docs/_i18n/en/documentation/localizations.md +++ b/docs/_i18n/en/documentation/localizations.md @@ -65,6 +65,11 @@ formatAllRows - 'All' + + + formatFullscreen + - + 'Fullscreen' diff --git a/docs/_i18n/en/documentation/table-options.md b/docs/_i18n/en/documentation/table-options.md index 3b1c109b77..8b7c4c50a7 100644 --- a/docs/_i18n/en/documentation/table-options.md +++ b/docs/_i18n/en/documentation/table-options.md @@ -411,6 +411,13 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`. false True to show the pagination switch button. + + showFullscreen + data-show-fullscreen + Boolean + false + True to show the fullscreen button. + minimumCountColumns data-minimum-count-columns diff --git a/docs/_i18n/es/documentation/localizations.md b/docs/_i18n/es/documentation/localizations.md index 0373ec3bf1..9e1c0ff4d5 100644 --- a/docs/_i18n/es/documentation/localizations.md +++ b/docs/_i18n/es/documentation/localizations.md @@ -66,5 +66,43 @@ --/td> 'All' + + formatFullscreen + - + 'Fullscreen' + - \ No newline at end of file + + +--- + +**PS:** + +Podemos importar [all locale files](https://github.com/wenzhixin/bootstrap-table/tree/master/src/locale) lo que necesita: + +```html + + +... +``` + +Y luego utilice este código JavaScript para cambiar el lenguaje: + +```js +$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['en-US']); +// $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']); +// ... +``` + +O utilice los data attributes para configurar el lenguaje: + +```html + +
+``` + +O utilice este JavaScript para configurar el lenguaje: + +```js +$('table').bootstrapTable({locale:'en-US'}); +``` diff --git a/docs/_i18n/es/documentation/table-options.md b/docs/_i18n/es/documentation/table-options.md index 87a8fed537..9c69947b0f 100644 --- a/docs/_i18n/es/documentation/table-options.md +++ b/docs/_i18n/es/documentation/table-options.md @@ -337,6 +337,13 @@ Las opciones de la tabla están definidas en `jQuery.fn.bootstrapTable.defaults` false True para mostrar el botón de mostrar/ocultar la paginación. + + showFullscreen + data-show-fullscreen + Boolean + false + True para mostrar botón de fullscreen. + minimumCountColumns data-minimum-count-columns diff --git a/docs/_i18n/zh-cn/documentation/localizations.md b/docs/_i18n/zh-cn/documentation/localizations.md index 104d480acd..f7886c1ec5 100644 --- a/docs/_i18n/zh-cn/documentation/localizations.md +++ b/docs/_i18n/zh-cn/documentation/localizations.md @@ -65,6 +65,11 @@ formatAllRows - 'All' + + + formatFullscreen + - + 'Fullscreen' diff --git a/docs/_i18n/zh-cn/documentation/table-options.md b/docs/_i18n/zh-cn/documentation/table-options.md index c8deaea915..6ce59332e0 100644 --- a/docs/_i18n/zh-cn/documentation/table-options.md +++ b/docs/_i18n/zh-cn/documentation/table-options.md @@ -362,6 +362,13 @@ false 是否显示切换分页按钮。 + + showFullscreen + data-show-fullscreen + Boolean + false + True to show the fullscreen button. + minimumCountColumns data-minimum-count-columns diff --git a/src/bootstrap-table.css b/src/bootstrap-table.css index 512c0f9dee..a8516c1349 100644 --- a/src/bootstrap-table.css +++ b/src/bootstrap-table.css @@ -311,3 +311,12 @@ div.fixed-table-scroll-outer { display: block; clear: both; } + +.fullscreen { + position: fixed; + top: 0; + left: 0; + z-index: 1050; + width: 100%!important; + background: #FFF; +} diff --git a/src/bootstrap-table.js b/src/bootstrap-table.js index 8260849ec7..b6211395e6 100644 --- a/src/bootstrap-table.js +++ b/src/bootstrap-table.js @@ -25,7 +25,8 @@ toggle: 'glyphicon-list-alt icon-list-alt', columns: 'glyphicon-th icon-th', detailOpen: 'glyphicon-plus icon-plus', - detailClose: 'glyphicon-minus icon-minus' + detailClose: 'glyphicon-minus icon-minus', + fullscreen: 'glyphicon-fullscreen' }, pullClass: 'pull', toobarDropdowHtml: [''], @@ -43,7 +44,8 @@ toggle: 'fa-toggle-on', columns: 'fa-th-list', detailOpen: 'fa-plus', - detailClose: 'fa-minus' + detailClose: 'fa-minus', + fullscreen: 'fa-arrows-alt' }, pullClass: 'float', toobarDropdowHtml: [''], @@ -360,6 +362,7 @@ showPaginationSwitch: false, showRefresh: false, showToggle: false, + showFullscreen: false, buttonsAlign: 'right', smartDisplay: true, escape: false, @@ -524,6 +527,9 @@ formatToggle: function () { return 'Toggle'; }, + formatFullscreen: function () { + return 'Fullscreen'; + }, formatColumns: function () { return 'Columns'; }, @@ -1123,6 +1129,11 @@ ''); } + if (this.options.showFullscreen) { + this.$toolbar.find('button[name="fullscreen"]') + .off('click').on('click', $.proxy(this.toggleFullscreen, this)); + } + if (this.options.showRefresh) { html.push(sprintf(''); + } + if (this.options.showColumns) { html.push(sprintf('
', this.options.formatColumns()), @@ -1272,7 +1293,13 @@ this.options.pageNumber = 1; this.initSearch(); - this.updatePagination(); + if (event.firedByInitSearchText) { + if (this.options.sidePagination === 'client') { + this.updatePagination(); + } + } else { + this.updatePagination(); + } this.trigger('search', text); }; @@ -2115,7 +2142,7 @@ if (this.options.searchText !== '') { var $search = this.$toolbar.find('.search input'); $search.val(this.options.searchText); - this.onSearch({currentTarget: $search}); + this.onSearch({currentTarget: $search, firedByInitSearchText: true}); } } }; @@ -2923,6 +2950,10 @@ this.updatePagination(); }; + BootstrapTable.prototype.toggleFullscreen = function () { + this.$el.closest('.bootstrap-table').toggleClass('fullscreen'); + }; + BootstrapTable.prototype.refresh = function (params) { if (params && params.url) { this.options.url = params.url;