bootstrap-table-rails 1.9.1 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/bootstrap-table-rails/version.rb +1 -1
- data/vendor/assets/javascripts/bootstrap-table-locale-all.js +30 -10
- data/vendor/assets/javascripts/bootstrap-table.js +157 -53
- data/vendor/assets/javascripts/extensions/bootstrap-table-cookie.js +8 -4
- data/vendor/assets/javascripts/extensions/bootstrap-table-editable.js +21 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-export.js +9 -2
- data/vendor/assets/javascripts/extensions/bootstrap-table-filter-control.js +127 -46
- data/vendor/assets/javascripts/extensions/bootstrap-table-group-by 2.js +226 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-mobile.js +5 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-natural-sorting.js +12 -2
- data/vendor/assets/javascripts/extensions/bootstrap-table-reorder-rows.js +1 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-sticky-header.js +104 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-ca-ES.js +7 -6
- data/vendor/assets/javascripts/locale/bootstrap-table-en-US.js +2 -2
- data/vendor/assets/javascripts/locale/bootstrap-table-nl-NL.js +16 -1
- data/vendor/assets/javascripts/locale/bootstrap-table-ru-RU.js +3 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-zh-TW.js +2 -2
- data/vendor/assets/stylesheets/bootstrap-table.css +7 -2
- data/vendor/assets/stylesheets/extensions/bootstrap-table-group-by 2.css +7 -0
- data/vendor/assets/stylesheets/extensions/bootstrap-table-sticky-header.css +22 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ad3863ebcf97a6968cd420fe3f6f5b8924c751f
|
4
|
+
data.tar.gz: 6b3398adbc5e45f341c66f1c66eedb66fb3e01fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9efee877a9c3825d91ae433eeb5de517877f30fe2819f303b59ae15215a4370b38fc05e5dcb45fcc6f48015309d8f3cb22d7452e02cf48cf2597037350135dac
|
7
|
+
data.tar.gz: 5dbc6f60ad0d7fe5af62c63fefa75e6d8edd3e42e8df839f86e8691039dfd5eaf65784ed5324536ca1bc7a8ef3ff4b042d50cb10f2e4fb0eaaa400d63e83e4cf
|
data/README.md
CHANGED
@@ -46,6 +46,7 @@ vendor/
|
|
46
46
|
│ │ ├── bootstrap-table-filter-control.js
|
47
47
|
│ │ ├── bootstrap-table-filter.js
|
48
48
|
│ │ ├── bootstrap-table-flat-json.js
|
49
|
+
│ │ ├── bootstrap-table-group-by\ 2.js
|
49
50
|
│ │ ├── bootstrap-table-group-by.js
|
50
51
|
│ │ ├── bootstrap-table-key-events.js
|
51
52
|
│ │ ├── bootstrap-table-mobile.js
|
@@ -55,6 +56,7 @@ vendor/
|
|
55
56
|
│ │ ├── bootstrap-table-reorder-columns.js
|
56
57
|
│ │ ├── bootstrap-table-reorder-rows.js
|
57
58
|
│ │ ├── bootstrap-table-resizable.js
|
59
|
+
│ │ ├── bootstrap-table-sticky-header.js
|
58
60
|
│ │ └── bootstrap-table-toolbar.js
|
59
61
|
│ └── locale
|
60
62
|
│ ├── bootstrap-table-af-ZA.js
|
@@ -101,8 +103,10 @@ vendor/
|
|
101
103
|
└── stylesheets
|
102
104
|
├── bootstrap-table.css
|
103
105
|
└── extensions
|
106
|
+
├── bootstrap-table-group-by\ 2.css
|
104
107
|
├── bootstrap-table-group-by.css
|
105
|
-
|
108
|
+
├── bootstrap-table-reorder-rows.css
|
109
|
+
└── bootstrap-table-sticky-header.css
|
106
110
|
```
|
107
111
|
|
108
112
|
|
@@ -82,14 +82,15 @@
|
|
82
82
|
|
83
83
|
/**
|
84
84
|
* Bootstrap Table Catalan translation
|
85
|
-
*
|
85
|
+
* Authors: Marc Pina<iwalkalone69@gmail.com>
|
86
|
+
* Claudi Martinez<claudix.kernel@gmail.com>
|
86
87
|
*/
|
87
88
|
(function ($) {
|
88
89
|
'use strict';
|
89
90
|
|
90
91
|
$.fn.bootstrapTable.locales['ca-ES'] = {
|
91
92
|
formatLoadingMessage: function () {
|
92
|
-
return '
|
93
|
+
return 'Espereu, si us plau...';
|
93
94
|
},
|
94
95
|
formatRecordsPerPage: function (pageNumber) {
|
95
96
|
return pageNumber + ' resultats per pàgina';
|
@@ -98,19 +99,19 @@
|
|
98
99
|
return 'Mostrant de ' + pageFrom + ' fins ' + pageTo + ' - total ' + totalRows + ' resultats';
|
99
100
|
},
|
100
101
|
formatSearch: function () {
|
101
|
-
return '
|
102
|
+
return 'Cerca';
|
102
103
|
},
|
103
104
|
formatNoMatches: function () {
|
104
105
|
return 'No s\'han trobat resultats';
|
105
106
|
},
|
106
107
|
formatPaginationSwitch: function () {
|
107
|
-
return '
|
108
|
+
return 'Amaga/Mostra paginació';
|
108
109
|
},
|
109
110
|
formatRefresh: function () {
|
110
|
-
return '
|
111
|
+
return 'Refresca';
|
111
112
|
},
|
112
113
|
formatToggle: function () {
|
113
|
-
return '
|
114
|
+
return 'Alterna formatació';
|
114
115
|
},
|
115
116
|
formatColumns: function () {
|
116
117
|
return 'Columnes';
|
@@ -285,7 +286,7 @@
|
|
285
286
|
return 'Loading, please wait...';
|
286
287
|
},
|
287
288
|
formatRecordsPerPage: function (pageNumber) {
|
288
|
-
return pageNumber + '
|
289
|
+
return pageNumber + ' rows per page';
|
289
290
|
},
|
290
291
|
formatShowingRows: function (pageFrom, pageTo, totalRows) {
|
291
292
|
return 'Showing ' + pageFrom + ' to ' + pageTo + ' of ' + totalRows + ' rows';
|
@@ -316,6 +317,7 @@
|
|
316
317
|
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['en-US']);
|
317
318
|
|
318
319
|
})(jQuery);
|
320
|
+
|
319
321
|
/**
|
320
322
|
* Bootstrap Table Spanish (Argentina) translation
|
321
323
|
* Author: Felix Vera (felix.vera@gmail.com)
|
@@ -1048,13 +1050,28 @@
|
|
1048
1050
|
return pageNumber + ' records per pagina';
|
1049
1051
|
},
|
1050
1052
|
formatShowingRows: function (pageFrom, pageTo, totalRows) {
|
1051
|
-
return 'Toon ' + pageFrom + ' tot ' + pageTo + ' van ' + totalRows + '
|
1053
|
+
return 'Toon ' + pageFrom + ' tot ' + pageTo + ' van ' + totalRows + ' record' + ((totalRows > 1) ? 's' : '');
|
1054
|
+
},
|
1055
|
+
formatDetailPagination: function (totalRows) {
|
1056
|
+
return 'Toon ' + totalRows + ' record' + ((totalRows > 1) ? 's' : '');
|
1052
1057
|
},
|
1053
1058
|
formatSearch: function () {
|
1054
1059
|
return 'Zoeken';
|
1055
1060
|
},
|
1056
1061
|
formatNoMatches: function () {
|
1057
1062
|
return 'Geen resultaten gevonden';
|
1063
|
+
},
|
1064
|
+
formatRefresh: function () {
|
1065
|
+
return 'Vernieuwen';
|
1066
|
+
},
|
1067
|
+
formatToggle: function () {
|
1068
|
+
return 'Omschakelen';
|
1069
|
+
},
|
1070
|
+
formatColumns: function () {
|
1071
|
+
return 'Kolommen';
|
1072
|
+
},
|
1073
|
+
formatAllRows: function () {
|
1074
|
+
return 'Alle';
|
1058
1075
|
}
|
1059
1076
|
};
|
1060
1077
|
|
@@ -1244,6 +1261,9 @@
|
|
1244
1261
|
},
|
1245
1262
|
formatColumns: function () {
|
1246
1263
|
return 'Колонки';
|
1264
|
+
},
|
1265
|
+
formatClearFilters: function () {
|
1266
|
+
return 'Очистить фильтры';
|
1247
1267
|
}
|
1248
1268
|
};
|
1249
1269
|
|
@@ -1571,13 +1591,13 @@
|
|
1571
1591
|
return '搜尋';
|
1572
1592
|
},
|
1573
1593
|
formatNoMatches: function () {
|
1574
|
-
return '
|
1594
|
+
return '沒有找到符合的結果';
|
1575
1595
|
},
|
1576
1596
|
formatPaginationSwitch: function () {
|
1577
1597
|
return '隱藏/顯示分頁';
|
1578
1598
|
},
|
1579
1599
|
formatRefresh: function () {
|
1580
|
-
return '
|
1600
|
+
return '重新整理';
|
1581
1601
|
},
|
1582
1602
|
formatToggle: function () {
|
1583
1603
|
return '切換';
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
2
|
* @author zhixin wen <wenzhixin2010@gmail.com>
|
3
|
-
* version: 1.
|
3
|
+
* version: 1.10.0
|
4
4
|
* https://github.com/wenzhixin/bootstrap-table/
|
5
5
|
*/
|
6
6
|
|
@@ -180,11 +180,12 @@
|
|
180
180
|
var escapeHTML = function (text) {
|
181
181
|
if (typeof text === 'string') {
|
182
182
|
return text
|
183
|
-
.replace(/&/g,
|
184
|
-
.replace(/</g,
|
185
|
-
.replace(/>/g,
|
186
|
-
.replace(/"/g,
|
187
|
-
.replace(/'/g,
|
183
|
+
.replace(/&/g, '&')
|
184
|
+
.replace(/</g, '<')
|
185
|
+
.replace(/>/g, '>')
|
186
|
+
.replace(/"/g, '"')
|
187
|
+
.replace(/'/g, ''')
|
188
|
+
.replace(/`/g, '`');
|
188
189
|
}
|
189
190
|
return text;
|
190
191
|
};
|
@@ -211,17 +212,21 @@
|
|
211
212
|
return dataAttr;
|
212
213
|
};
|
213
214
|
|
214
|
-
var getItemField = function (item, field) {
|
215
|
+
var getItemField = function (item, field, escape) {
|
215
216
|
var value = item;
|
216
217
|
|
217
218
|
if (typeof field !== 'string' || item.hasOwnProperty(field)) {
|
218
|
-
return item[field];
|
219
|
+
return escape ? escapeHTML(item[field]) : item[field];
|
219
220
|
}
|
220
221
|
var props = field.split('.');
|
221
222
|
for (var p in props) {
|
222
|
-
value = value[props[p]];
|
223
|
+
value = value && value[props[p]];
|
223
224
|
}
|
224
|
-
return value;
|
225
|
+
return escape ? escapeHTML(value) : value;
|
226
|
+
};
|
227
|
+
|
228
|
+
var isIEBrowser = function () {
|
229
|
+
return !!(navigator.userAgent.indexOf("MSIE ") > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./));
|
225
230
|
};
|
226
231
|
|
227
232
|
// BOOTSTRAP TABLE CLASS DEFINITION
|
@@ -272,11 +277,10 @@
|
|
272
277
|
paginationHAlign: 'right', //right, left
|
273
278
|
paginationVAlign: 'bottom', //bottom, top, both
|
274
279
|
paginationDetailHAlign: 'left', //right, left
|
275
|
-
paginationFirstText: '«',
|
276
280
|
paginationPreText: '‹',
|
277
281
|
paginationNextText: '›',
|
278
|
-
paginationLastText: '»',
|
279
282
|
search: false,
|
283
|
+
searchOnEnterKey: false,
|
280
284
|
strictSearch: false,
|
281
285
|
searchAlign: 'right',
|
282
286
|
selectItemName: 'btSelectItem',
|
@@ -288,6 +292,7 @@
|
|
288
292
|
showToggle: false,
|
289
293
|
buttonsAlign: 'right',
|
290
294
|
smartDisplay: true,
|
295
|
+
escape: false,
|
291
296
|
minimumCountColumns: 1,
|
292
297
|
idField: undefined,
|
293
298
|
uniqueId: undefined,
|
@@ -763,7 +768,11 @@
|
|
763
768
|
$(this).data(visibleColumns[$(this).data('field')]);
|
764
769
|
});
|
765
770
|
this.$container.off('click', '.th-inner').on('click', '.th-inner', function (event) {
|
766
|
-
|
771
|
+
var target = $(this);
|
772
|
+
if (target.closest('.bootstrap-table')[0] !== that.$container[0])
|
773
|
+
return false;
|
774
|
+
|
775
|
+
if (that.options.sortable && target.parent().data().sortable) {
|
767
776
|
that.onSort(event);
|
768
777
|
}
|
769
778
|
});
|
@@ -790,8 +799,7 @@
|
|
790
799
|
}
|
791
800
|
|
792
801
|
this.$selectAll = this.$header.find('[name="btSelectAll"]');
|
793
|
-
this.$
|
794
|
-
.on('click', '[name="btSelectAll"]', function () {
|
802
|
+
this.$selectAll.off('click').on('click', function () {
|
795
803
|
var checked = $(this).prop('checked');
|
796
804
|
that[checked ? 'checkAll' : 'uncheckAll']();
|
797
805
|
that.updateSelected();
|
@@ -845,8 +853,8 @@
|
|
845
853
|
if (that.header.sortNames[index]) {
|
846
854
|
name = that.header.sortNames[index];
|
847
855
|
}
|
848
|
-
var aa = getItemField(a, name),
|
849
|
-
bb = getItemField(b, name),
|
856
|
+
var aa = getItemField(a, name, that.options.escape),
|
857
|
+
bb = getItemField(b, name, that.options.escape),
|
850
858
|
value = calculateObjectValue(that.header, that.header.sorters[index], [aa, bb]);
|
851
859
|
|
852
860
|
if (value !== undefined) {
|
@@ -926,6 +934,9 @@
|
|
926
934
|
$search,
|
927
935
|
switchableCount = 0;
|
928
936
|
|
937
|
+
if (this.$toolbar.find('.bars').children().length) {
|
938
|
+
$('body').append($(this.options.toolbar));
|
939
|
+
}
|
929
940
|
this.$toolbar.html('');
|
930
941
|
|
931
942
|
if (typeof this.options.toolbar === 'string' || typeof this.options.toolbar === 'object') {
|
@@ -1002,7 +1013,7 @@
|
|
1002
1013
|
|
1003
1014
|
html.push('</div>');
|
1004
1015
|
|
1005
|
-
// Fix #188: this.showToolbar is for
|
1016
|
+
// Fix #188: this.showToolbar is for extensions
|
1006
1017
|
if (this.showToolbar || html.length > 2) {
|
1007
1018
|
this.$toolbar.append(html.join(''));
|
1008
1019
|
}
|
@@ -1056,11 +1067,26 @@
|
|
1056
1067
|
this.$toolbar.append(html.join(''));
|
1057
1068
|
$search = this.$toolbar.find('.search input');
|
1058
1069
|
$search.off('keyup drop').on('keyup drop', function (event) {
|
1070
|
+
if (that.options.searchOnEnterKey) {
|
1071
|
+
if (event.keyCode !== 13) {
|
1072
|
+
return;
|
1073
|
+
}
|
1074
|
+
}
|
1075
|
+
|
1059
1076
|
clearTimeout(timeoutId); // doesn't matter if it's 0
|
1060
1077
|
timeoutId = setTimeout(function () {
|
1061
1078
|
that.onSearch(event);
|
1062
1079
|
}, that.options.searchTimeOut);
|
1063
1080
|
});
|
1081
|
+
|
1082
|
+
if (isIEBrowser()) {
|
1083
|
+
$search.off('mouseup').on('mouseup', function (event) {
|
1084
|
+
clearTimeout(timeoutId); // doesn't matter if it's 0
|
1085
|
+
timeoutId = setTimeout(function () {
|
1086
|
+
that.onSearch(event);
|
1087
|
+
}, that.options.searchTimeOut);
|
1088
|
+
});
|
1089
|
+
}
|
1064
1090
|
}
|
1065
1091
|
};
|
1066
1092
|
|
@@ -1076,6 +1102,7 @@
|
|
1076
1102
|
return;
|
1077
1103
|
}
|
1078
1104
|
this.searchText = text;
|
1105
|
+
this.options.searchText = text;
|
1079
1106
|
|
1080
1107
|
this.options.pageNumber = 1;
|
1081
1108
|
this.initSearch();
|
@@ -1111,7 +1138,7 @@
|
|
1111
1138
|
column = that.columns[getFieldIndex(that.columns, key)],
|
1112
1139
|
j = $.inArray(key, that.header.fields);
|
1113
1140
|
|
1114
|
-
// Fix #142: search use
|
1141
|
+
// Fix #142: search use formatted data
|
1115
1142
|
if (column && column.searchFormatter) {
|
1116
1143
|
value = calculateObjectValue(column,
|
1117
1144
|
that.header.formatters[j], [value, item, i], value);
|
@@ -1243,7 +1270,6 @@
|
|
1243
1270
|
html.push('</div>',
|
1244
1271
|
'<div class="pull-' + this.options.paginationHAlign + ' pagination">',
|
1245
1272
|
'<ul class="pagination' + sprintf(' pagination-%s', this.options.iconSize) + '">',
|
1246
|
-
'<li class="page-first"><a href="javascript:void(0)">' + this.options.paginationFirstText + '</a></li>',
|
1247
1273
|
'<li class="page-pre"><a href="javascript:void(0)">' + this.options.paginationPreText + '</a></li>');
|
1248
1274
|
|
1249
1275
|
if (this.totalPages < 5) {
|
@@ -1261,18 +1287,71 @@
|
|
1261
1287
|
from = to - 4;
|
1262
1288
|
}
|
1263
1289
|
}
|
1290
|
+
|
1291
|
+
if (this.totalPages >= 6) {
|
1292
|
+
if (this.options.pageNumber >= 3) {
|
1293
|
+
html.push('<li class="page-first' + (1 === this.options.pageNumber ? ' active' : '') + '">',
|
1294
|
+
'<a href="javascript:void(0)">', 1, '</a>',
|
1295
|
+
'</li>');
|
1296
|
+
|
1297
|
+
from++;
|
1298
|
+
}
|
1299
|
+
|
1300
|
+
if (this.options.pageNumber >= 4) {
|
1301
|
+
if (this.options.pageNumber == 4 || this.totalPages == 6 || this.totalPages == 7) {
|
1302
|
+
from--;
|
1303
|
+
} else {
|
1304
|
+
html.push('<li class="page-first-separator disabled">',
|
1305
|
+
'<a href="javascript:void(0)">...</a>',
|
1306
|
+
'</li>');
|
1307
|
+
}
|
1308
|
+
|
1309
|
+
to--;
|
1310
|
+
}
|
1311
|
+
}
|
1312
|
+
|
1313
|
+
if (this.totalPages >= 7) {
|
1314
|
+
if (this.options.pageNumber >= (this.totalPages - 2)) {
|
1315
|
+
from--;
|
1316
|
+
}
|
1317
|
+
}
|
1318
|
+
|
1319
|
+
if (this.totalPages == 6) {
|
1320
|
+
if (this.options.pageNumber >= (this.totalPages - 2)) {
|
1321
|
+
to++;
|
1322
|
+
}
|
1323
|
+
} else if (this.totalPages >= 7) {
|
1324
|
+
if (this.totalPages == 7 || this.options.pageNumber >= (this.totalPages - 3)) {
|
1325
|
+
to++;
|
1326
|
+
}
|
1327
|
+
}
|
1328
|
+
|
1264
1329
|
for (i = from; i <= to; i++) {
|
1265
1330
|
html.push('<li class="page-number' + (i === this.options.pageNumber ? ' active' : '') + '">',
|
1266
1331
|
'<a href="javascript:void(0)">', i, '</a>',
|
1267
1332
|
'</li>');
|
1268
1333
|
}
|
1269
1334
|
|
1335
|
+
if (this.totalPages >= 8) {
|
1336
|
+
if (this.options.pageNumber <= (this.totalPages - 4)) {
|
1337
|
+
html.push('<li class="page-last-separator disabled">',
|
1338
|
+
'<a href="javascript:void(0)">...</a>',
|
1339
|
+
'</li>');
|
1340
|
+
}
|
1341
|
+
}
|
1342
|
+
|
1343
|
+
if (this.totalPages >= 6) {
|
1344
|
+
if (this.options.pageNumber <= (this.totalPages - 3)) {
|
1345
|
+
html.push('<li class="page-last' + (this.totalPages === this.options.pageNumber ? ' active' : '') + '">',
|
1346
|
+
'<a href="javascript:void(0)">', this.totalPages, '</a>',
|
1347
|
+
'</li>');
|
1348
|
+
}
|
1349
|
+
}
|
1350
|
+
|
1270
1351
|
html.push(
|
1271
1352
|
'<li class="page-next"><a href="javascript:void(0)">' + this.options.paginationNextText + '</a></li>',
|
1272
|
-
'<li class="page-last"><a href="javascript:void(0)">' + this.options.paginationLastText + '</a></li>',
|
1273
1353
|
'</ul>',
|
1274
1354
|
'</div>');
|
1275
|
-
|
1276
1355
|
}
|
1277
1356
|
this.$pagination.html(html.join(''));
|
1278
1357
|
|
@@ -1284,14 +1363,6 @@
|
|
1284
1363
|
$last = this.$pagination.find('.page-last');
|
1285
1364
|
$number = this.$pagination.find('.page-number');
|
1286
1365
|
|
1287
|
-
if (this.options.pageNumber <= 1) {
|
1288
|
-
$first.addClass('disabled');
|
1289
|
-
$pre.addClass('disabled');
|
1290
|
-
}
|
1291
|
-
if (this.options.pageNumber >= this.totalPages) {
|
1292
|
-
$next.addClass('disabled');
|
1293
|
-
$last.addClass('disabled');
|
1294
|
-
}
|
1295
1366
|
if (this.options.smartDisplay) {
|
1296
1367
|
if (this.totalPages <= 1) {
|
1297
1368
|
this.$pagination.find('div.pagination').hide();
|
@@ -1352,12 +1423,20 @@
|
|
1352
1423
|
};
|
1353
1424
|
|
1354
1425
|
BootstrapTable.prototype.onPagePre = function (event) {
|
1355
|
-
this.options.pageNumber
|
1426
|
+
if ((this.options.pageNumber - 1) == 0) {
|
1427
|
+
this.options.pageNumber = this.options.totalPages;
|
1428
|
+
} else {
|
1429
|
+
this.options.pageNumber--;
|
1430
|
+
}
|
1356
1431
|
this.updatePagination(event);
|
1357
1432
|
};
|
1358
1433
|
|
1359
1434
|
BootstrapTable.prototype.onPageNext = function (event) {
|
1360
|
-
this.options.pageNumber
|
1435
|
+
if ((this.options.pageNumber + 1) > this.options.totalPages) {
|
1436
|
+
this.options.pageNumber = 1;
|
1437
|
+
} else {
|
1438
|
+
this.options.pageNumber++;
|
1439
|
+
}
|
1361
1440
|
this.updatePagination(event);
|
1362
1441
|
};
|
1363
1442
|
|
@@ -1453,7 +1532,7 @@
|
|
1453
1532
|
|
1454
1533
|
$.each(this.header.fields, function (j, field) {
|
1455
1534
|
var text = '',
|
1456
|
-
value = getItemField(item, field),
|
1535
|
+
value = getItemField(item, field, that.options.escape),
|
1457
1536
|
type = '',
|
1458
1537
|
cellStyle = {},
|
1459
1538
|
id_ = '',
|
@@ -1512,8 +1591,8 @@
|
|
1512
1591
|
type = column.checkbox ? 'checkbox' : type;
|
1513
1592
|
type = column.radio ? 'radio' : type;
|
1514
1593
|
|
1515
|
-
text = [that.options.cardView ?
|
1516
|
-
'<div class="card-view">' : '<td class="bs-checkbox">',
|
1594
|
+
text = [sprintf(that.options.cardView ?
|
1595
|
+
'<div class="card-view %s">' : '<td class="bs-checkbox %s">', column['class'] || ''),
|
1517
1596
|
'<input' +
|
1518
1597
|
sprintf(' data-index="%s"', i) +
|
1519
1598
|
sprintf(' name="%s"', that.options.selectItemName) +
|
@@ -1582,7 +1661,7 @@
|
|
1582
1661
|
index = $td[0].cellIndex,
|
1583
1662
|
field = that.header.fields[that.options.detailView && !that.options.cardView ? index - 1 : index],
|
1584
1663
|
column = that.columns[getFieldIndex(that.columns, field)],
|
1585
|
-
value = getItemField(item, field);
|
1664
|
+
value = getItemField(item, field, that.options.escape);
|
1586
1665
|
|
1587
1666
|
if ($td.find('.detail-icon').length) {
|
1588
1667
|
return;
|
@@ -1613,10 +1692,13 @@
|
|
1613
1692
|
that.trigger('collapse-row', index, row);
|
1614
1693
|
} else {
|
1615
1694
|
$this.find('i').attr('class', sprintf('%s %s', that.options.iconsPrefix, that.options.icons.detailClose));
|
1616
|
-
$tr.after(sprintf('<tr class="detail-view"><td colspan="%s"
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1695
|
+
$tr.after(sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>', $tr.find('td').length));
|
1696
|
+
var $element = $tr.next().find('td');
|
1697
|
+
var content = calculateObjectValue(that.options, that.options.detailFormatter, [index, row, $element], '');
|
1698
|
+
if($element.length === 1) {
|
1699
|
+
$element.append(content);
|
1700
|
+
}
|
1701
|
+
that.trigger('expand-row', index, row, $element);
|
1620
1702
|
}
|
1621
1703
|
that.resetView();
|
1622
1704
|
});
|
@@ -1694,15 +1776,18 @@
|
|
1694
1776
|
var that = this,
|
1695
1777
|
data = {},
|
1696
1778
|
params = {
|
1697
|
-
pageSize: this.options.pageSize === this.options.formatAllRows() ?
|
1698
|
-
this.options.totalRows : this.options.pageSize,
|
1699
|
-
pageNumber: this.options.pageNumber,
|
1700
1779
|
searchText: this.searchText,
|
1701
1780
|
sortName: this.options.sortName,
|
1702
1781
|
sortOrder: this.options.sortOrder
|
1703
1782
|
},
|
1704
1783
|
request;
|
1705
1784
|
|
1785
|
+
if(this.options.pagination) {
|
1786
|
+
params.pageSize = this.options.pageSize === this.options.formatAllRows() ?
|
1787
|
+
this.options.totalRows : this.options.pageSize;
|
1788
|
+
params.pageNumber = this.options.pageNumber;
|
1789
|
+
}
|
1790
|
+
|
1706
1791
|
if (!this.options.url && !this.options.ajax) {
|
1707
1792
|
return;
|
1708
1793
|
}
|
@@ -1750,14 +1835,11 @@
|
|
1750
1835
|
|
1751
1836
|
that.load(res);
|
1752
1837
|
that.trigger('load-success', res);
|
1838
|
+
if (!silent) that.$tableLoading.hide();
|
1753
1839
|
},
|
1754
1840
|
error: function (res) {
|
1755
1841
|
that.trigger('load-error', res.status, res);
|
1756
|
-
|
1757
|
-
complete: function () {
|
1758
|
-
if (!silent) {
|
1759
|
-
that.$tableLoading.hide();
|
1760
|
-
}
|
1842
|
+
if (!silent) that.$tableLoading.hide();
|
1761
1843
|
}
|
1762
1844
|
});
|
1763
1845
|
|
@@ -2120,6 +2202,7 @@
|
|
2120
2202
|
this.initData(data, 'append');
|
2121
2203
|
this.initSearch();
|
2122
2204
|
this.initPagination();
|
2205
|
+
this.initSort();
|
2123
2206
|
this.initBody(true);
|
2124
2207
|
};
|
2125
2208
|
|
@@ -2127,6 +2210,7 @@
|
|
2127
2210
|
this.initData(data, 'prepend');
|
2128
2211
|
this.initSearch();
|
2129
2212
|
this.initPagination();
|
2213
|
+
this.initSort();
|
2130
2214
|
this.initBody(true);
|
2131
2215
|
};
|
2132
2216
|
|
@@ -2155,6 +2239,7 @@
|
|
2155
2239
|
|
2156
2240
|
this.initSearch();
|
2157
2241
|
this.initPagination();
|
2242
|
+
this.initSort();
|
2158
2243
|
this.initBody(true);
|
2159
2244
|
};
|
2160
2245
|
|
@@ -2259,14 +2344,14 @@
|
|
2259
2344
|
};
|
2260
2345
|
|
2261
2346
|
BootstrapTable.prototype.showRow = function (params) {
|
2262
|
-
if (!params.hasOwnProperty('index')
|
2347
|
+
if (!params.hasOwnProperty('index') && !params.hasOwnProperty('uniqueId')) {
|
2263
2348
|
return;
|
2264
2349
|
}
|
2265
2350
|
this.toggleRow(params.index, params.uniqueId, true);
|
2266
2351
|
};
|
2267
2352
|
|
2268
2353
|
BootstrapTable.prototype.hideRow = function (params) {
|
2269
|
-
if (!params.hasOwnProperty('index')
|
2354
|
+
if (!params.hasOwnProperty('index') && !params.hasOwnProperty('uniqueId')) {
|
2270
2355
|
return;
|
2271
2356
|
}
|
2272
2357
|
this.toggleRow(params.index, params.uniqueId, false);
|
@@ -2318,6 +2403,10 @@
|
|
2318
2403
|
return;
|
2319
2404
|
}
|
2320
2405
|
this.data[params.index][params.field] = params.value;
|
2406
|
+
|
2407
|
+
if (params.reinit === false) {
|
2408
|
+
return;
|
2409
|
+
}
|
2321
2410
|
this.initSort();
|
2322
2411
|
this.initBody(true);
|
2323
2412
|
};
|
@@ -2525,7 +2614,7 @@
|
|
2525
2614
|
|
2526
2615
|
BootstrapTable.prototype.refreshOptions = function (options) {
|
2527
2616
|
//If the objects are equivalent then avoid the call of destroy / init methods
|
2528
|
-
if (compareObjects(this.options, options,
|
2617
|
+
if (compareObjects(this.options, options, true)) {
|
2529
2618
|
return;
|
2530
2619
|
}
|
2531
2620
|
this.options = $.extend(this.options, options);
|
@@ -2604,6 +2693,21 @@
|
|
2604
2693
|
}
|
2605
2694
|
};
|
2606
2695
|
|
2696
|
+
BootstrapTable.prototype.updateFormatText = function (name, text) {
|
2697
|
+
if (this.options[sprintf('format%s', name)]) {
|
2698
|
+
if (typeof text === 'string') {
|
2699
|
+
this.options[sprintf('format%s', name)] = function () {
|
2700
|
+
return text;
|
2701
|
+
};
|
2702
|
+
} else if (typeof text === 'function') {
|
2703
|
+
this.options[sprintf('format%s', name)] = text;
|
2704
|
+
}
|
2705
|
+
}
|
2706
|
+
this.initToolbar();
|
2707
|
+
this.initPagination();
|
2708
|
+
this.initBody();
|
2709
|
+
};
|
2710
|
+
|
2607
2711
|
// BOOTSTRAP TABLE PLUGIN DEFINITION
|
2608
2712
|
// =======================
|
2609
2713
|
|
@@ -2631,7 +2735,8 @@
|
|
2631
2735
|
'toggleView',
|
2632
2736
|
'refreshOptions',
|
2633
2737
|
'resetSearch',
|
2634
|
-
'expandRow', 'collapseRow', 'expandAllRows', 'collapseAllRows'
|
2738
|
+
'expandRow', 'collapseRow', 'expandAllRows', 'collapseAllRows',
|
2739
|
+
'updateFormatText'
|
2635
2740
|
];
|
2636
2741
|
|
2637
2742
|
$.fn.bootstrapTable = function (option) {
|
@@ -2686,5 +2791,4 @@
|
|
2686
2791
|
$(function () {
|
2687
2792
|
$('[data-toggle="table"]').bootstrapTable();
|
2688
2793
|
});
|
2689
|
-
|
2690
2794
|
}(jQuery);
|