bootstrap-table-rails 1.11.0 → 1.11.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -4
- data/lib/bootstrap-table-rails/version.rb +1 -1
- data/vendor/assets/images/icon.png +0 -0
- data/vendor/assets/javascripts/bootstrap-table.js +300 -225
- data/vendor/assets/javascripts/extensions/bootstrap-table-accent-neutralise.js +0 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-angular.js +0 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-auto-refresh.js +84 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-click-edit-row.js +142 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-cookie.js +78 -36
- data/vendor/assets/javascripts/extensions/bootstrap-table-copy-rows.js +0 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-editable.js +0 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-export.js +12 -2
- data/vendor/assets/javascripts/extensions/bootstrap-table-filter-control.js +36 -11
- data/vendor/assets/javascripts/extensions/bootstrap-table-filter.js +0 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-flat-json.js +0 -0
- data/vendor/assets/javascripts/extensions/{bootstrap-table-group-by 2.js → bootstrap-table-group-by-v2.js} +0 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-group-by.js +0 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-i18n-enhance.js +0 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-key-events.js +0 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-mobile.js +0 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-multi-toggle.js +0 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-multiple-search.js +0 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-multiple-selection-row.js +127 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-multiple-sort.js +1 -1
- data/vendor/assets/javascripts/extensions/bootstrap-table-natural-sorting.js +0 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-print.js +133 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-reorder-columns.js +4 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-reorder-rows.js +6 -4
- data/vendor/assets/javascripts/extensions/bootstrap-table-resizable.js +0 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-select2-filter.js +0 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-sticky-header.js +0 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-toolbar.js +2 -2
- data/vendor/assets/javascripts/extensions/bootstrap-table-tree-column.js +130 -0
- data/vendor/assets/javascripts/locale/README.md +179 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-af-ZA.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-ar-SA.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-ca-ES.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-cs-CZ.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-da-DK.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-de-DE.js +10 -4
- data/vendor/assets/javascripts/locale/bootstrap-table-el-GR.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-en-US.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-en-US.js.template +49 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-es-AR.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-es-CL.js +44 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-es-CR.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-es-ES.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-es-MX.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-es-NI.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-es-SP.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-et-EE.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-fa-IR.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-fr-BE.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-fr-FR.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-he-IL.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-hr-HR.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-hu-HU.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-id-ID.js +49 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-it-IT.js +12 -2
- data/vendor/assets/javascripts/locale/bootstrap-table-ja-JP.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-ka-GE.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-ko-KR.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-ms-MY.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-nb-NO.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-nl-NL.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-pl-PL.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-pt-BR.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-pt-PT.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-ro-RO.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-ru-RU.js +33 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-sk-SK.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-sv-SE.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-th-TH.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-tr-TR.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-uk-UA.js +36 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-ur-PK.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-uz-Latn-UZ.js +49 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-vi-VN.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-zh-CN.js +0 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-zh-TW.js +0 -0
- data/vendor/assets/stylesheets/bootstrap-table.css +9 -5
- data/vendor/assets/stylesheets/extensions/bootstrap-table-auto-refresh.css +3 -0
- data/vendor/assets/stylesheets/extensions/bootstrap-table-click-edit-row.css +21 -0
- data/vendor/assets/stylesheets/extensions/bootstrap-table-filter-control.css +13 -0
- data/vendor/assets/stylesheets/extensions/{bootstrap-table-group-by 2.css → bootstrap-table-group-by-v2.css} +0 -0
- data/vendor/assets/stylesheets/extensions/bootstrap-table-group-by.css +0 -0
- data/vendor/assets/stylesheets/extensions/bootstrap-table-multiple-selection-row.css +17 -0
- data/vendor/assets/stylesheets/extensions/bootstrap-table-reorder-rows.css +0 -0
- data/vendor/assets/stylesheets/extensions/bootstrap-table-sticky-header.css +0 -0
- data/vendor/assets/stylesheets/extensions/bootstrap-table-tree-column.css +1 -0
- metadata +20 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 178cc246caf26c90aa810577dfd6766f427a8bd5
|
4
|
+
data.tar.gz: 92f4035d61f532fe493fbc82c57945bd0b9a127b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fb78f807132c4f1aec587921f16deacf771fb2d20ef815247bcb51f32e3ce6fcdb3a56a452905928119efc39b8ca5cbbe1ba76ca863fad49b6bab69a4e7bb55
|
7
|
+
data.tar.gz: 11a070cfdadf4005392abb30caadc247793f53f70c322263a9a30a7b44c987d9c14506a60fe70edb22907ed23d02a228cd4ede3b4f23b0d84f7d3ffe0f4e7f54
|
data/README.md
CHANGED
@@ -34,31 +34,43 @@ Dir tree:
|
|
34
34
|
``` tree
|
35
35
|
vendor/
|
36
36
|
└── assets
|
37
|
+
├── images
|
38
|
+
│ └── icon.png
|
37
39
|
├── javascripts
|
38
40
|
│ ├── bootstrap-table-locale-all.js
|
39
41
|
│ ├── bootstrap-table.js
|
40
42
|
│ ├── extensions
|
41
43
|
│ │ ├── bootstrap-table-accent-neutralise.js
|
42
44
|
│ │ ├── bootstrap-table-angular.js
|
45
|
+
│ │ ├── bootstrap-table-auto-refresh.js
|
46
|
+
│ │ ├── bootstrap-table-click-edit-row.js
|
43
47
|
│ │ ├── bootstrap-table-cookie.js
|
48
|
+
│ │ ├── bootstrap-table-copy-rows.js
|
44
49
|
│ │ ├── bootstrap-table-editable.js
|
45
50
|
│ │ ├── bootstrap-table-export.js
|
46
51
|
│ │ ├── bootstrap-table-filter-control.js
|
47
52
|
│ │ ├── bootstrap-table-filter.js
|
48
53
|
│ │ ├── bootstrap-table-flat-json.js
|
49
|
-
│ │ ├── bootstrap-table-group-by
|
54
|
+
│ │ ├── bootstrap-table-group-by-v2.js
|
50
55
|
│ │ ├── bootstrap-table-group-by.js
|
56
|
+
│ │ ├── bootstrap-table-i18n-enhance.js
|
51
57
|
│ │ ├── bootstrap-table-key-events.js
|
52
58
|
│ │ ├── bootstrap-table-mobile.js
|
59
|
+
│ │ ├── bootstrap-table-multi-toggle.js
|
53
60
|
│ │ ├── bootstrap-table-multiple-search.js
|
61
|
+
│ │ ├── bootstrap-table-multiple-selection-row.js
|
54
62
|
│ │ ├── bootstrap-table-multiple-sort.js
|
55
63
|
│ │ ├── bootstrap-table-natural-sorting.js
|
64
|
+
│ │ ├── bootstrap-table-print.js
|
56
65
|
│ │ ├── bootstrap-table-reorder-columns.js
|
57
66
|
│ │ ├── bootstrap-table-reorder-rows.js
|
58
67
|
│ │ ├── bootstrap-table-resizable.js
|
68
|
+
│ │ ├── bootstrap-table-select2-filter.js
|
59
69
|
│ │ ├── bootstrap-table-sticky-header.js
|
60
|
-
│ │
|
70
|
+
│ │ ├── bootstrap-table-toolbar.js
|
71
|
+
│ │ └── bootstrap-table-tree-column.js
|
61
72
|
│ └── locale
|
73
|
+
│ ├── README.md
|
62
74
|
│ ├── bootstrap-table-af-ZA.js
|
63
75
|
│ ├── bootstrap-table-ar-SA.js
|
64
76
|
│ ├── bootstrap-table-ca-ES.js
|
@@ -67,7 +79,9 @@ vendor/
|
|
67
79
|
│ ├── bootstrap-table-de-DE.js
|
68
80
|
│ ├── bootstrap-table-el-GR.js
|
69
81
|
│ ├── bootstrap-table-en-US.js
|
82
|
+
│ ├── bootstrap-table-en-US.js.template
|
70
83
|
│ ├── bootstrap-table-es-AR.js
|
84
|
+
│ ├── bootstrap-table-es-CL.js
|
71
85
|
│ ├── bootstrap-table-es-CR.js
|
72
86
|
│ ├── bootstrap-table-es-ES.js
|
73
87
|
│ ├── bootstrap-table-es-MX.js
|
@@ -80,6 +94,7 @@ vendor/
|
|
80
94
|
│ ├── bootstrap-table-he-IL.js
|
81
95
|
│ ├── bootstrap-table-hr-HR.js
|
82
96
|
│ ├── bootstrap-table-hu-HU.js
|
97
|
+
│ ├── bootstrap-table-id-ID.js
|
83
98
|
│ ├── bootstrap-table-it-IT.js
|
84
99
|
│ ├── bootstrap-table-ja-JP.js
|
85
100
|
│ ├── bootstrap-table-ka-GE.js
|
@@ -98,16 +113,22 @@ vendor/
|
|
98
113
|
│ ├── bootstrap-table-tr-TR.js
|
99
114
|
│ ├── bootstrap-table-uk-UA.js
|
100
115
|
│ ├── bootstrap-table-ur-PK.js
|
116
|
+
│ ├── bootstrap-table-uz-Latn-UZ.js
|
101
117
|
│ ├── bootstrap-table-vi-VN.js
|
102
118
|
│ ├── bootstrap-table-zh-CN.js
|
103
119
|
│ └── bootstrap-table-zh-TW.js
|
104
120
|
└── stylesheets
|
105
121
|
├── bootstrap-table.css
|
106
122
|
└── extensions
|
107
|
-
├── bootstrap-table-
|
123
|
+
├── bootstrap-table-auto-refresh.css
|
124
|
+
├── bootstrap-table-click-edit-row.css
|
125
|
+
├── bootstrap-table-filter-control.css
|
126
|
+
├── bootstrap-table-group-by-v2.css
|
108
127
|
├── bootstrap-table-group-by.css
|
128
|
+
├── bootstrap-table-multiple-selection-row.css
|
109
129
|
├── bootstrap-table-reorder-rows.css
|
110
|
-
|
130
|
+
├── bootstrap-table-sticky-header.css
|
131
|
+
└── bootstrap-table-tree-column.css
|
111
132
|
```
|
112
133
|
|
113
134
|
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
2
|
* @author zhixin wen <wenzhixin2010@gmail.com>
|
3
|
-
* version: 1.11.
|
3
|
+
* version: 1.11.1
|
4
4
|
* https://github.com/wenzhixin/bootstrap-table/
|
5
5
|
*/
|
6
6
|
|
@@ -140,7 +140,7 @@
|
|
140
140
|
return func;
|
141
141
|
}
|
142
142
|
if (typeof func === 'function') {
|
143
|
-
return func.apply(self, args);
|
143
|
+
return func.apply(self, args || []);
|
144
144
|
}
|
145
145
|
if (!func && typeof name === 'string' && sprintf.apply(this, [name].concat(args))) {
|
146
146
|
return sprintf.apply(this, [name].concat(args));
|
@@ -190,16 +190,6 @@
|
|
190
190
|
return text;
|
191
191
|
};
|
192
192
|
|
193
|
-
var getRealHeight = function ($el) {
|
194
|
-
var height = 0;
|
195
|
-
$el.children().each(function () {
|
196
|
-
if (height < $(this).outerHeight(true)) {
|
197
|
-
height = $(this).outerHeight(true);
|
198
|
-
}
|
199
|
-
});
|
200
|
-
return height;
|
201
|
-
};
|
202
|
-
|
203
193
|
var getRealDataAttr = function (dataAttr) {
|
204
194
|
for (var attr in dataAttr) {
|
205
195
|
var auxAttr = attr.split(/(?=[A-Z])/).join('-').toLowerCase();
|
@@ -220,7 +210,9 @@
|
|
220
210
|
}
|
221
211
|
var props = field.split('.');
|
222
212
|
for (var p in props) {
|
223
|
-
|
213
|
+
if (props.hasOwnProperty(p)) {
|
214
|
+
value = value && value[props[p]];
|
215
|
+
}
|
224
216
|
}
|
225
217
|
return escape ? escapeHTML(value) : value;
|
226
218
|
};
|
@@ -287,6 +279,7 @@
|
|
287
279
|
|
288
280
|
BootstrapTable.DEFAULTS = {
|
289
281
|
classes: 'table table-hover',
|
282
|
+
sortClass: undefined,
|
290
283
|
locale: undefined,
|
291
284
|
height: undefined,
|
292
285
|
undefinedText: '-',
|
@@ -296,6 +289,7 @@
|
|
296
289
|
striped: false,
|
297
290
|
columns: [[]],
|
298
291
|
data: [],
|
292
|
+
totalField: 'total',
|
299
293
|
dataField: 'rows',
|
300
294
|
method: 'get',
|
301
295
|
url: undefined,
|
@@ -313,6 +307,7 @@
|
|
313
307
|
},
|
314
308
|
pagination: false,
|
315
309
|
onlyInfoPagination: false,
|
310
|
+
paginationLoop: true,
|
316
311
|
sidePagination: 'client', // client or server
|
317
312
|
totalRows: 0, // server side need to set
|
318
313
|
pageNumber: 1,
|
@@ -531,7 +526,8 @@
|
|
531
526
|
cellStyle: undefined,
|
532
527
|
searchable: true,
|
533
528
|
searchFormatter: true,
|
534
|
-
cardVisible: true
|
529
|
+
cardVisible: true,
|
530
|
+
escape : false
|
535
531
|
};
|
536
532
|
|
537
533
|
BootstrapTable.EVENTS = {
|
@@ -569,6 +565,7 @@
|
|
569
565
|
this.initTable();
|
570
566
|
this.initHeader();
|
571
567
|
this.initData();
|
568
|
+
this.initHiddenRows();
|
572
569
|
this.initFooter();
|
573
570
|
this.initToolbar();
|
574
571
|
this.initPagination();
|
@@ -814,13 +811,12 @@
|
|
814
811
|
sprintf(' rowspan="%s"', column.rowspan),
|
815
812
|
sprintf(' colspan="%s"', column.colspan),
|
816
813
|
sprintf(' data-field="%s"', column.field),
|
817
|
-
"tabindex='0'",
|
818
814
|
'>');
|
819
815
|
|
820
816
|
html.push(sprintf('<div class="th-inner %s">', that.options.sortable && column.sortable ?
|
821
817
|
'sortable both' : ''));
|
822
818
|
|
823
|
-
text = column.title;
|
819
|
+
text = that.options.escape ? escapeHTML(column.title) : column.title;
|
824
820
|
|
825
821
|
if (column.checkbox) {
|
826
822
|
if (!that.options.singleSelect && that.options.checkboxHeader) {
|
@@ -931,7 +927,8 @@
|
|
931
927
|
var that = this,
|
932
928
|
name = this.options.sortName,
|
933
929
|
order = this.options.sortOrder === 'desc' ? -1 : 1,
|
934
|
-
index = $.inArray(this.options.sortName, this.header.fields)
|
930
|
+
index = $.inArray(this.options.sortName, this.header.fields),
|
931
|
+
timeoutId = 0;
|
935
932
|
|
936
933
|
if (this.options.customSort !== $.noop) {
|
937
934
|
this.options.customSort.apply(this, [this.options.sortName, this.options.sortOrder]);
|
@@ -996,6 +993,17 @@
|
|
996
993
|
|
997
994
|
return order;
|
998
995
|
});
|
996
|
+
|
997
|
+
if (this.options.sortClass !== undefined) {
|
998
|
+
clearTimeout(timeoutId);
|
999
|
+
timeoutId = setTimeout(function () {
|
1000
|
+
that.$el.removeClass(that.options.sortClass);
|
1001
|
+
var index = that.$header.find(sprintf('[data-field="%s"]',
|
1002
|
+
that.options.sortName).index() + 1);
|
1003
|
+
that.$el.find(sprintf('tr td:nth-child(%s)', index))
|
1004
|
+
.addClass(that.options.sortClass);
|
1005
|
+
}, 250);
|
1006
|
+
}
|
999
1007
|
}
|
1000
1008
|
};
|
1001
1009
|
|
@@ -1058,7 +1066,7 @@
|
|
1058
1066
|
html.push(sprintf('<button class="btn' +
|
1059
1067
|
sprintf(' btn-%s', this.options.buttonsClass) +
|
1060
1068
|
sprintf(' btn-%s', this.options.iconSize) +
|
1061
|
-
'" type="button" name="paginationSwitch" title="%s">',
|
1069
|
+
'" type="button" name="paginationSwitch" aria-label="pagination Switch" title="%s">',
|
1062
1070
|
this.options.formatPaginationSwitch()),
|
1063
1071
|
sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.paginationSwitchDown),
|
1064
1072
|
'</button>');
|
@@ -1068,7 +1076,7 @@
|
|
1068
1076
|
html.push(sprintf('<button class="btn' +
|
1069
1077
|
sprintf(' btn-%s', this.options.buttonsClass) +
|
1070
1078
|
sprintf(' btn-%s', this.options.iconSize) +
|
1071
|
-
'" type="button" name="refresh" title="%s">',
|
1079
|
+
'" type="button" name="refresh" aria-label="refresh" title="%s">',
|
1072
1080
|
this.options.formatRefresh()),
|
1073
1081
|
sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.refresh),
|
1074
1082
|
'</button>');
|
@@ -1078,7 +1086,7 @@
|
|
1078
1086
|
html.push(sprintf('<button class="btn' +
|
1079
1087
|
sprintf(' btn-%s', this.options.buttonsClass) +
|
1080
1088
|
sprintf(' btn-%s', this.options.iconSize) +
|
1081
|
-
'" type="button" name="toggle" title="%s">',
|
1089
|
+
'" type="button" name="toggle" aria-label="toggle" title="%s">',
|
1082
1090
|
this.options.formatToggle()),
|
1083
1091
|
sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.toggle),
|
1084
1092
|
'</button>');
|
@@ -1087,7 +1095,7 @@
|
|
1087
1095
|
if (this.options.showColumns) {
|
1088
1096
|
html.push(sprintf('<div class="keep-open btn-group" title="%s">',
|
1089
1097
|
this.options.formatColumns()),
|
1090
|
-
'<button type="button" class="btn' +
|
1098
|
+
'<button type="button" aria-label="columns" class="btn' +
|
1091
1099
|
sprintf(' btn-%s', this.options.buttonsClass) +
|
1092
1100
|
sprintf(' btn-%s', this.options.iconSize) +
|
1093
1101
|
' dropdown-toggle" data-toggle="dropdown">',
|
@@ -1108,7 +1116,7 @@
|
|
1108
1116
|
var checked = column.visible ? ' checked="checked"' : '';
|
1109
1117
|
|
1110
1118
|
if (column.switchable) {
|
1111
|
-
html.push(sprintf('<li>' +
|
1119
|
+
html.push(sprintf('<li role="menuitem">' +
|
1112
1120
|
'<label><input type="checkbox" data-field="%s" value="%s"%s> %s</label>' +
|
1113
1121
|
'</li>', column.field, i, checked, column.title));
|
1114
1122
|
switchableCount++;
|
@@ -1172,7 +1180,7 @@
|
|
1172
1180
|
|
1173
1181
|
this.$toolbar.append(html.join(''));
|
1174
1182
|
$search = this.$toolbar.find('.search input');
|
1175
|
-
$search.off('keyup drop').on('keyup drop', function (event) {
|
1183
|
+
$search.off('keyup drop blur').on('keyup drop blur', function (event) {
|
1176
1184
|
if (that.options.searchOnEnterKey && event.keyCode !== 13) {
|
1177
1185
|
return;
|
1178
1186
|
}
|
@@ -1235,7 +1243,7 @@
|
|
1235
1243
|
this.data = f ? $.grep(this.options.data, function (item, i) {
|
1236
1244
|
for (var key in f) {
|
1237
1245
|
if ($.isArray(f[key]) && $.inArray(item[key], f[key]) === -1 ||
|
1238
|
-
item[key] !== f[key]) {
|
1246
|
+
!$.isArray(f[key]) && item[key] !== f[key]) {
|
1239
1247
|
return false;
|
1240
1248
|
}
|
1241
1249
|
}
|
@@ -1377,14 +1385,14 @@
|
|
1377
1385
|
}
|
1378
1386
|
|
1379
1387
|
$.each(pageList, function (i, page) {
|
1380
|
-
if (!that.options.smartDisplay || i === 0 || pageList[i - 1]
|
1388
|
+
if (!that.options.smartDisplay || i === 0 || pageList[i - 1] < that.options.totalRows) {
|
1381
1389
|
var active;
|
1382
1390
|
if ($allSelected) {
|
1383
1391
|
active = page === that.options.formatAllRows() ? ' class="active"' : '';
|
1384
1392
|
} else {
|
1385
1393
|
active = page === that.options.pageSize ? ' class="active"' : '';
|
1386
1394
|
}
|
1387
|
-
pageNumber.push(sprintf('<li%s><a href="
|
1395
|
+
pageNumber.push(sprintf('<li role="menuitem"%s><a href="#">%s</a></li>', active, page));
|
1388
1396
|
}
|
1389
1397
|
});
|
1390
1398
|
pageNumber.push('</ul></span>');
|
@@ -1395,7 +1403,7 @@
|
|
1395
1403
|
html.push('</div>',
|
1396
1404
|
'<div class="pull-' + this.options.paginationHAlign + ' pagination">',
|
1397
1405
|
'<ul class="pagination' + sprintf(' pagination-%s', this.options.iconSize) + '">',
|
1398
|
-
'<li class="page-pre"><a href="
|
1406
|
+
'<li class="page-pre"><a href="#">' + this.options.paginationPreText + '</a></li>');
|
1399
1407
|
|
1400
1408
|
if (this.totalPages < 5) {
|
1401
1409
|
from = 1;
|
@@ -1416,7 +1424,7 @@
|
|
1416
1424
|
if (this.totalPages >= 6) {
|
1417
1425
|
if (this.options.pageNumber >= 3) {
|
1418
1426
|
html.push('<li class="page-first' + (1 === this.options.pageNumber ? ' active' : '') + '">',
|
1419
|
-
'<a href="
|
1427
|
+
'<a href="#">', 1, '</a>',
|
1420
1428
|
'</li>');
|
1421
1429
|
|
1422
1430
|
from++;
|
@@ -1427,7 +1435,7 @@
|
|
1427
1435
|
from--;
|
1428
1436
|
} else {
|
1429
1437
|
html.push('<li class="page-first-separator disabled">',
|
1430
|
-
'<a href="
|
1438
|
+
'<a href="#">...</a>',
|
1431
1439
|
'</li>');
|
1432
1440
|
}
|
1433
1441
|
|
@@ -1453,14 +1461,14 @@
|
|
1453
1461
|
|
1454
1462
|
for (i = from; i <= to; i++) {
|
1455
1463
|
html.push('<li class="page-number' + (i === this.options.pageNumber ? ' active' : '') + '">',
|
1456
|
-
'<a href="
|
1464
|
+
'<a href="#">', i, '</a>',
|
1457
1465
|
'</li>');
|
1458
1466
|
}
|
1459
1467
|
|
1460
1468
|
if (this.totalPages >= 8) {
|
1461
1469
|
if (this.options.pageNumber <= (this.totalPages - 4)) {
|
1462
1470
|
html.push('<li class="page-last-separator disabled">',
|
1463
|
-
'<a href="
|
1471
|
+
'<a href="#">...</a>',
|
1464
1472
|
'</li>');
|
1465
1473
|
}
|
1466
1474
|
}
|
@@ -1468,13 +1476,13 @@
|
|
1468
1476
|
if (this.totalPages >= 6) {
|
1469
1477
|
if (this.options.pageNumber <= (this.totalPages - 3)) {
|
1470
1478
|
html.push('<li class="page-last' + (this.totalPages === this.options.pageNumber ? ' active' : '') + '">',
|
1471
|
-
'<a href="
|
1479
|
+
'<a href="#">', this.totalPages, '</a>',
|
1472
1480
|
'</li>');
|
1473
1481
|
}
|
1474
1482
|
}
|
1475
1483
|
|
1476
1484
|
html.push(
|
1477
|
-
'<li class="page-next"><a href="
|
1485
|
+
'<li class="page-next"><a href="#">' + this.options.paginationNextText + '</a></li>',
|
1478
1486
|
'</ul>',
|
1479
1487
|
'</div>');
|
1480
1488
|
}
|
@@ -1499,6 +1507,16 @@
|
|
1499
1507
|
// when data is empty, hide the pagination
|
1500
1508
|
this.$pagination[this.getData().length ? 'show' : 'hide']();
|
1501
1509
|
}
|
1510
|
+
|
1511
|
+
if (!this.options.paginationLoop) {
|
1512
|
+
if (this.options.pageNumber === 1) {
|
1513
|
+
$pre.addClass('disabled');
|
1514
|
+
}
|
1515
|
+
if (this.options.pageNumber === this.totalPages) {
|
1516
|
+
$next.addClass('disabled');
|
1517
|
+
}
|
1518
|
+
}
|
1519
|
+
|
1502
1520
|
if ($allSelected) {
|
1503
1521
|
this.options.pageSize = this.options.formatAllRows();
|
1504
1522
|
}
|
@@ -1540,11 +1558,13 @@
|
|
1540
1558
|
this.$toolbar.find('.page-size').text(this.options.pageSize);
|
1541
1559
|
|
1542
1560
|
this.updatePagination(event);
|
1561
|
+
return false;
|
1543
1562
|
};
|
1544
1563
|
|
1545
1564
|
BootstrapTable.prototype.onPageFirst = function (event) {
|
1546
1565
|
this.options.pageNumber = 1;
|
1547
1566
|
this.updatePagination(event);
|
1567
|
+
return false;
|
1548
1568
|
};
|
1549
1569
|
|
1550
1570
|
BootstrapTable.prototype.onPagePre = function (event) {
|
@@ -1554,6 +1574,7 @@
|
|
1554
1574
|
this.options.pageNumber--;
|
1555
1575
|
}
|
1556
1576
|
this.updatePagination(event);
|
1577
|
+
return false;
|
1557
1578
|
};
|
1558
1579
|
|
1559
1580
|
BootstrapTable.prototype.onPageNext = function (event) {
|
@@ -1563,11 +1584,13 @@
|
|
1563
1584
|
this.options.pageNumber++;
|
1564
1585
|
}
|
1565
1586
|
this.updatePagination(event);
|
1587
|
+
return false;
|
1566
1588
|
};
|
1567
1589
|
|
1568
1590
|
BootstrapTable.prototype.onPageLast = function (event) {
|
1569
1591
|
this.options.pageNumber = this.totalPages;
|
1570
1592
|
this.updatePagination(event);
|
1593
|
+
return false;
|
1571
1594
|
};
|
1572
1595
|
|
1573
1596
|
BootstrapTable.prototype.onPageNumber = function (event) {
|
@@ -1576,55 +1599,138 @@
|
|
1576
1599
|
}
|
1577
1600
|
this.options.pageNumber = +$(event.currentTarget).text();
|
1578
1601
|
this.updatePagination(event);
|
1602
|
+
return false;
|
1579
1603
|
};
|
1580
1604
|
|
1581
|
-
BootstrapTable.prototype.
|
1582
|
-
var that
|
1605
|
+
BootstrapTable.prototype.initRow = function(item, i, data, parentDom) {
|
1606
|
+
var that=this,
|
1607
|
+
key,
|
1583
1608
|
html = [],
|
1584
|
-
|
1609
|
+
style = {},
|
1610
|
+
csses = [],
|
1611
|
+
data_ = '',
|
1612
|
+
attributes = {},
|
1613
|
+
htmlAttributes = [];
|
1585
1614
|
|
1586
|
-
this.
|
1615
|
+
if ($.inArray(item, this.hiddenRows) > -1) {
|
1616
|
+
return;
|
1617
|
+
}
|
1587
1618
|
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1619
|
+
style = calculateObjectValue(this.options, this.options.rowStyle, [item, i], style);
|
1620
|
+
|
1621
|
+
if (style && style.css) {
|
1622
|
+
for (key in style.css) {
|
1623
|
+
csses.push(key + ': ' + style.css[key]);
|
1624
|
+
}
|
1591
1625
|
}
|
1592
1626
|
|
1593
|
-
|
1627
|
+
attributes = calculateObjectValue(this.options,
|
1628
|
+
this.options.rowAttributes, [item, i], attributes);
|
1594
1629
|
|
1595
|
-
if (
|
1596
|
-
|
1597
|
-
|
1630
|
+
if (attributes) {
|
1631
|
+
for (key in attributes) {
|
1632
|
+
htmlAttributes.push(sprintf('%s="%s"', key, escapeHTML(attributes[key])));
|
1633
|
+
}
|
1598
1634
|
}
|
1599
1635
|
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1636
|
+
if (item._data && !$.isEmptyObject(item._data)) {
|
1637
|
+
$.each(item._data, function(k, v) {
|
1638
|
+
// ignore data-index
|
1639
|
+
if (k === 'index') {
|
1640
|
+
return;
|
1641
|
+
}
|
1642
|
+
data_ += sprintf(' data-%s="%s"', k, v);
|
1643
|
+
});
|
1644
|
+
}
|
1645
|
+
|
1646
|
+
html.push('<tr',
|
1647
|
+
sprintf(' %s', htmlAttributes.join(' ')),
|
1648
|
+
sprintf(' id="%s"', $.isArray(item) ? undefined : item._id),
|
1649
|
+
sprintf(' class="%s"', style.classes || ($.isArray(item) ? undefined : item._class)),
|
1650
|
+
sprintf(' data-index="%s"', i),
|
1651
|
+
sprintf(' data-uniqueid="%s"', item[this.options.uniqueId]),
|
1652
|
+
sprintf('%s', data_),
|
1653
|
+
'>'
|
1654
|
+
);
|
1655
|
+
|
1656
|
+
if (this.options.cardView) {
|
1657
|
+
html.push(sprintf('<td colspan="%s"><div class="card-views">', this.header.fields.length));
|
1658
|
+
}
|
1659
|
+
|
1660
|
+
if (!this.options.cardView && this.options.detailView) {
|
1661
|
+
html.push('<td>',
|
1662
|
+
'<a class="detail-icon" href="#">',
|
1663
|
+
sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.detailOpen),
|
1664
|
+
'</a>',
|
1665
|
+
'</td>');
|
1666
|
+
}
|
1667
|
+
|
1668
|
+
$.each(this.header.fields, function(j, field) {
|
1669
|
+
var text = '',
|
1670
|
+
value_ = getItemField(item, field, that.options.escape),
|
1671
|
+
value = '',
|
1672
|
+
type = '',
|
1673
|
+
cellStyle = {},
|
1674
|
+
id_ = '',
|
1675
|
+
class_ = that.header.classes[j],
|
1605
1676
|
data_ = '',
|
1606
|
-
|
1607
|
-
|
1677
|
+
rowspan_ = '',
|
1678
|
+
colspan_ = '',
|
1679
|
+
title_ = '',
|
1680
|
+
column = that.columns[j];
|
1608
1681
|
|
1609
|
-
|
1682
|
+
if (that.fromHtml && typeof value_ === 'undefined') {
|
1683
|
+
return;
|
1684
|
+
}
|
1610
1685
|
|
1611
|
-
if (
|
1612
|
-
|
1613
|
-
csses.push(key + ': ' + style.css[key]);
|
1614
|
-
}
|
1686
|
+
if (!column.visible) {
|
1687
|
+
return;
|
1615
1688
|
}
|
1616
1689
|
|
1617
|
-
|
1618
|
-
|
1690
|
+
if (that.options.cardView && (!column.cardVisible)) {
|
1691
|
+
return;
|
1692
|
+
}
|
1619
1693
|
|
1620
|
-
if (
|
1621
|
-
|
1622
|
-
|
1694
|
+
if (column.escape) {
|
1695
|
+
value_ = escapeHTML(value_);
|
1696
|
+
}
|
1697
|
+
|
1698
|
+
style = sprintf('style="%s"', csses.concat(that.header.styles[j]).join('; '));
|
1699
|
+
|
1700
|
+
// handle td's id and class
|
1701
|
+
if (item['_' + field + '_id']) {
|
1702
|
+
id_ = sprintf(' id="%s"', item['_' + field + '_id']);
|
1703
|
+
}
|
1704
|
+
if (item['_' + field + '_class']) {
|
1705
|
+
class_ = sprintf(' class="%s"', item['_' + field + '_class']);
|
1706
|
+
}
|
1707
|
+
if (item['_' + field + '_rowspan']) {
|
1708
|
+
rowspan_ = sprintf(' rowspan="%s"', item['_' + field + '_rowspan']);
|
1709
|
+
}
|
1710
|
+
if (item['_' + field + '_colspan']) {
|
1711
|
+
colspan_ = sprintf(' colspan="%s"', item['_' + field + '_colspan']);
|
1712
|
+
}
|
1713
|
+
if (item['_' + field + '_title']) {
|
1714
|
+
title_ = sprintf(' title="%s"', item['_' + field + '_title']);
|
1715
|
+
}
|
1716
|
+
cellStyle = calculateObjectValue(that.header,
|
1717
|
+
that.header.cellStyles[j], [value_, item, i, field], cellStyle);
|
1718
|
+
if (cellStyle.classes) {
|
1719
|
+
class_ = sprintf(' class="%s"', cellStyle.classes);
|
1720
|
+
}
|
1721
|
+
if (cellStyle.css) {
|
1722
|
+
var csses_ = [];
|
1723
|
+
for (var key in cellStyle.css) {
|
1724
|
+
csses_.push(key + ': ' + cellStyle.css[key]);
|
1623
1725
|
}
|
1726
|
+
style = sprintf('style="%s"', csses_.concat(that.header.styles[j]).join('; '));
|
1624
1727
|
}
|
1625
1728
|
|
1626
|
-
|
1627
|
-
|
1729
|
+
value = calculateObjectValue(column,
|
1730
|
+
that.header.formatters[j], [value_, item, i], value_);
|
1731
|
+
|
1732
|
+
if (item['_' + field + '_data'] && !$.isEmptyObject(item['_' + field + '_data'])) {
|
1733
|
+
$.each(item['_' + field + '_data'], function(k, v) {
|
1628
1734
|
// ignore data-index
|
1629
1735
|
if (k === 'index') {
|
1630
1736
|
return;
|
@@ -1633,159 +1739,101 @@
|
|
1633
1739
|
});
|
1634
1740
|
}
|
1635
1741
|
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
sprintf(' class="%s"', style.classes || ($.isArray(item) ? undefined : item._class)),
|
1640
|
-
sprintf(' data-index="%s"', i),
|
1641
|
-
sprintf(' data-uniqueid="%s"', item[this.options.uniqueId]),
|
1642
|
-
sprintf('%s', data_),
|
1643
|
-
'>'
|
1644
|
-
);
|
1742
|
+
if (column.checkbox || column.radio) {
|
1743
|
+
type = column.checkbox ? 'checkbox' : type;
|
1744
|
+
type = column.radio ? 'radio' : type;
|
1645
1745
|
|
1646
|
-
|
1647
|
-
|
1648
|
-
|
1746
|
+
text = [sprintf(that.options.cardView ?
|
1747
|
+
'<div class="card-view %s">' : '<td class="bs-checkbox %s">', column['class'] || ''),
|
1748
|
+
'<input' +
|
1749
|
+
sprintf(' data-index="%s"', i) +
|
1750
|
+
sprintf(' name="%s"', that.options.selectItemName) +
|
1751
|
+
sprintf(' type="%s"', type) +
|
1752
|
+
sprintf(' value="%s"', item[that.options.idField]) +
|
1753
|
+
sprintf(' checked="%s"', value === true ||
|
1754
|
+
(value_ || value && value.checked) ? 'checked' : undefined) +
|
1755
|
+
sprintf(' disabled="%s"', !column.checkboxEnabled ||
|
1756
|
+
(value && value.disabled) ? 'disabled' : undefined) +
|
1757
|
+
' />',
|
1758
|
+
that.header.formatters[j] && typeof value === 'string' ? value : '',
|
1759
|
+
that.options.cardView ? '</div>' : '</td>'
|
1760
|
+
].join('');
|
1649
1761
|
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1762
|
+
item[that.header.stateField] = value === true || (value && value.checked);
|
1763
|
+
} else {
|
1764
|
+
value = typeof value === 'undefined' || value === null ?
|
1765
|
+
that.options.undefinedText : value;
|
1766
|
+
|
1767
|
+
text = that.options.cardView ? ['<div class="card-view">',
|
1768
|
+
that.options.showHeader ? sprintf('<span class="title" %s>%s</span>', style,
|
1769
|
+
getPropertyFromOther(that.columns, 'field', 'title', field)) : '',
|
1770
|
+
sprintf('<span class="value">%s</span>', value),
|
1771
|
+
'</div>'
|
1772
|
+
].join('') : [sprintf('<td%s %s %s %s %s %s %s>',
|
1773
|
+
id_, class_, style, data_, rowspan_, colspan_, title_),
|
1774
|
+
value,
|
1775
|
+
'</td>'
|
1776
|
+
].join('');
|
1657
1777
|
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
cellStyle = {},
|
1663
|
-
id_ = '',
|
1664
|
-
class_ = that.header.classes[j],
|
1665
|
-
data_ = '',
|
1666
|
-
rowspan_ = '',
|
1667
|
-
colspan_ = '',
|
1668
|
-
title_ = '',
|
1669
|
-
column = that.columns[j];
|
1670
|
-
|
1671
|
-
if (that.fromHtml && typeof value === 'undefined') {
|
1672
|
-
return;
|
1778
|
+
// Hide empty data on Card view when smartDisplay is set to true.
|
1779
|
+
if (that.options.cardView && that.options.smartDisplay && value === '') {
|
1780
|
+
// Should set a placeholder for event binding correct fieldIndex
|
1781
|
+
text = '<div class="card-view"></div>';
|
1673
1782
|
}
|
1783
|
+
}
|
1674
1784
|
|
1675
|
-
|
1676
|
-
|
1677
|
-
}
|
1785
|
+
html.push(text);
|
1786
|
+
});
|
1678
1787
|
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1788
|
+
if (this.options.cardView) {
|
1789
|
+
html.push('</div></td>');
|
1790
|
+
}
|
1791
|
+
html.push('</tr>');
|
1682
1792
|
|
1683
|
-
|
1793
|
+
return html.join(' ');
|
1794
|
+
};
|
1684
1795
|
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
if (item['_' + field + '_class']) {
|
1690
|
-
class_ = sprintf(' class="%s"', item['_' + field + '_class']);
|
1691
|
-
}
|
1692
|
-
if (item['_' + field + '_rowspan']) {
|
1693
|
-
rowspan_ = sprintf(' rowspan="%s"', item['_' + field + '_rowspan']);
|
1694
|
-
}
|
1695
|
-
if (item['_' + field + '_colspan']) {
|
1696
|
-
colspan_ = sprintf(' colspan="%s"', item['_' + field + '_colspan']);
|
1697
|
-
}
|
1698
|
-
if (item['_' + field + '_title']) {
|
1699
|
-
title_ = sprintf(' title="%s"', item['_' + field + '_title']);
|
1700
|
-
}
|
1701
|
-
cellStyle = calculateObjectValue(that.header,
|
1702
|
-
that.header.cellStyles[j], [value, item, i, field], cellStyle);
|
1703
|
-
if (cellStyle.classes) {
|
1704
|
-
class_ = sprintf(' class="%s"', cellStyle.classes);
|
1705
|
-
}
|
1706
|
-
if (cellStyle.css) {
|
1707
|
-
var csses_ = [];
|
1708
|
-
for (var key in cellStyle.css) {
|
1709
|
-
csses_.push(key + ': ' + cellStyle.css[key]);
|
1710
|
-
}
|
1711
|
-
style = sprintf('style="%s"', csses_.concat(that.header.styles[j]).join('; '));
|
1712
|
-
}
|
1796
|
+
BootstrapTable.prototype.initBody = function (fixedScroll) {
|
1797
|
+
var that = this,
|
1798
|
+
html = [],
|
1799
|
+
data = this.getData();
|
1713
1800
|
|
1714
|
-
|
1715
|
-
that.header.formatters[j], [value, item, i], value);
|
1801
|
+
this.trigger('pre-body', data);
|
1716
1802
|
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
return;
|
1722
|
-
}
|
1723
|
-
data_ += sprintf(' data-%s="%s"', k, v);
|
1724
|
-
});
|
1725
|
-
}
|
1803
|
+
this.$body = this.$el.find('>tbody');
|
1804
|
+
if (!this.$body.length) {
|
1805
|
+
this.$body = $('<tbody></tbody>').appendTo(this.$el);
|
1806
|
+
}
|
1726
1807
|
|
1727
|
-
|
1728
|
-
type = column.checkbox ? 'checkbox' : type;
|
1729
|
-
type = column.radio ? 'radio' : type;
|
1808
|
+
//Fix #389 Bootstrap-table-flatJSON is not working
|
1730
1809
|
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
sprintf(' name="%s"', that.options.selectItemName) +
|
1736
|
-
sprintf(' type="%s"', type) +
|
1737
|
-
sprintf(' value="%s"', item[that.options.idField]) +
|
1738
|
-
sprintf(' checked="%s"', value === true ||
|
1739
|
-
(value && value.checked) ? 'checked' : undefined) +
|
1740
|
-
sprintf(' disabled="%s"', !column.checkboxEnabled ||
|
1741
|
-
(value && value.disabled) ? 'disabled' : undefined) +
|
1742
|
-
' />',
|
1743
|
-
that.header.formatters[j] && typeof value === 'string' ? value : '',
|
1744
|
-
that.options.cardView ? '</div>' : '</td>'
|
1745
|
-
].join('');
|
1746
|
-
|
1747
|
-
item[that.header.stateField] = value === true || (value && value.checked);
|
1748
|
-
} else {
|
1749
|
-
value = typeof value === 'undefined' || value === null ?
|
1750
|
-
that.options.undefinedText : value;
|
1751
|
-
|
1752
|
-
text = that.options.cardView ? ['<div class="card-view">',
|
1753
|
-
that.options.showHeader ? sprintf('<span class="title" %s>%s</span>', style,
|
1754
|
-
getPropertyFromOther(that.columns, 'field', 'title', field)) : '',
|
1755
|
-
sprintf('<span class="value">%s</span>', value),
|
1756
|
-
'</div>'
|
1757
|
-
].join('') : [sprintf('<td%s %s %s %s %s %s %s>',
|
1758
|
-
id_, class_, style, data_, rowspan_, colspan_, title_),
|
1759
|
-
value,
|
1760
|
-
'</td>'
|
1761
|
-
].join('');
|
1762
|
-
|
1763
|
-
// Hide empty data on Card view when smartDisplay is set to true.
|
1764
|
-
if (that.options.cardView && that.options.smartDisplay && value === '') {
|
1765
|
-
// Should set a placeholder for event binding correct fieldIndex
|
1766
|
-
text = '<div class="card-view"></div>';
|
1767
|
-
}
|
1768
|
-
}
|
1810
|
+
if (!this.options.pagination || this.options.sidePagination === 'server') {
|
1811
|
+
this.pageFrom = 1;
|
1812
|
+
this.pageTo = data.length;
|
1813
|
+
}
|
1769
1814
|
|
1770
|
-
|
1771
|
-
|
1815
|
+
var trFragments = $(document.createDocumentFragment());
|
1816
|
+
var hasTr;
|
1772
1817
|
|
1773
|
-
|
1774
|
-
|
1818
|
+
for (var i = this.pageFrom - 1; i < this.pageTo; i++) {
|
1819
|
+
var item = data[i];
|
1820
|
+
var tr = this.initRow(item, i, data, trFragments);
|
1821
|
+
hasTr = hasTr || !!tr;
|
1822
|
+
if (tr&&tr!==true) {
|
1823
|
+
trFragments.append(tr);
|
1775
1824
|
}
|
1776
|
-
|
1777
|
-
html.push('</tr>');
|
1778
1825
|
}
|
1779
1826
|
|
1780
1827
|
// show no records
|
1781
|
-
if (!
|
1782
|
-
|
1828
|
+
if (!hasTr) {
|
1829
|
+
trFragments.append('<tr class="no-records-found">' +
|
1783
1830
|
sprintf('<td colspan="%s">%s</td>',
|
1784
|
-
|
1831
|
+
this.$header.find('th').length,
|
1832
|
+
this.options.formatNoMatches()) +
|
1785
1833
|
'</tr>');
|
1786
1834
|
}
|
1787
1835
|
|
1788
|
-
this.$body.html(
|
1836
|
+
this.$body.html(trFragments);
|
1789
1837
|
|
1790
1838
|
if (!fixedScroll) {
|
1791
1839
|
this.scrollTo(0);
|
@@ -1827,8 +1875,8 @@
|
|
1827
1875
|
// remove and update
|
1828
1876
|
if ($tr.next().is('tr.detail-view')) {
|
1829
1877
|
$this.find('i').attr('class', sprintf('%s %s', that.options.iconsPrefix, that.options.icons.detailOpen));
|
1830
|
-
$tr.next().remove();
|
1831
1878
|
that.trigger('collapse-row', index, row);
|
1879
|
+
$tr.next().remove();
|
1832
1880
|
} else {
|
1833
1881
|
$this.find('i').attr('class', sprintf('%s %s', that.options.iconsPrefix, that.options.icons.detailClose));
|
1834
1882
|
$tr.after(sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>', $tr.find('td').length));
|
@@ -1840,6 +1888,7 @@
|
|
1840
1888
|
that.trigger('expand-row', index, row, $element);
|
1841
1889
|
}
|
1842
1890
|
that.resetView();
|
1891
|
+
return false;
|
1843
1892
|
});
|
1844
1893
|
|
1845
1894
|
this.$selectItem = this.$body.find(sprintf('[name="%s"]', this.options.selectItemName));
|
@@ -2041,6 +2090,7 @@
|
|
2041
2090
|
row[that.header.stateField] = false;
|
2042
2091
|
}
|
2043
2092
|
});
|
2093
|
+
this.initHiddenRows();
|
2044
2094
|
};
|
2045
2095
|
|
2046
2096
|
BootstrapTable.prototype.trigger = function (name) {
|
@@ -2257,17 +2307,6 @@
|
|
2257
2307
|
}
|
2258
2308
|
};
|
2259
2309
|
|
2260
|
-
BootstrapTable.prototype.toggleRow = function (index, uniqueId, visible) {
|
2261
|
-
if (index === -1) {
|
2262
|
-
return;
|
2263
|
-
}
|
2264
|
-
|
2265
|
-
this.$body.find(typeof index !== 'undefined' ?
|
2266
|
-
sprintf('tr[data-index="%s"]', index) :
|
2267
|
-
sprintf('tr[data-uniqueid="%s"]', uniqueId))
|
2268
|
-
[visible ? 'show' : 'hide']();
|
2269
|
-
};
|
2270
|
-
|
2271
2310
|
BootstrapTable.prototype.getVisibleFields = function () {
|
2272
2311
|
var that = this,
|
2273
2312
|
visibleFields = [];
|
@@ -2297,8 +2336,8 @@
|
|
2297
2336
|
this.$selectItem.length === this.$selectItem.filter(':checked').length);
|
2298
2337
|
|
2299
2338
|
if (this.options.height) {
|
2300
|
-
var toolbarHeight =
|
2301
|
-
paginationHeight =
|
2339
|
+
var toolbarHeight = this.$toolbar.outerHeight(true),
|
2340
|
+
paginationHeight = this.$pagination.outerHeight(true),
|
2302
2341
|
height = this.options.height - toolbarHeight - paginationHeight;
|
2303
2342
|
|
2304
2343
|
this.$tableContainer.css('height', height + 'px');
|
@@ -2345,7 +2384,7 @@
|
|
2345
2384
|
|
2346
2385
|
// #431: support pagination
|
2347
2386
|
if (this.options.sidePagination === 'server') {
|
2348
|
-
this.options.totalRows = data.
|
2387
|
+
this.options.totalRows = data[this.options.totalField];
|
2349
2388
|
fixedScroll = data.fixedScroll;
|
2350
2389
|
data = data[this.options.dataField];
|
2351
2390
|
} else if (!$.isArray(data)) { // support fixedScroll
|
@@ -2391,6 +2430,9 @@
|
|
2391
2430
|
}
|
2392
2431
|
if ($.inArray(row[params.field], params.values) !== -1) {
|
2393
2432
|
this.options.data.splice(i, 1);
|
2433
|
+
if (this.options.sidePagination === 'server') {
|
2434
|
+
this.options.totalRows -= 1;
|
2435
|
+
}
|
2394
2436
|
}
|
2395
2437
|
}
|
2396
2438
|
|
@@ -2486,6 +2528,7 @@
|
|
2486
2528
|
});
|
2487
2529
|
|
2488
2530
|
this.initSearch();
|
2531
|
+
this.initPagination();
|
2489
2532
|
this.initSort();
|
2490
2533
|
this.initBody(true);
|
2491
2534
|
};
|
@@ -2513,32 +2556,57 @@
|
|
2513
2556
|
});
|
2514
2557
|
|
2515
2558
|
this.initSearch();
|
2559
|
+
this.initPagination();
|
2516
2560
|
this.initSort();
|
2517
2561
|
this.initBody(true);
|
2518
2562
|
};
|
2519
2563
|
|
2564
|
+
BootstrapTable.prototype.initHiddenRows = function () {
|
2565
|
+
this.hiddenRows = [];
|
2566
|
+
};
|
2567
|
+
|
2520
2568
|
BootstrapTable.prototype.showRow = function (params) {
|
2521
|
-
|
2522
|
-
return;
|
2523
|
-
}
|
2524
|
-
this.toggleRow(params.index, params.uniqueId, true);
|
2569
|
+
this.toggleRow(params, true);
|
2525
2570
|
};
|
2526
2571
|
|
2527
2572
|
BootstrapTable.prototype.hideRow = function (params) {
|
2528
|
-
|
2573
|
+
this.toggleRow(params, false);
|
2574
|
+
};
|
2575
|
+
|
2576
|
+
BootstrapTable.prototype.toggleRow = function (params, visible) {
|
2577
|
+
var row, index;
|
2578
|
+
|
2579
|
+
if (params.hasOwnProperty('index')) {
|
2580
|
+
row = this.getData()[params.index];
|
2581
|
+
} else if (params.hasOwnProperty('uniqueId')) {
|
2582
|
+
row = this.getRowByUniqueId(params.uniqueId);
|
2583
|
+
}
|
2584
|
+
|
2585
|
+
if (!row) {
|
2529
2586
|
return;
|
2530
2587
|
}
|
2531
|
-
|
2588
|
+
|
2589
|
+
index = $.inArray(row, this.hiddenRows);
|
2590
|
+
|
2591
|
+
if (!visible && index === -1) {
|
2592
|
+
this.hiddenRows.push(row);
|
2593
|
+
} else if (visible && index > -1) {
|
2594
|
+
this.hiddenRows.splice(index, 1);
|
2595
|
+
}
|
2596
|
+
this.initBody(true);
|
2532
2597
|
};
|
2533
2598
|
|
2534
|
-
BootstrapTable.prototype.
|
2535
|
-
var
|
2536
|
-
|
2537
|
-
|
2538
|
-
|
2539
|
-
|
2599
|
+
BootstrapTable.prototype.getHiddenRows = function (show) {
|
2600
|
+
var that = this,
|
2601
|
+
data = this.getData(),
|
2602
|
+
rows = [];
|
2603
|
+
|
2604
|
+
$.each(data, function (i, row) {
|
2605
|
+
if ($.inArray(row, that.hiddenRows) > -1) {
|
2606
|
+
rows.push(row);
|
2540
2607
|
}
|
2541
|
-
}
|
2608
|
+
});
|
2609
|
+
this.hiddenRows = rows;
|
2542
2610
|
return rows;
|
2543
2611
|
};
|
2544
2612
|
|
@@ -2593,7 +2661,8 @@
|
|
2593
2661
|
var that = this;
|
2594
2662
|
|
2595
2663
|
return $.grep(this.options.data, function (row) {
|
2596
|
-
|
2664
|
+
// fix #2424: from html with checkbox
|
2665
|
+
return row[that.header.stateField] === true;
|
2597
2666
|
});
|
2598
2667
|
};
|
2599
2668
|
|
@@ -2718,7 +2787,13 @@
|
|
2718
2787
|
|
2719
2788
|
BootstrapTable.prototype.refresh = function (params) {
|
2720
2789
|
if (params && params.url) {
|
2721
|
-
this.options.
|
2790
|
+
this.options.url = params.url;
|
2791
|
+
}
|
2792
|
+
if (params && params.pageNumber) {
|
2793
|
+
this.options.pageNumber = params.pageNumber;
|
2794
|
+
}
|
2795
|
+
if (params && params.pageSize) {
|
2796
|
+
this.options.pageSize = params.pageSize;
|
2722
2797
|
}
|
2723
2798
|
this.initServer(params && params.silent,
|
2724
2799
|
params && params.query, params && params.url);
|
@@ -2937,7 +3012,7 @@
|
|
2937
3012
|
'getSelections', 'getAllSelections', 'getData',
|
2938
3013
|
'load', 'append', 'prepend', 'remove', 'removeAll',
|
2939
3014
|
'insertRow', 'updateRow', 'updateCell', 'updateByUniqueId', 'removeByUniqueId',
|
2940
|
-
'getRowByUniqueId', 'showRow', 'hideRow', '
|
3015
|
+
'getRowByUniqueId', 'showRow', 'hideRow', 'getHiddenRows',
|
2941
3016
|
'mergeCells',
|
2942
3017
|
'checkAll', 'uncheckAll', 'checkInvert',
|
2943
3018
|
'check', 'uncheck',
|