Skip to content

Commit fa757c9

Browse files
committed
1 parent 8cbdbad commit fa757c9

8 files changed

Lines changed: 114 additions & 5 deletions

File tree

docs/_i18n/en/documentation/localizations.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@
6565
<td>formatAllRows</td>
6666
<td>-</td>
6767
<td>'All'</td>
68+
</tr>
69+
<tr>
70+
<td>formatFullscreen</td>
71+
<td>-</td>
72+
<td>'Fullscreen'</td>
6873
</tr>
6974
</tbody>
7075
</table>

docs/_i18n/en/documentation/table-options.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,13 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
411411
<td>false</td>
412412
<td>True to show the pagination switch button.</td>
413413
</tr>
414+
<tr>
415+
<td>showFullscreen</td>
416+
<td>data-show-fullscreen</td>
417+
<td>Boolean</td>
418+
<td>false</td>
419+
<td>True to show the fullscreen button.</td>
420+
</tr>
414421
<tr>
415422
<td>minimumCountColumns</td>
416423
<td>data-minimum-count-columns</td>

docs/_i18n/es/documentation/localizations.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,43 @@
6666
<td>--/td>
6767
<td>'All'</td>
6868
</tr>
69+
<tr>
70+
<td>formatFullscreen</td>
71+
<td>-</td>
72+
<td>'Fullscreen'</td>
73+
</tr>
6974
</tbody>
70-
</table>
75+
</table>
76+
77+
---
78+
79+
**PS:**
80+
81+
Podemos importar [all locale files](https://github.com/wenzhixin/bootstrap-table/tree/master/src/locale) lo que necesita:
82+
83+
```html
84+
<script src="bootstrap-table-en-US.js"></script>
85+
<script src="bootstrap-table-zh-CN.js"></script>
86+
...
87+
```
88+
89+
Y luego utilice este código JavaScript para cambiar el lenguaje:
90+
91+
```js
92+
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['en-US']);
93+
// $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
94+
// ...
95+
```
96+
97+
O utilice los data attributes para configurar el lenguaje:
98+
99+
```html
100+
<table data-toggle="table" data-locale="en-US">
101+
</table>
102+
```
103+
104+
O utilice este JavaScript para configurar el lenguaje:
105+
106+
```js
107+
$('table').bootstrapTable({locale:'en-US'});
108+
```

docs/_i18n/es/documentation/table-options.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,13 @@ Las opciones de la tabla están definidas en `jQuery.fn.bootstrapTable.defaults`
337337
<td>false</td>
338338
<td>True para mostrar el botón de mostrar/ocultar la paginación.</td>
339339
</tr>
340+
<tr>
341+
<td>showFullscreen</td>
342+
<td>data-show-fullscreen</td>
343+
<td>Boolean</td>
344+
<td>false</td>
345+
<td>True para mostrar botón de fullscreen.</td>
346+
</tr>
340347
<tr>
341348
<td>minimumCountColumns</td>
342349
<td>data-minimum-count-columns</td>

docs/_i18n/zh-cn/documentation/localizations.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@
6565
<td>formatAllRows</td>
6666
<td>-</td>
6767
<td>'All'</td>
68+
</tr>
69+
<tr>
70+
<td>formatFullscreen</td>
71+
<td>-</td>
72+
<td>'Fullscreen'</td>
6873
</tr>
6974
</tbody>
7075
</table>

docs/_i18n/zh-cn/documentation/table-options.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,13 @@
362362
<td>false</td>
363363
<td>是否显示切换分页按钮。</td>
364364
</tr>
365+
<tr>
366+
<td>showFullscreen</td>
367+
<td>data-show-fullscreen</td>
368+
<td>Boolean</td>
369+
<td>false</td>
370+
<td>True to show the fullscreen button.</td>
371+
</tr>
365372
<tr>
366373
<td>minimumCountColumns</td>
367374
<td>data-minimum-count-columns</td>

src/bootstrap-table.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,12 @@ div.fixed-table-scroll-outer {
311311
display: block;
312312
clear: both;
313313
}
314+
315+
.fullscreen {
316+
position: fixed;
317+
top: 0;
318+
left: 0;
319+
z-index: 1050;
320+
width: 100%!important;
321+
background: #FFF;
322+
}

src/bootstrap-table.js

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
toggle: 'glyphicon-list-alt icon-list-alt',
2626
columns: 'glyphicon-th icon-th',
2727
detailOpen: 'glyphicon-plus icon-plus',
28-
detailClose: 'glyphicon-minus icon-minus'
28+
detailClose: 'glyphicon-minus icon-minus',
29+
fullscreen: 'glyphicon-fullscreen'
2930
},
3031
pullClass: 'pull',
3132
toobarDropdowHtml: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
@@ -43,7 +44,8 @@
4344
toggle: 'fa-toggle-on',
4445
columns: 'fa-th-list',
4546
detailOpen: 'fa-plus',
46-
detailClose: 'fa-minus'
47+
detailClose: 'fa-minus',
48+
fullscreen: 'fa-arrows-alt'
4749
},
4850
pullClass: 'float',
4951
toobarDropdowHtml: ['<div class="dropdown-menu dropdown-menu-right">', '</div>'],
@@ -360,6 +362,7 @@
360362
showPaginationSwitch: false,
361363
showRefresh: false,
362364
showToggle: false,
365+
showFullscreen: false,
363366
buttonsAlign: 'right',
364367
smartDisplay: true,
365368
escape: false,
@@ -524,6 +527,9 @@
524527
formatToggle: function () {
525528
return 'Toggle';
526529
},
530+
formatFullscreen: function () {
531+
return 'Fullscreen';
532+
},
527533
formatColumns: function () {
528534
return 'Columns';
529535
},
@@ -1123,6 +1129,11 @@
11231129
'</button>');
11241130
}
11251131

1132+
if (this.options.showFullscreen) {
1133+
this.$toolbar.find('button[name="fullscreen"]')
1134+
.off('click').on('click', $.proxy(this.toggleFullscreen, this));
1135+
}
1136+
11261137
if (this.options.showRefresh) {
11271138
html.push(sprintf('<button class="btn' +
11281139
sprintf(' btn-%s', this.options.buttonsClass) +
@@ -1143,6 +1154,16 @@
11431154
'</button>');
11441155
}
11451156

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+
11461167
if (this.options.showColumns) {
11471168
html.push(sprintf('<div class="keep-open btn-group" title="%s">',
11481169
this.options.formatColumns()),
@@ -1272,7 +1293,13 @@
12721293

12731294
this.options.pageNumber = 1;
12741295
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+
}
12761303
this.trigger('search', text);
12771304
};
12781305

@@ -2115,7 +2142,7 @@
21152142
if (this.options.searchText !== '') {
21162143
var $search = this.$toolbar.find('.search input');
21172144
$search.val(this.options.searchText);
2118-
this.onSearch({currentTarget: $search});
2145+
this.onSearch({currentTarget: $search, firedByInitSearchText: true});
21192146
}
21202147
}
21212148
};
@@ -2923,6 +2950,10 @@
29232950
this.updatePagination();
29242951
};
29252952

2953+
BootstrapTable.prototype.toggleFullscreen = function () {
2954+
this.$el.closest('.bootstrap-table').toggleClass('fullscreen');
2955+
};
2956+
29262957
BootstrapTable.prototype.refresh = function (params) {
29272958
if (params && params.url) {
29282959
this.options.url = params.url;

0 commit comments

Comments
 (0)