|
25 | 25 | toggle: 'glyphicon-list-alt icon-list-alt', |
26 | 26 | columns: 'glyphicon-th icon-th', |
27 | 27 | detailOpen: 'glyphicon-plus icon-plus', |
28 | | - detailClose: 'glyphicon-minus icon-minus' |
| 28 | + detailClose: 'glyphicon-minus icon-minus', |
| 29 | + fullscreen: 'glyphicon-fullscreen' |
29 | 30 | }, |
30 | 31 | pullClass: 'pull', |
31 | 32 | toobarDropdowHtml: ['<ul class="dropdown-menu" role="menu">', '</ul>'], |
|
43 | 44 | toggle: 'fa-toggle-on', |
44 | 45 | columns: 'fa-th-list', |
45 | 46 | detailOpen: 'fa-plus', |
46 | | - detailClose: 'fa-minus' |
| 47 | + detailClose: 'fa-minus', |
| 48 | + fullscreen: 'fa-arrows-alt' |
47 | 49 | }, |
48 | 50 | pullClass: 'float', |
49 | 51 | toobarDropdowHtml: ['<div class="dropdown-menu dropdown-menu-right">', '</div>'], |
|
360 | 362 | showPaginationSwitch: false, |
361 | 363 | showRefresh: false, |
362 | 364 | showToggle: false, |
| 365 | + showFullscreen: false, |
363 | 366 | buttonsAlign: 'right', |
364 | 367 | smartDisplay: true, |
365 | 368 | escape: false, |
|
524 | 527 | formatToggle: function () { |
525 | 528 | return 'Toggle'; |
526 | 529 | }, |
| 530 | + formatFullscreen: function () { |
| 531 | + return 'Fullscreen'; |
| 532 | + }, |
527 | 533 | formatColumns: function () { |
528 | 534 | return 'Columns'; |
529 | 535 | }, |
|
1123 | 1129 | '</button>'); |
1124 | 1130 | } |
1125 | 1131 |
|
| 1132 | + if (this.options.showFullscreen) { |
| 1133 | + this.$toolbar.find('button[name="fullscreen"]') |
| 1134 | + .off('click').on('click', $.proxy(this.toggleFullscreen, this)); |
| 1135 | + } |
| 1136 | + |
1126 | 1137 | if (this.options.showRefresh) { |
1127 | 1138 | html.push(sprintf('<button class="btn' + |
1128 | 1139 | sprintf(' btn-%s', this.options.buttonsClass) + |
|
1143 | 1154 | '</button>'); |
1144 | 1155 | } |
1145 | 1156 |
|
| 1157 | + if (this.options.showFullscreen) { |
| 1158 | + html.push(sprintf('<button class="btn' + |
| 1159 | + sprintf(' btn-%s', this.options.buttonsClass) + |
| 1160 | + sprintf(' btn-%s', this.options.iconSize) + |
| 1161 | + '" type="button" name="fullscreen" aria-label="fullscreen" title="%s">', |
| 1162 | + this.options.formatFullscreen()), |
| 1163 | + sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.fullscreen), |
| 1164 | + '</button>'); |
| 1165 | + } |
| 1166 | + |
1146 | 1167 | if (this.options.showColumns) { |
1147 | 1168 | html.push(sprintf('<div class="keep-open btn-group" title="%s">', |
1148 | 1169 | this.options.formatColumns()), |
|
1272 | 1293 |
|
1273 | 1294 | this.options.pageNumber = 1; |
1274 | 1295 | this.initSearch(); |
1275 | | - this.updatePagination(); |
| 1296 | + if (event.firedByInitSearchText) { |
| 1297 | + if (this.options.sidePagination === 'client') { |
| 1298 | + this.updatePagination(); |
| 1299 | + } |
| 1300 | + } else { |
| 1301 | + this.updatePagination(); |
| 1302 | + } |
1276 | 1303 | this.trigger('search', text); |
1277 | 1304 | }; |
1278 | 1305 |
|
|
2115 | 2142 | if (this.options.searchText !== '') { |
2116 | 2143 | var $search = this.$toolbar.find('.search input'); |
2117 | 2144 | $search.val(this.options.searchText); |
2118 | | - this.onSearch({currentTarget: $search}); |
| 2145 | + this.onSearch({currentTarget: $search, firedByInitSearchText: true}); |
2119 | 2146 | } |
2120 | 2147 | } |
2121 | 2148 | }; |
|
2923 | 2950 | this.updatePagination(); |
2924 | 2951 | }; |
2925 | 2952 |
|
| 2953 | + BootstrapTable.prototype.toggleFullscreen = function () { |
| 2954 | + this.$el.closest('.bootstrap-table').toggleClass('fullscreen'); |
| 2955 | + }; |
| 2956 | + |
2926 | 2957 | BootstrapTable.prototype.refresh = function (params) { |
2927 | 2958 | if (params && params.url) { |
2928 | 2959 | this.options.url = params.url; |
|
0 commit comments