bootstrap-table-rails 1.8.2.1 → 1.9.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 +4 -1
- data/lib/bootstrap-table-rails/version.rb +1 -1
- data/vendor/assets/javascripts/bootstrap-table-locale-all.js +84 -0
- data/vendor/assets/javascripts/bootstrap-table.js +203 -64
- data/vendor/assets/javascripts/extensions/bootstrap-table-accent-neutralise.js +182 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-cookie.js +16 -3
- data/vendor/assets/javascripts/extensions/bootstrap-table-editable.js +5 -5
- data/vendor/assets/javascripts/extensions/bootstrap-table-export.js +5 -2
- data/vendor/assets/javascripts/extensions/bootstrap-table-filter-control.js +45 -67
- data/vendor/assets/javascripts/extensions/bootstrap-table-group-by.js +67 -52
- data/vendor/assets/javascripts/extensions/bootstrap-table-mobile.js +1 -14
- data/vendor/assets/javascripts/extensions/bootstrap-table-multiple-search.js +67 -0
- data/vendor/assets/javascripts/extensions/bootstrap-table-reorder-columns.js +6 -15
- data/vendor/assets/javascripts/extensions/bootstrap-table-toolbar.js +15 -49
- data/vendor/assets/javascripts/locale/bootstrap-table-af-ZA.js +40 -0
- data/vendor/assets/javascripts/locale/bootstrap-table-et-EE.js +43 -0
- metadata +6 -4
- data/bootstrap-table-rails-1.8.2.gem +0 -0
- data/vendor/assets/javascripts/bootstrap-table-all.js +0 -5177
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 188a4c8cd1cc66093bd4bde072de922ccb2843e6
|
4
|
+
data.tar.gz: 44a42b9fd49db52766748b6d67389340d8848c23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ad963230c5845be7b2ea5236ddced1f1679448990675f0fd7a34d53fcda56e5789d3cef732a7398f36463924984d9daf8e890d7cbe4c99e9090c5ef16b7dcc9
|
7
|
+
data.tar.gz: 889ebafec39cf2eaf5a0a6f239e521f206e5f1e278d171060177b847bd26f2984cbf93e6814ee88a74ad2e72f4f75f38b52a1ca9625f53a4ee4db920365fadd5
|
data/README.md
CHANGED
@@ -35,10 +35,10 @@ Dir tree:
|
|
35
35
|
vendor/
|
36
36
|
└── assets
|
37
37
|
├── javascripts
|
38
|
-
│ ├── bootstrap-table-all.js
|
39
38
|
│ ├── bootstrap-table-locale-all.js
|
40
39
|
│ ├── bootstrap-table.js
|
41
40
|
│ ├── extensions
|
41
|
+
│ │ ├── bootstrap-table-accent-neutralise.js
|
42
42
|
│ │ ├── bootstrap-table-angular.js
|
43
43
|
│ │ ├── bootstrap-table-cookie.js
|
44
44
|
│ │ ├── bootstrap-table-editable.js
|
@@ -49,6 +49,7 @@ vendor/
|
|
49
49
|
│ │ ├── bootstrap-table-group-by.js
|
50
50
|
│ │ ├── bootstrap-table-key-events.js
|
51
51
|
│ │ ├── bootstrap-table-mobile.js
|
52
|
+
│ │ ├── bootstrap-table-multiple-search.js
|
52
53
|
│ │ ├── bootstrap-table-multiple-sort.js
|
53
54
|
│ │ ├── bootstrap-table-natural-sorting.js
|
54
55
|
│ │ ├── bootstrap-table-reorder-columns.js
|
@@ -56,6 +57,7 @@ vendor/
|
|
56
57
|
│ │ ├── bootstrap-table-resizable.js
|
57
58
|
│ │ └── bootstrap-table-toolbar.js
|
58
59
|
│ └── locale
|
60
|
+
│ ├── bootstrap-table-af-ZA.js
|
59
61
|
│ ├── bootstrap-table-ar-SA.js
|
60
62
|
│ ├── bootstrap-table-ca-ES.js
|
61
63
|
│ ├── bootstrap-table-cs-CZ.js
|
@@ -69,6 +71,7 @@ vendor/
|
|
69
71
|
│ ├── bootstrap-table-es-MX.js
|
70
72
|
│ ├── bootstrap-table-es-NI.js
|
71
73
|
│ ├── bootstrap-table-es-SP.js
|
74
|
+
│ ├── bootstrap-table-et-EE.js
|
72
75
|
│ ├── bootstrap-table-fa-IR.js
|
73
76
|
│ ├── bootstrap-table-fr-BE.js
|
74
77
|
│ ├── bootstrap-table-fr-FR.js
|
@@ -1,3 +1,44 @@
|
|
1
|
+
/**
|
2
|
+
* Bootstrap Table Afrikaans translation
|
3
|
+
* Author: Phillip Kruger <phillip.kruger@gmail.com>
|
4
|
+
*/
|
5
|
+
(function ($) {
|
6
|
+
'use strict';
|
7
|
+
|
8
|
+
$.fn.bootstrapTable.locales['af-ZA'] = {
|
9
|
+
formatLoadingMessage: function () {
|
10
|
+
return 'Besig om te laai, wag asseblief ...';
|
11
|
+
},
|
12
|
+
formatRecordsPerPage: function (pageNumber) {
|
13
|
+
return pageNumber + ' rekords per bladsy';
|
14
|
+
},
|
15
|
+
formatShowingRows: function (pageFrom, pageTo, totalRows) {
|
16
|
+
return 'Resultate ' + pageFrom + ' tot ' + pageTo + ' van ' + totalRows + ' rye';
|
17
|
+
},
|
18
|
+
formatSearch: function () {
|
19
|
+
return 'Soek';
|
20
|
+
},
|
21
|
+
formatNoMatches: function () {
|
22
|
+
return 'Geen rekords gevind nie';
|
23
|
+
},
|
24
|
+
formatPaginationSwitch: function () {
|
25
|
+
return 'Wys/verberg bladsy nummering';
|
26
|
+
},
|
27
|
+
formatRefresh: function () {
|
28
|
+
return 'Herlaai';
|
29
|
+
},
|
30
|
+
formatToggle: function () {
|
31
|
+
return 'Wissel';
|
32
|
+
},
|
33
|
+
formatColumns: function () {
|
34
|
+
return 'Kolomme';
|
35
|
+
}
|
36
|
+
};
|
37
|
+
|
38
|
+
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['af-ZA']);
|
39
|
+
|
40
|
+
})(jQuery);
|
41
|
+
|
1
42
|
/**
|
2
43
|
* Bootstrap Table English translation
|
3
44
|
* Author: Zhixin Wen<wenzhixin2010@gmail.com>
|
@@ -504,6 +545,49 @@
|
|
504
545
|
|
505
546
|
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['es-SP']);
|
506
547
|
|
548
|
+
})(jQuery);
|
549
|
+
/**
|
550
|
+
* Bootstrap Table Estonian translation
|
551
|
+
* Author: kristjan@logist.it>
|
552
|
+
*/
|
553
|
+
(function ($) {
|
554
|
+
'use strict';
|
555
|
+
|
556
|
+
$.fn.bootstrapTable.locales['et-EE'] = {
|
557
|
+
formatLoadingMessage: function () {
|
558
|
+
return 'Päring käib, palun oota...';
|
559
|
+
},
|
560
|
+
formatRecordsPerPage: function (pageNumber) {
|
561
|
+
return pageNumber + ' rida lehe kohta';
|
562
|
+
},
|
563
|
+
formatShowingRows: function (pageFrom, pageTo, totalRows) {
|
564
|
+
return 'Näitan tulemusi ' + pageFrom + ' kuni ' + pageTo + ' - kokku ' + totalRows + ' tulemust';
|
565
|
+
},
|
566
|
+
formatSearch: function () {
|
567
|
+
return 'Otsi';
|
568
|
+
},
|
569
|
+
formatNoMatches: function () {
|
570
|
+
return 'Päringu tingimustele ei vastanud ühtegi tulemust';
|
571
|
+
},
|
572
|
+
formatPaginationSwitch: function () {
|
573
|
+
return 'Näita/Peida lehtedeks jagamine';
|
574
|
+
},
|
575
|
+
formatRefresh: function () {
|
576
|
+
return 'Värskenda';
|
577
|
+
},
|
578
|
+
formatToggle: function () {
|
579
|
+
return 'Lülita';
|
580
|
+
},
|
581
|
+
formatColumns: function () {
|
582
|
+
return 'Veerud';
|
583
|
+
},
|
584
|
+
formatAllRows: function () {
|
585
|
+
return 'Kõik';
|
586
|
+
}
|
587
|
+
};
|
588
|
+
|
589
|
+
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['et-EE']);
|
590
|
+
|
507
591
|
})(jQuery);
|
508
592
|
/**
|
509
593
|
* Bootstrap Table Persian translation
|
@@ -1,10 +1,10 @@
|
|
1
1
|
/**
|
2
2
|
* @author zhixin wen <wenzhixin2010@gmail.com>
|
3
|
-
* version: 1.
|
3
|
+
* version: 1.9.0
|
4
4
|
* https://github.com/wenzhixin/bootstrap-table/
|
5
5
|
*/
|
6
6
|
|
7
|
-
!
|
7
|
+
!function ($) {
|
8
8
|
'use strict';
|
9
9
|
|
10
10
|
// TOOLS DEFINITION
|
@@ -95,7 +95,7 @@
|
|
95
95
|
}
|
96
96
|
}
|
97
97
|
}
|
98
|
-
}
|
98
|
+
};
|
99
99
|
|
100
100
|
var getScrollBarWidth = function () {
|
101
101
|
if (cachedWidth === null) {
|
@@ -156,7 +156,7 @@
|
|
156
156
|
|
157
157
|
if (compareLength) {
|
158
158
|
// If number of properties is different, objects are not equivalent
|
159
|
-
if (objectAProperties.length
|
159
|
+
if (objectAProperties.length !== objectBProperties.length) {
|
160
160
|
return false;
|
161
161
|
}
|
162
162
|
}
|
@@ -211,6 +211,19 @@
|
|
211
211
|
return dataAttr;
|
212
212
|
};
|
213
213
|
|
214
|
+
var getItemField = function (item, field) {
|
215
|
+
var value = item;
|
216
|
+
|
217
|
+
if (typeof field !== 'string' || item.hasOwnProperty(field)) {
|
218
|
+
return item[field];
|
219
|
+
}
|
220
|
+
var props = field.split('.');
|
221
|
+
for (var p in props) {
|
222
|
+
value = value[props[p]];
|
223
|
+
}
|
224
|
+
return value;
|
225
|
+
};
|
226
|
+
|
214
227
|
// BOOTSTRAP TABLE CLASS DEFINITION
|
215
228
|
// ======================
|
216
229
|
|
@@ -234,6 +247,7 @@
|
|
234
247
|
striped: false,
|
235
248
|
columns: [[]],
|
236
249
|
data: [],
|
250
|
+
dataField: 'rows',
|
237
251
|
method: 'get',
|
238
252
|
url: undefined,
|
239
253
|
ajax: undefined,
|
@@ -493,6 +507,7 @@
|
|
493
507
|
this.initToolbar();
|
494
508
|
this.initPagination();
|
495
509
|
this.initBody();
|
510
|
+
this.initSearchText();
|
496
511
|
this.initServer();
|
497
512
|
};
|
498
513
|
|
@@ -513,26 +528,26 @@
|
|
513
528
|
}
|
514
529
|
}
|
515
530
|
};
|
516
|
-
|
531
|
+
|
517
532
|
BootstrapTable.prototype.initContainer = function () {
|
518
533
|
this.$container = $([
|
519
534
|
'<div class="bootstrap-table">',
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
535
|
+
'<div class="fixed-table-toolbar"></div>',
|
536
|
+
this.options.paginationVAlign === 'top' || this.options.paginationVAlign === 'both' ?
|
537
|
+
'<div class="fixed-table-pagination" style="clear: both;"></div>' :
|
538
|
+
'',
|
539
|
+
'<div class="fixed-table-container">',
|
540
|
+
'<div class="fixed-table-header"><table></table></div>',
|
541
|
+
'<div class="fixed-table-body">',
|
542
|
+
'<div class="fixed-table-loading">',
|
543
|
+
this.options.formatLoadingMessage(),
|
544
|
+
'</div>',
|
545
|
+
'</div>',
|
546
|
+
'<div class="fixed-table-footer"><table><tr></tr></table></div>',
|
547
|
+
this.options.paginationVAlign === 'bottom' || this.options.paginationVAlign === 'both' ?
|
533
548
|
'<div class="fixed-table-pagination"></div>' :
|
534
549
|
'',
|
535
|
-
|
550
|
+
'</div>',
|
536
551
|
'</div>'
|
537
552
|
].join(''));
|
538
553
|
|
@@ -677,7 +692,8 @@
|
|
677
692
|
halign = sprintf('text-align: %s; ', column.halign ? column.halign : column.align);
|
678
693
|
align = sprintf('text-align: %s; ', column.align);
|
679
694
|
style = sprintf('vertical-align: %s; ', column.valign);
|
680
|
-
style += sprintf('width: %s
|
695
|
+
style += sprintf('width: %s; ', (column.checkbox || column.radio) && !width ?
|
696
|
+
'36px' : (width ? width + unitWidth : undefined));
|
681
697
|
|
682
698
|
if (typeof column.fieldIndex !== 'undefined') {
|
683
699
|
that.header.fields[column.fieldIndex] = column.field;
|
@@ -703,12 +719,13 @@
|
|
703
719
|
|
704
720
|
html.push('<th' + sprintf(' title="%s"', column.titleTooltip),
|
705
721
|
column.checkbox || column.radio ?
|
706
|
-
|
707
|
-
|
722
|
+
sprintf(' class="bs-checkbox %s"', column['class'] || '') :
|
723
|
+
class_,
|
708
724
|
sprintf(' style="%s"', halign + style),
|
709
725
|
sprintf(' rowspan="%s"', column.rowspan),
|
710
726
|
sprintf(' colspan="%s"', column.colspan),
|
711
727
|
sprintf(' data-field="%s"', column.field),
|
728
|
+
"tabindex='0'",
|
712
729
|
'>');
|
713
730
|
|
714
731
|
html.push(sprintf('<div class="th-inner %s">', that.options.sortable && column.sortable ?
|
@@ -747,6 +764,15 @@
|
|
747
764
|
}
|
748
765
|
});
|
749
766
|
|
767
|
+
this.$header.children().children().off('keypress').on('keypress', function (event) {
|
768
|
+
if (that.options.sortable && $(this).data().sortable) {
|
769
|
+
var code = event.keyCode || event.which;
|
770
|
+
if (code == 13) { //Enter keycode
|
771
|
+
that.onSort(event);
|
772
|
+
}
|
773
|
+
}
|
774
|
+
});
|
775
|
+
|
750
776
|
if (!this.options.showHeader || this.options.cardView) {
|
751
777
|
this.$header.hide();
|
752
778
|
this.$tableHeader.hide();
|
@@ -814,8 +840,8 @@
|
|
814
840
|
if (that.header.sortNames[index]) {
|
815
841
|
name = that.header.sortNames[index];
|
816
842
|
}
|
817
|
-
var aa = a
|
818
|
-
bb = b
|
843
|
+
var aa = getItemField(a, name),
|
844
|
+
bb = getItemField(b, name),
|
819
845
|
value = calculateObjectValue(that.header, that.header.sorters[index], [aa, bb]);
|
820
846
|
|
821
847
|
if (value !== undefined) {
|
@@ -860,7 +886,7 @@
|
|
860
886
|
};
|
861
887
|
|
862
888
|
BootstrapTable.prototype.onSort = function (event) {
|
863
|
-
var $this = $(event.currentTarget).parent(),
|
889
|
+
var $this = event.type === "keypress" ? $(event.currentTarget) : $(event.currentTarget).parent(),
|
864
890
|
$this_ = this.$header.find('th').eq($this.index());
|
865
891
|
|
866
892
|
this.$header.add(this.$header_).find('span.order').remove();
|
@@ -1022,11 +1048,6 @@
|
|
1022
1048
|
that.onSearch(event);
|
1023
1049
|
}, that.options.searchTimeOut);
|
1024
1050
|
});
|
1025
|
-
|
1026
|
-
if (this.options.searchText !== '') {
|
1027
|
-
$search.val(this.options.searchText);
|
1028
|
-
that.onSearch({currentTarget: $search});
|
1029
|
-
}
|
1030
1051
|
}
|
1031
1052
|
};
|
1032
1053
|
|
@@ -1087,7 +1108,7 @@
|
|
1087
1108
|
}
|
1088
1109
|
} else {
|
1089
1110
|
if ((value + '').toLowerCase().indexOf(s) !== -1) {
|
1090
|
-
|
1111
|
+
return true;
|
1091
1112
|
}
|
1092
1113
|
}
|
1093
1114
|
}
|
@@ -1160,10 +1181,10 @@
|
|
1160
1181
|
var pageNumber = [
|
1161
1182
|
sprintf('<span class="btn-group %s">',
|
1162
1183
|
this.options.paginationVAlign === 'top' || this.options.paginationVAlign === 'both' ?
|
1163
|
-
|
1184
|
+
'dropdown' : 'dropup'),
|
1164
1185
|
'<button type="button" class="btn btn-default ' +
|
1165
|
-
|
1166
|
-
|
1186
|
+
(this.options.iconSize === undefined ? '' : ' btn-' + this.options.iconSize) +
|
1187
|
+
' dropdown-toggle" data-toggle="dropdown">',
|
1167
1188
|
'<span class="page-size">',
|
1168
1189
|
$allSelected ? this.options.formatAllRows() : this.options.pageSize,
|
1169
1190
|
'</span>',
|
@@ -1410,7 +1431,7 @@
|
|
1410
1431
|
|
1411
1432
|
$.each(this.header.fields, function (j, field) {
|
1412
1433
|
var text = '',
|
1413
|
-
value = item
|
1434
|
+
value = getItemField(item, field),
|
1414
1435
|
type = '',
|
1415
1436
|
cellStyle = {},
|
1416
1437
|
id_ = '',
|
@@ -1477,10 +1498,11 @@
|
|
1477
1498
|
sprintf(' type="%s"', type) +
|
1478
1499
|
sprintf(' value="%s"', item[that.options.idField]) +
|
1479
1500
|
sprintf(' checked="%s"', value === true ||
|
1480
|
-
|
1501
|
+
(value && value.checked) ? 'checked' : undefined) +
|
1481
1502
|
sprintf(' disabled="%s"', !column.checkboxEnabled ||
|
1482
|
-
|
1503
|
+
(value && value.disabled) ? 'disabled' : undefined) +
|
1483
1504
|
' />',
|
1505
|
+
that.header.formatters[j] && typeof value === 'string' ? value : '',
|
1484
1506
|
that.options.cardView ? '</div>' : '</td>'
|
1485
1507
|
].join('');
|
1486
1508
|
|
@@ -1536,8 +1558,8 @@
|
|
1536
1558
|
item = that.data[$tr.data('index')],
|
1537
1559
|
index = $td[0].cellIndex,
|
1538
1560
|
field = that.header.fields[that.options.detailView && !that.options.cardView ? index - 1 : index],
|
1539
|
-
|
1540
|
-
value = item
|
1561
|
+
column = that.columns[getFieldIndex(that.columns, field)],
|
1562
|
+
value = getItemField(item, field);
|
1541
1563
|
|
1542
1564
|
if ($td.find('.detail-icon').length) {
|
1543
1565
|
return;
|
@@ -1547,7 +1569,7 @@
|
|
1547
1569
|
that.trigger(e.type === 'click' ? 'click-row' : 'dbl-click-row', item, $tr);
|
1548
1570
|
|
1549
1571
|
// if click to select - then trigger the checkbox/radio click
|
1550
|
-
if (e.type === 'click' && that.options.clickToSelect &&
|
1572
|
+
if (e.type === 'click' && that.options.clickToSelect && column.clickToSelect) {
|
1551
1573
|
var $selectItem = $tr.find(sprintf('[name="%s"]', that.options.selectItemName));
|
1552
1574
|
if ($selectItem.length) {
|
1553
1575
|
$selectItem[0].click(); // #144: .trigger('click') bug
|
@@ -1580,8 +1602,15 @@
|
|
1580
1602
|
this.$selectItem.off('click').on('click', function (event) {
|
1581
1603
|
event.stopImmediatePropagation();
|
1582
1604
|
|
1583
|
-
var
|
1584
|
-
|
1605
|
+
var $this = $(this),
|
1606
|
+
checked = $this.prop('checked'),
|
1607
|
+
row = that.data[$this.data('index')];
|
1608
|
+
|
1609
|
+
if (that.options.maintainSelected && $(this).is(':radio')) {
|
1610
|
+
$.each(that.options.data, function (i, row) {
|
1611
|
+
row[that.header.stateField] = false;
|
1612
|
+
});
|
1613
|
+
}
|
1585
1614
|
|
1586
1615
|
row[that.header.stateField] = checked;
|
1587
1616
|
|
@@ -1593,7 +1622,7 @@
|
|
1593
1622
|
}
|
1594
1623
|
|
1595
1624
|
that.updateSelected();
|
1596
|
-
that.trigger(checked ? 'check' : 'uncheck', row);
|
1625
|
+
that.trigger(checked ? 'check' : 'uncheck', row, $this);
|
1597
1626
|
});
|
1598
1627
|
|
1599
1628
|
$.each(this.header.events, function (i, events) {
|
@@ -1700,7 +1729,7 @@
|
|
1700
1729
|
that.trigger('load-success', res);
|
1701
1730
|
},
|
1702
1731
|
error: function (res) {
|
1703
|
-
that.trigger('load-error', res.status);
|
1732
|
+
that.trigger('load-error', res.status, res);
|
1704
1733
|
},
|
1705
1734
|
complete: function () {
|
1706
1735
|
if (!silent) {
|
@@ -1716,6 +1745,16 @@
|
|
1716
1745
|
}
|
1717
1746
|
};
|
1718
1747
|
|
1748
|
+
BootstrapTable.prototype.initSearchText = function () {
|
1749
|
+
if (this.options.search) {
|
1750
|
+
if (this.options.searchText !== '') {
|
1751
|
+
var $search = this.$toolbar.find('.search input');
|
1752
|
+
$search.val(this.options.searchText);
|
1753
|
+
this.onSearch({currentTarget: $search});
|
1754
|
+
}
|
1755
|
+
}
|
1756
|
+
};
|
1757
|
+
|
1719
1758
|
BootstrapTable.prototype.getCaret = function () {
|
1720
1759
|
var that = this;
|
1721
1760
|
|
@@ -1725,7 +1764,8 @@
|
|
1725
1764
|
};
|
1726
1765
|
|
1727
1766
|
BootstrapTable.prototype.updateSelected = function () {
|
1728
|
-
var checkAll = this.$selectItem.filter(':enabled').length
|
1767
|
+
var checkAll = this.$selectItem.filter(':enabled').length &&
|
1768
|
+
this.$selectItem.filter(':enabled').length ===
|
1729
1769
|
this.$selectItem.filter(':enabled').filter(':checked').length;
|
1730
1770
|
|
1731
1771
|
this.$selectAll.add(this.$selectAll_).prop('checked', checkAll);
|
@@ -1776,7 +1816,9 @@
|
|
1776
1816
|
BootstrapTable.prototype.fitHeader = function () {
|
1777
1817
|
var that = this,
|
1778
1818
|
fixedBody,
|
1779
|
-
scrollWidth
|
1819
|
+
scrollWidth,
|
1820
|
+
focused,
|
1821
|
+
focusedTemp;
|
1780
1822
|
|
1781
1823
|
if (that.$el.is(':hidden')) {
|
1782
1824
|
that.timeoutId_ = setTimeout($.proxy(that.fitHeader, that), 100);
|
@@ -1785,10 +1827,25 @@
|
|
1785
1827
|
fixedBody = this.$tableBody.get(0);
|
1786
1828
|
|
1787
1829
|
scrollWidth = fixedBody.scrollWidth > fixedBody.clientWidth &&
|
1788
|
-
|
1830
|
+
fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ?
|
1789
1831
|
getScrollBarWidth() : 0;
|
1790
1832
|
|
1791
1833
|
this.$el.css('margin-top', -this.$header.outerHeight());
|
1834
|
+
|
1835
|
+
focused = $(':focus');
|
1836
|
+
if (focused.length > 0) {
|
1837
|
+
var $th = focused.parents('th');
|
1838
|
+
if ($th.length > 0) {
|
1839
|
+
var dataField = $th.attr('data-field');
|
1840
|
+
if (dataField !== undefined) {
|
1841
|
+
var $headerTh = this.$header.find("[data-field='" + dataField + "']");
|
1842
|
+
if ($headerTh.length > 0) {
|
1843
|
+
$headerTh.find(":input").addClass("focus-temp");
|
1844
|
+
}
|
1845
|
+
}
|
1846
|
+
}
|
1847
|
+
}
|
1848
|
+
|
1792
1849
|
this.$header_ = this.$header.clone(true, true);
|
1793
1850
|
this.$selectAll_ = this.$header_.find('[name="btSelectAll"]');
|
1794
1851
|
this.$tableHeader.css({
|
@@ -1797,6 +1854,13 @@
|
|
1797
1854
|
.html('').attr('class', this.$el.attr('class'))
|
1798
1855
|
.append(this.$header_);
|
1799
1856
|
|
1857
|
+
|
1858
|
+
focusedTemp = $('.focus-temp:visible:eq(0)');
|
1859
|
+
if (focusedTemp.length > 0) {
|
1860
|
+
focusedTemp.focus();
|
1861
|
+
this.$header.find('.focus-temp').removeClass('focus-temp');
|
1862
|
+
}
|
1863
|
+
|
1800
1864
|
// fix bug: $.data() is not working as expected after $.append()
|
1801
1865
|
this.$header.find('th[data-field]').each(function (i) {
|
1802
1866
|
that.$header_.find(sprintf('th[data-field="%s"]', $(this).data('field'))).data($(this).data());
|
@@ -1892,8 +1956,8 @@
|
|
1892
1956
|
scrollWidth = elWidth > this.$tableBody.width() ? getScrollBarWidth() : 0;
|
1893
1957
|
|
1894
1958
|
this.$tableFooter.css({
|
1895
|
-
|
1896
|
-
|
1959
|
+
'margin-right': scrollWidth
|
1960
|
+
}).find('table').css('width', elWidth)
|
1897
1961
|
.attr('class', this.$el.attr('class'));
|
1898
1962
|
|
1899
1963
|
$footerTd = this.$tableFooter.find('td');
|
@@ -1928,12 +1992,15 @@
|
|
1928
1992
|
}
|
1929
1993
|
};
|
1930
1994
|
|
1931
|
-
BootstrapTable.prototype.toggleRow = function (index,
|
1995
|
+
BootstrapTable.prototype.toggleRow = function (index, uniqueId, visible) {
|
1932
1996
|
if (index === -1) {
|
1933
1997
|
return;
|
1934
1998
|
}
|
1935
1999
|
|
1936
|
-
|
2000
|
+
this.$body.find(typeof index !== 'undefined' ?
|
2001
|
+
sprintf('tr[data-index="%s"]', index) :
|
2002
|
+
sprintf('tr[data-uniqueid="%s"]', uniqueId))
|
2003
|
+
[visible ? 'show' : 'hide']();
|
1937
2004
|
};
|
1938
2005
|
|
1939
2006
|
BootstrapTable.prototype.getVisibleFields = function () {
|
@@ -2014,7 +2081,7 @@
|
|
2014
2081
|
if (this.options.sidePagination === 'server') {
|
2015
2082
|
this.options.totalRows = data.total;
|
2016
2083
|
fixedScroll = data.fixedScroll;
|
2017
|
-
data = data.
|
2084
|
+
data = data[this.options.dataField];
|
2018
2085
|
} else if (!$.isArray(data)) { // support fixedScroll
|
2019
2086
|
fixedScroll = data.fixedScroll;
|
2020
2087
|
data = data.data;
|
@@ -2147,19 +2214,17 @@
|
|
2147
2214
|
};
|
2148
2215
|
|
2149
2216
|
BootstrapTable.prototype.showRow = function (params) {
|
2150
|
-
if (!params.hasOwnProperty('index')) {
|
2217
|
+
if (!params.hasOwnProperty('index') || !params.hasOwnProperty('uniqueId')) {
|
2151
2218
|
return;
|
2152
2219
|
}
|
2153
|
-
|
2154
|
-
this.toggleRow(params.index, params.isIdField === undefined ? false : true, true);
|
2220
|
+
this.toggleRow(params.index, params.uniqueId, true);
|
2155
2221
|
};
|
2156
2222
|
|
2157
2223
|
BootstrapTable.prototype.hideRow = function (params) {
|
2158
|
-
if (!params.hasOwnProperty('index')) {
|
2224
|
+
if (!params.hasOwnProperty('index') || !params.hasOwnProperty('uniqueId')) {
|
2159
2225
|
return;
|
2160
2226
|
}
|
2161
|
-
|
2162
|
-
this.toggleRow(params.index, params.isIdField === undefined ? false : true, false);
|
2227
|
+
this.toggleRow(params.index, params.uniqueId, false);
|
2163
2228
|
};
|
2164
2229
|
|
2165
2230
|
BootstrapTable.prototype.getRowsHidden = function (show) {
|
@@ -2202,10 +2267,12 @@
|
|
2202
2267
|
};
|
2203
2268
|
|
2204
2269
|
BootstrapTable.prototype.updateCell = function (params) {
|
2205
|
-
if (!params.hasOwnProperty('
|
2270
|
+
if (!params.hasOwnProperty('index') ||
|
2271
|
+
!params.hasOwnProperty('field') ||
|
2272
|
+
!params.hasOwnProperty('value')) {
|
2206
2273
|
return;
|
2207
2274
|
}
|
2208
|
-
this.data[params.
|
2275
|
+
this.data[params.index][params.field] = params.value;
|
2209
2276
|
this.initSort();
|
2210
2277
|
this.initBody(true);
|
2211
2278
|
};
|
@@ -2243,9 +2310,9 @@
|
|
2243
2310
|
if (!checked) {
|
2244
2311
|
rows = this.getSelections();
|
2245
2312
|
}
|
2313
|
+
this.$selectAll.add(this.$selectAll_).prop('checked', checked);
|
2246
2314
|
this.$selectItem.filter(':enabled').prop('checked', checked);
|
2247
2315
|
this.updateRows();
|
2248
|
-
this.updateSelected();
|
2249
2316
|
if (checked) {
|
2250
2317
|
rows = this.getSelections();
|
2251
2318
|
}
|
@@ -2287,7 +2354,8 @@
|
|
2287
2354
|
return false;
|
2288
2355
|
}
|
2289
2356
|
if ($.inArray(row[obj.field], obj.values) !== -1) {
|
2290
|
-
that.$selectItem.filter(
|
2357
|
+
that.$selectItem.filter(':enabled')
|
2358
|
+
.filter(sprintf('[data-index="%s"]', index)).prop('checked', checked);
|
2291
2359
|
row[that.header.stateField] = checked;
|
2292
2360
|
rows.push(row);
|
2293
2361
|
that.trigger(checked ? 'check' : 'uncheck', row);
|
@@ -2352,7 +2420,7 @@
|
|
2352
2420
|
};
|
2353
2421
|
|
2354
2422
|
BootstrapTable.prototype.getHiddenColumns = function () {
|
2355
|
-
return $.grep(this.columns, function(
|
2423
|
+
return $.grep(this.columns, function (column) {
|
2356
2424
|
return !column.visible;
|
2357
2425
|
});
|
2358
2426
|
};
|
@@ -2427,6 +2495,70 @@
|
|
2427
2495
|
this.onSearch({currentTarget: $search});
|
2428
2496
|
};
|
2429
2497
|
|
2498
|
+
BootstrapTable.prototype.expandRow_ = function (expand, index) {
|
2499
|
+
var $tr = this.$body.find(sprintf('> tr[data-index="%s"]', index));
|
2500
|
+
if ($tr.next().is('tr.detail-view') === (expand ? false : true)) {
|
2501
|
+
$tr.find('> td > .detail-icon').click();
|
2502
|
+
}
|
2503
|
+
};
|
2504
|
+
|
2505
|
+
BootstrapTable.prototype.expandRow = function (index) {
|
2506
|
+
this.expandRow_(true, index);
|
2507
|
+
};
|
2508
|
+
|
2509
|
+
BootstrapTable.prototype.collapseRow = function (index) {
|
2510
|
+
this.expandRow_(false, index);
|
2511
|
+
};
|
2512
|
+
|
2513
|
+
BootstrapTable.prototype.expandAllRows = function (isSubTable) {
|
2514
|
+
if (isSubTable) {
|
2515
|
+
var $tr = this.$body.find(sprintf('> tr[data-index="%s"]', 0)),
|
2516
|
+
that = this,
|
2517
|
+
detailIcon = null,
|
2518
|
+
executeInterval = false,
|
2519
|
+
idInterval = -1;
|
2520
|
+
|
2521
|
+
if (!$tr.next().is('tr.detail-view')) {
|
2522
|
+
$tr.find('> td > .detail-icon').click();
|
2523
|
+
executeInterval = true;
|
2524
|
+
} else if (!$tr.next().next().is('tr.detail-view')) {
|
2525
|
+
$tr.next().find(".detail-icon").click();
|
2526
|
+
executeInterval = true;
|
2527
|
+
}
|
2528
|
+
|
2529
|
+
if (executeInterval) {
|
2530
|
+
try {
|
2531
|
+
idInterval = setInterval(function () {
|
2532
|
+
detailIcon = that.$body.find("tr.detail-view").last().find(".detail-icon");
|
2533
|
+
if (detailIcon.length > 0) {
|
2534
|
+
detailIcon.click();
|
2535
|
+
} else {
|
2536
|
+
clearInterval(idInterval);
|
2537
|
+
}
|
2538
|
+
}, 1);
|
2539
|
+
} catch (ex) {
|
2540
|
+
clearInterval(idInterval);
|
2541
|
+
}
|
2542
|
+
}
|
2543
|
+
} else {
|
2544
|
+
var trs = this.$body.children();
|
2545
|
+
for (var i = 0; i < trs.length; i++) {
|
2546
|
+
this.expandRow_(true, $(trs[i]).data("index"));
|
2547
|
+
}
|
2548
|
+
}
|
2549
|
+
};
|
2550
|
+
|
2551
|
+
BootstrapTable.prototype.collapseAllRows = function (isSubTable) {
|
2552
|
+
if (isSubTable) {
|
2553
|
+
this.expandRow_(false, 0);
|
2554
|
+
} else {
|
2555
|
+
var trs = this.$body.children();
|
2556
|
+
for (var i = 0; i < trs.length; i++) {
|
2557
|
+
this.expandRow_(false, $(trs[i]).data("index"));
|
2558
|
+
}
|
2559
|
+
}
|
2560
|
+
};
|
2561
|
+
|
2430
2562
|
// BOOTSTRAP TABLE PLUGIN DEFINITION
|
2431
2563
|
// =======================
|
2432
2564
|
|
@@ -2453,7 +2585,8 @@
|
|
2453
2585
|
'togglePagination',
|
2454
2586
|
'toggleView',
|
2455
2587
|
'refreshOptions',
|
2456
|
-
'resetSearch'
|
2588
|
+
'resetSearch',
|
2589
|
+
'expandRow', 'collapseRow', 'expandAllRows', 'collapseAllRows'
|
2457
2590
|
];
|
2458
2591
|
|
2459
2592
|
$.fn.bootstrapTable = function (option) {
|
@@ -2495,6 +2628,12 @@
|
|
2495
2628
|
$.fn.bootstrapTable.columnDefaults = BootstrapTable.COLUMN_DEFAULTS;
|
2496
2629
|
$.fn.bootstrapTable.locales = BootstrapTable.LOCALES;
|
2497
2630
|
$.fn.bootstrapTable.methods = allowedMethods;
|
2631
|
+
$.fn.bootstrapTable.utils = {
|
2632
|
+
sprintf: sprintf,
|
2633
|
+
getFieldIndex: getFieldIndex,
|
2634
|
+
compareObjects: compareObjects,
|
2635
|
+
calculateObjectValue: calculateObjectValue
|
2636
|
+
};
|
2498
2637
|
|
2499
2638
|
// BOOTSTRAP TABLE INIT
|
2500
2639
|
// =======================
|