bootstrap-table-rails 1.15.4 → 1.15.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -21
- data/lib/bootstrap-table-rails/version.rb +1 -1
- data/vendor/assets/javascripts/bootstrap-table/bootstrap-table-locale-all.js +182 -0
- data/vendor/assets/javascripts/bootstrap-table/bootstrap-table.css +1 -1
- data/vendor/assets/javascripts/bootstrap-table/bootstrap-table.js +145 -110
- data/vendor/assets/javascripts/bootstrap-table/extensions/export/bootstrap-table-export.js +34 -28
- data/vendor/assets/javascripts/bootstrap-table/extensions/filter-control/bootstrap-table-filter-control.js +2 -2
- data/vendor/assets/javascripts/bootstrap-table/extensions/sticky-header/bootstrap-table-sticky-header.js +6 -2
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sr-Cyrl-RS.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sr-Latn-RS.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/themes/bulma/bootstrap-table-bulma.js +1 -1
- data/vendor/assets/javascripts/bootstrap-table/themes/foundation/bootstrap-table-foundation.js +1 -1
- data/vendor/assets/javascripts/bootstrap-table/themes/materialize/bootstrap-table-materialize.js +1 -1
- data/vendor/assets/javascripts/bootstrap-table/themes/semantic/bootstrap-table-semantic.js +1 -1
- metadata +4 -12
- data/vendor/assets/javascripts/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.css +0 -3
- data/vendor/assets/javascripts/bootstrap-table/extensions/group-by/bootstrap-table-group-by.css +0 -53
- data/vendor/assets/javascripts/bootstrap-table/extensions/group-by/bootstrap-table-group-by.js +0 -257
- data/vendor/assets/javascripts/bootstrap-table/extensions/multi-column-toggle/bootstrap-table-multi-toggle.js +0 -105
- data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-search/bootstrap-table-multiple-search.js +0 -85
- data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-selection-row/bootstrap-table-multiple-selection-row.css +0 -17
- data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-selection-row/bootstrap-table-multiple-selection-row.js +0 -143
- data/vendor/assets/javascripts/bootstrap-table/extensions/select2-filter/bootstrap-table-select2-filter.js +0 -341
- data/vendor/assets/javascripts/bootstrap-table/extensions/tree-column/bootstrap-table-tree-column.css +0 -1
- data/vendor/assets/javascripts/bootstrap-table/extensions/tree-column/bootstrap-table-tree-column.js +0 -142
@@ -1,17 +0,0 @@
|
|
1
|
-
.multiple-select-row-selected {
|
2
|
-
background: lightBlue
|
3
|
-
}
|
4
|
-
|
5
|
-
.table tbody tr:hover td,
|
6
|
-
.table tbody tr:hover th {
|
7
|
-
background-color: transparent;
|
8
|
-
}
|
9
|
-
|
10
|
-
|
11
|
-
.table-striped tbody tr:nth-child(odd):hover td {
|
12
|
-
background-color: #F9F9F9;
|
13
|
-
}
|
14
|
-
|
15
|
-
.fixed-table-container tbody .selected td {
|
16
|
-
background: lightBlue;
|
17
|
-
}
|
@@ -1,143 +0,0 @@
|
|
1
|
-
(function (global, factory) {
|
2
|
-
if (typeof define === "function" && define.amd) {
|
3
|
-
define([], factory);
|
4
|
-
} else if (typeof exports !== "undefined") {
|
5
|
-
factory();
|
6
|
-
} else {
|
7
|
-
var mod = {
|
8
|
-
exports: {}
|
9
|
-
};
|
10
|
-
factory();
|
11
|
-
global.bootstrapTableMultipleSelectionRow = mod.exports;
|
12
|
-
}
|
13
|
-
})(this, function () {
|
14
|
-
"use strict";
|
15
|
-
|
16
|
-
/**
|
17
|
-
* @author: Dennis Hernández
|
18
|
-
* @webSite: http://djhvscf.github.io/Blog
|
19
|
-
* @version: v1.0.0
|
20
|
-
*/
|
21
|
-
|
22
|
-
!function ($) {
|
23
|
-
|
24
|
-
'use strict';
|
25
|
-
|
26
|
-
document.onselectstart = function () {
|
27
|
-
return false;
|
28
|
-
};
|
29
|
-
|
30
|
-
var getTableObjectFromCurrentTarget = function getTableObjectFromCurrentTarget(currentTarget) {
|
31
|
-
currentTarget = $(currentTarget);
|
32
|
-
return currentTarget.is("table") ? currentTarget : currentTarget.parents().find(".table");
|
33
|
-
};
|
34
|
-
|
35
|
-
var getRow = function getRow(target) {
|
36
|
-
target = $(target);
|
37
|
-
return target.parent().parent();
|
38
|
-
};
|
39
|
-
|
40
|
-
var onRowClick = function onRowClick(e) {
|
41
|
-
var that = getTableObjectFromCurrentTarget(e.currentTarget);
|
42
|
-
|
43
|
-
if (window.event.ctrlKey) {
|
44
|
-
toggleRow(e.currentTarget, that, false, false);
|
45
|
-
}
|
46
|
-
|
47
|
-
if (window.event.button === 0) {
|
48
|
-
if (!window.event.ctrlKey && !window.event.shiftKey) {
|
49
|
-
clearAll(that);
|
50
|
-
toggleRow(e.currentTarget, that, false, false);
|
51
|
-
}
|
52
|
-
|
53
|
-
if (window.event.shiftKey) {
|
54
|
-
selectRowsBetweenIndexes([that.bootstrapTable("getOptions").multipleSelectRowLastSelectedRow.rowIndex, e.currentTarget.rowIndex], that);
|
55
|
-
}
|
56
|
-
}
|
57
|
-
};
|
58
|
-
|
59
|
-
var onCheckboxChange = function onCheckboxChange(e) {
|
60
|
-
var that = getTableObjectFromCurrentTarget(e.currentTarget);
|
61
|
-
clearAll(that);
|
62
|
-
toggleRow(getRow(e.currentTarget), that, false, false);
|
63
|
-
};
|
64
|
-
|
65
|
-
var toggleRow = function toggleRow(row, that, clearAll, useShift) {
|
66
|
-
if (clearAll) {
|
67
|
-
row = $(row);
|
68
|
-
that.bootstrapTable("getOptions").multipleSelectRowLastSelectedRow = undefined;
|
69
|
-
row.removeClass(that.bootstrapTable("getOptions").multipleSelectRowCssClass);
|
70
|
-
that.bootstrapTable("uncheck", row.data("index"));
|
71
|
-
} else {
|
72
|
-
that.bootstrapTable("getOptions").multipleSelectRowLastSelectedRow = row;
|
73
|
-
row = $(row);
|
74
|
-
if (useShift) {
|
75
|
-
row.addClass(that.bootstrapTable("getOptions").multipleSelectRowCssClass);
|
76
|
-
that.bootstrapTable("check", row.data("index"));
|
77
|
-
} else {
|
78
|
-
if (row.hasClass(that.bootstrapTable("getOptions").multipleSelectRowCssClass)) {
|
79
|
-
row.removeClass(that.bootstrapTable("getOptions").multipleSelectRowCssClass);
|
80
|
-
that.bootstrapTable("uncheck", row.data("index"));
|
81
|
-
} else {
|
82
|
-
row.addClass(that.bootstrapTable("getOptions").multipleSelectRowCssClass);
|
83
|
-
that.bootstrapTable("check", row.data("index"));
|
84
|
-
}
|
85
|
-
}
|
86
|
-
}
|
87
|
-
};
|
88
|
-
|
89
|
-
var selectRowsBetweenIndexes = function selectRowsBetweenIndexes(indexes, that) {
|
90
|
-
indexes.sort(function (a, b) {
|
91
|
-
return a - b;
|
92
|
-
});
|
93
|
-
|
94
|
-
for (var i = indexes[0]; i <= indexes[1]; i++) {
|
95
|
-
toggleRow(that.bootstrapTable("getOptions").multipleSelectRowRows[i - 1], that, false, true);
|
96
|
-
}
|
97
|
-
};
|
98
|
-
|
99
|
-
var clearAll = function clearAll(that) {
|
100
|
-
for (var i = 0; i < that.bootstrapTable("getOptions").multipleSelectRowRows.length; i++) {
|
101
|
-
toggleRow(that.bootstrapTable("getOptions").multipleSelectRowRows[i], that, true, false);
|
102
|
-
}
|
103
|
-
};
|
104
|
-
|
105
|
-
$.extend($.fn.bootstrapTable.defaults, {
|
106
|
-
multipleSelectRow: false,
|
107
|
-
multipleSelectRowCssClass: 'multiple-select-row-selected',
|
108
|
-
//internal variables used by the extension
|
109
|
-
multipleSelectRowLastSelectedRow: undefined,
|
110
|
-
multipleSelectRowRows: []
|
111
|
-
});
|
112
|
-
|
113
|
-
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
114
|
-
_init = BootstrapTable.prototype.init,
|
115
|
-
_initBody = BootstrapTable.prototype.initBody;
|
116
|
-
|
117
|
-
BootstrapTable.prototype.init = function () {
|
118
|
-
if (this.options.multipleSelectRow) {
|
119
|
-
var that = this;
|
120
|
-
|
121
|
-
//Make sure that the internal variables have the correct value
|
122
|
-
this.options.multipleSelectRowLastSelectedRow = undefined;
|
123
|
-
this.options.multipleSelectRowRows = [];
|
124
|
-
|
125
|
-
this.$el.on("post-body.bs.table", function (e) {
|
126
|
-
setTimeout(function () {
|
127
|
-
that.options.multipleSelectRowRows = that.$body.children();
|
128
|
-
that.options.multipleSelectRowRows.click(onRowClick);
|
129
|
-
that.options.multipleSelectRowRows.find("input[type=checkbox]").change(onCheckboxChange);
|
130
|
-
}, 1);
|
131
|
-
});
|
132
|
-
}
|
133
|
-
|
134
|
-
_init.apply(this, Array.prototype.slice.apply(arguments));
|
135
|
-
};
|
136
|
-
|
137
|
-
BootstrapTable.prototype.clearAllMultipleSelectionRow = function () {
|
138
|
-
clearAll(this);
|
139
|
-
};
|
140
|
-
|
141
|
-
$.fn.bootstrapTable.methods.push('clearAllMultipleSelectionRow');
|
142
|
-
}(jQuery);
|
143
|
-
});
|
@@ -1,341 +0,0 @@
|
|
1
|
-
(function (global, factory) {
|
2
|
-
if (typeof define === "function" && define.amd) {
|
3
|
-
define([], factory);
|
4
|
-
} else if (typeof exports !== "undefined") {
|
5
|
-
factory();
|
6
|
-
} else {
|
7
|
-
var mod = {
|
8
|
-
exports: {}
|
9
|
-
};
|
10
|
-
factory();
|
11
|
-
global.bootstrapTableSelect2Filter = mod.exports;
|
12
|
-
}
|
13
|
-
})(this, function () {
|
14
|
-
'use strict';
|
15
|
-
|
16
|
-
/**
|
17
|
-
* @author: Jewway
|
18
|
-
* @version: v1.1.1
|
19
|
-
*/
|
20
|
-
|
21
|
-
!function ($) {
|
22
|
-
'use strict';
|
23
|
-
|
24
|
-
function getCurrentHeader(that) {
|
25
|
-
var header = that.$header;
|
26
|
-
if (that.options.height) {
|
27
|
-
header = that.$tableHeader;
|
28
|
-
}
|
29
|
-
|
30
|
-
return header;
|
31
|
-
}
|
32
|
-
|
33
|
-
function initFilterValues(that) {
|
34
|
-
if (!$.isEmptyObject(that.filterColumnsPartial)) {
|
35
|
-
var $header = getCurrentHeader(that);
|
36
|
-
|
37
|
-
$.each(that.columns, function (idx, column) {
|
38
|
-
var value = that.filterColumnsPartial[column.field];
|
39
|
-
|
40
|
-
if (column.filter) {
|
41
|
-
if (column.filter.setFilterValue) {
|
42
|
-
var $filter = $header.find('[data-field=' + column.field + '] .filter');
|
43
|
-
column.filter.setFilterValue($filter, column.field, value);
|
44
|
-
} else {
|
45
|
-
var $ele = $header.find('[data-filter-field=' + column.field + ']');
|
46
|
-
switch (column.filter.type) {
|
47
|
-
case 'input':
|
48
|
-
$ele.val(value);
|
49
|
-
case 'select':
|
50
|
-
$ele.val(value).trigger('change');
|
51
|
-
}
|
52
|
-
}
|
53
|
-
}
|
54
|
-
});
|
55
|
-
}
|
56
|
-
}
|
57
|
-
|
58
|
-
function createFilter(that, header) {
|
59
|
-
var enableFilter = false,
|
60
|
-
isVisible,
|
61
|
-
html,
|
62
|
-
timeoutId = 0;
|
63
|
-
|
64
|
-
$.each(that.columns, function (i, column) {
|
65
|
-
isVisible = 'hidden';
|
66
|
-
html = null;
|
67
|
-
|
68
|
-
if (!column.visible) {
|
69
|
-
return;
|
70
|
-
}
|
71
|
-
|
72
|
-
if (!column.filter) {
|
73
|
-
html = $('<div class="no-filter"></div>');
|
74
|
-
} else {
|
75
|
-
var filterClass = column.filter.class ? ' ' + column.filter.class : '';
|
76
|
-
html = $('<div style="margin: 0px 2px 2px 2px;" class="filter' + filterClass + '">');
|
77
|
-
|
78
|
-
if (column.searchable) {
|
79
|
-
enableFilter = true;
|
80
|
-
isVisible = 'visible';
|
81
|
-
}
|
82
|
-
|
83
|
-
if (column.filter.template) {
|
84
|
-
html.append(column.filter.template(that, column, isVisible));
|
85
|
-
} else {
|
86
|
-
var $filter = $(that.options.filterTemplate[column.filter.type.toLowerCase()](that, column, isVisible));
|
87
|
-
|
88
|
-
switch (column.filter.type) {
|
89
|
-
case 'input':
|
90
|
-
var cpLock = true;
|
91
|
-
$filter.off('compositionstart').on('compositionstart', function (event) {
|
92
|
-
cpLock = false;
|
93
|
-
});
|
94
|
-
|
95
|
-
$filter.off('compositionend').on('compositionend', function (event) {
|
96
|
-
cpLock = true;
|
97
|
-
var $input = $(this);
|
98
|
-
clearTimeout(timeoutId);
|
99
|
-
timeoutId = setTimeout(function () {
|
100
|
-
that.onColumnSearch(event, column.field, $input.val());
|
101
|
-
}, that.options.searchTimeOut);
|
102
|
-
});
|
103
|
-
|
104
|
-
$filter.off('keyup').on('keyup', function (event) {
|
105
|
-
if (cpLock) {
|
106
|
-
var $input = $(this);
|
107
|
-
clearTimeout(timeoutId);
|
108
|
-
timeoutId = setTimeout(function () {
|
109
|
-
that.onColumnSearch(event, column.field, $input.val());
|
110
|
-
}, that.options.searchTimeOut);
|
111
|
-
}
|
112
|
-
});
|
113
|
-
|
114
|
-
$filter.off('mouseup').on('mouseup', function (event) {
|
115
|
-
var $input = $(this),
|
116
|
-
oldValue = $input.val();
|
117
|
-
|
118
|
-
if (oldValue === "") {
|
119
|
-
return;
|
120
|
-
}
|
121
|
-
|
122
|
-
setTimeout(function () {
|
123
|
-
var newValue = $input.val();
|
124
|
-
|
125
|
-
if (newValue === "") {
|
126
|
-
clearTimeout(timeoutId);
|
127
|
-
timeoutId = setTimeout(function () {
|
128
|
-
that.onColumnSearch(event, column.field, newValue);
|
129
|
-
}, that.options.searchTimeOut);
|
130
|
-
}
|
131
|
-
}, 1);
|
132
|
-
});
|
133
|
-
break;
|
134
|
-
case 'select':
|
135
|
-
$filter.on('select2:select', function (event) {
|
136
|
-
that.onColumnSearch(event, column.field, $(this).val());
|
137
|
-
});
|
138
|
-
|
139
|
-
$filter.on("select2:unselecting", function (event) {
|
140
|
-
var $select2 = $(this);
|
141
|
-
event.preventDefault();
|
142
|
-
$select2.val(null).trigger('change');
|
143
|
-
that.searchText = undefined;
|
144
|
-
that.onColumnSearch(event, column.field, $select2.val());
|
145
|
-
});
|
146
|
-
break;
|
147
|
-
}
|
148
|
-
|
149
|
-
html.append($filter);
|
150
|
-
}
|
151
|
-
}
|
152
|
-
|
153
|
-
$.each(header.children().children(), function (i, tr) {
|
154
|
-
tr = $(tr);
|
155
|
-
if (tr.data('field') === column.field) {
|
156
|
-
tr.find('.fht-cell').append(html);
|
157
|
-
return false;
|
158
|
-
}
|
159
|
-
});
|
160
|
-
});
|
161
|
-
|
162
|
-
if (!enableFilter) {
|
163
|
-
header.find('.filter').hide();
|
164
|
-
}
|
165
|
-
}
|
166
|
-
|
167
|
-
function initSelect2(that) {
|
168
|
-
var $header = getCurrentHeader(that);
|
169
|
-
|
170
|
-
$.each(that.columns, function (idx, column) {
|
171
|
-
if (column.filter && column.filter.type === 'select') {
|
172
|
-
var $selectEle = $header.find('select[data-filter-field="' + column.field + '"]');
|
173
|
-
|
174
|
-
if ($selectEle.length > 0 && !$selectEle.data().select2) {
|
175
|
-
var select2Opts = {
|
176
|
-
placeholder: "",
|
177
|
-
allowClear: true,
|
178
|
-
data: column.filter.data,
|
179
|
-
dropdownParent: that.$el.closest(".bootstrap-table")
|
180
|
-
};
|
181
|
-
|
182
|
-
$selectEle.select2(select2Opts);
|
183
|
-
}
|
184
|
-
}
|
185
|
-
});
|
186
|
-
}
|
187
|
-
|
188
|
-
$.extend($.fn.bootstrapTable.defaults, {
|
189
|
-
filter: false,
|
190
|
-
filterValues: {},
|
191
|
-
filterTemplate: {
|
192
|
-
input: function input(instance, column, isVisible) {
|
193
|
-
return '<input type="text" class="form-control" data-filter-field="' + column.field + '" style="width: 100%; visibility:' + isVisible + '">';
|
194
|
-
},
|
195
|
-
select: function select(instance, column, isVisible) {
|
196
|
-
return '<select data-filter-field="' + column.field + '" style="width: 100%; visibility:' + isVisible + '"></select>';
|
197
|
-
}
|
198
|
-
},
|
199
|
-
onColumnSearch: function onColumnSearch(field, text) {
|
200
|
-
return false;
|
201
|
-
}
|
202
|
-
});
|
203
|
-
|
204
|
-
$.extend($.fn.bootstrapTable.COLUMN_DEFAULTS, {
|
205
|
-
filter: undefined
|
206
|
-
});
|
207
|
-
|
208
|
-
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
|
209
|
-
'column-search.bs.table': 'onColumnSearch'
|
210
|
-
});
|
211
|
-
|
212
|
-
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
213
|
-
_init = BootstrapTable.prototype.init,
|
214
|
-
_initHeader = BootstrapTable.prototype.initHeader,
|
215
|
-
_initSearch = BootstrapTable.prototype.initSearch;
|
216
|
-
|
217
|
-
BootstrapTable.prototype.init = function () {
|
218
|
-
//Make sure that the filtercontrol option is set
|
219
|
-
if (this.options.filter) {
|
220
|
-
var that = this;
|
221
|
-
|
222
|
-
if (that.options.filterTemplate) {
|
223
|
-
that.options.filterTemplate = $.extend({}, $.fn.bootstrapTable.defaults.filterTemplate, that.options.filterTemplate);
|
224
|
-
}
|
225
|
-
|
226
|
-
if (!$.isEmptyObject(that.options.filterValues)) {
|
227
|
-
that.filterColumnsPartial = that.options.filterValues;
|
228
|
-
that.options.filterValues = {};
|
229
|
-
}
|
230
|
-
|
231
|
-
this.$el.on('reset-view.bs.table', function () {
|
232
|
-
//Create controls on $tableHeader if the height is set
|
233
|
-
if (!that.options.height) {
|
234
|
-
return;
|
235
|
-
}
|
236
|
-
|
237
|
-
//Avoid recreate the controls
|
238
|
-
if (that.$tableHeader.find('select').length > 0 || that.$tableHeader.find('input').length > 0) {
|
239
|
-
return;
|
240
|
-
}
|
241
|
-
|
242
|
-
createFilter(that, that.$tableHeader);
|
243
|
-
}).on('post-header.bs.table', function () {
|
244
|
-
var timeoutId = 0;
|
245
|
-
|
246
|
-
initSelect2(that);
|
247
|
-
clearTimeout(timeoutId);
|
248
|
-
timeoutId = setTimeout(function () {
|
249
|
-
initFilterValues(that);
|
250
|
-
}, that.options.searchTimeOut - 1000);
|
251
|
-
}).on('column-switch.bs.table', function (field, checked) {
|
252
|
-
initFilterValues(that);
|
253
|
-
});
|
254
|
-
}
|
255
|
-
|
256
|
-
_init.apply(this, Array.prototype.slice.apply(arguments));
|
257
|
-
};
|
258
|
-
|
259
|
-
BootstrapTable.prototype.initHeader = function () {
|
260
|
-
_initHeader.apply(this, Array.prototype.slice.apply(arguments));
|
261
|
-
if (this.options.filter) {
|
262
|
-
createFilter(this, this.$header);
|
263
|
-
}
|
264
|
-
};
|
265
|
-
|
266
|
-
BootstrapTable.prototype.initSearch = function () {
|
267
|
-
var that = this,
|
268
|
-
filterValues = that.filterColumnsPartial;
|
269
|
-
|
270
|
-
// Filter for client
|
271
|
-
if (that.options.sidePagination === 'client') {
|
272
|
-
this.data = $.grep(this.data, function (row, idx) {
|
273
|
-
for (var field in filterValues) {
|
274
|
-
var column = that.columns[that.fieldsColumnsIndex[field]],
|
275
|
-
filterValue = filterValues[field].toLowerCase(),
|
276
|
-
rowValue = row[field];
|
277
|
-
|
278
|
-
rowValue = $.fn.bootstrapTable.utils.calculateObjectValue(that.header, that.header.formatters[$.inArray(field, that.header.fields)], [rowValue, row, idx], rowValue);
|
279
|
-
|
280
|
-
if (column.filterStrictSearch) {
|
281
|
-
if (!($.inArray(field, that.header.fields) !== -1 && (typeof rowValue === 'string' || typeof rowValue === 'number') && rowValue.toString().toLowerCase() === filterValue.toString().toLowerCase())) {
|
282
|
-
return false;
|
283
|
-
}
|
284
|
-
} else {
|
285
|
-
if (!($.inArray(field, that.header.fields) !== -1 && (typeof rowValue === 'string' || typeof rowValue === 'number') && (rowValue + '').toLowerCase().indexOf(filterValue) !== -1)) {
|
286
|
-
return false;
|
287
|
-
}
|
288
|
-
}
|
289
|
-
}
|
290
|
-
|
291
|
-
return true;
|
292
|
-
});
|
293
|
-
}
|
294
|
-
|
295
|
-
_initSearch.apply(this, Array.prototype.slice.apply(arguments));
|
296
|
-
};
|
297
|
-
|
298
|
-
BootstrapTable.prototype.onColumnSearch = function (event, field, value) {
|
299
|
-
if ($.isEmptyObject(this.filterColumnsPartial)) {
|
300
|
-
this.filterColumnsPartial = {};
|
301
|
-
}
|
302
|
-
|
303
|
-
if (value) {
|
304
|
-
this.filterColumnsPartial[field] = value;
|
305
|
-
} else {
|
306
|
-
delete this.filterColumnsPartial[field];
|
307
|
-
}
|
308
|
-
|
309
|
-
this.options.pageNumber = 1;
|
310
|
-
this.onSearch(event);
|
311
|
-
this.trigger('column-search', field, value);
|
312
|
-
};
|
313
|
-
|
314
|
-
BootstrapTable.prototype.setSelect2Data = function (field, data) {
|
315
|
-
var that = this,
|
316
|
-
$header = getCurrentHeader(that),
|
317
|
-
$selectEle = $header.find('select[data-filter-field=\"' + field + '\"]');
|
318
|
-
$selectEle.empty();
|
319
|
-
$selectEle.select2({
|
320
|
-
data: data,
|
321
|
-
placeholder: "",
|
322
|
-
allowClear: true,
|
323
|
-
dropdownParent: that.$el.closest(".bootstrap-table")
|
324
|
-
});
|
325
|
-
|
326
|
-
$.each(this.columns, function (idx, column) {
|
327
|
-
if (column.field === field) {
|
328
|
-
column.filter.data = data;
|
329
|
-
return false;
|
330
|
-
}
|
331
|
-
});
|
332
|
-
};
|
333
|
-
|
334
|
-
BootstrapTable.prototype.setFilterValues = function (values) {
|
335
|
-
this.filterColumnsPartial = values;
|
336
|
-
};
|
337
|
-
|
338
|
-
$.fn.bootstrapTable.methods.push('setSelect2Data');
|
339
|
-
$.fn.bootstrapTable.methods.push('setFilterValues');
|
340
|
-
}(jQuery);
|
341
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
.table:not(.table-condensed)>tbody>tr>td.treenode{padding-top:0;padding-bottom:0;border-bottom:solid #fff 1px}.table:not(.table-condensed)>tbody>tr:last-child>td.treenode{border-bottom:none}.treenode .text{float:left;display:block;padding-top:6px;padding-bottom:6px}.treenode .vertical,.treenode .vertical.last{float:left;display:block;width:1px;border-left:dashed silver 1px;height:38px;margin-left:8px}.treenode .vertical.last{height:15px}.treenode .space,.treenode .node{float:left;display:block;width:15px;height:5px;margin-top:15px}.treenode .node{border-top:dashed silver 1px}
|
data/vendor/assets/javascripts/bootstrap-table/extensions/tree-column/bootstrap-table-tree-column.js
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
(function (global, factory) {
|
2
|
-
if (typeof define === "function" && define.amd) {
|
3
|
-
define([], factory);
|
4
|
-
} else if (typeof exports !== "undefined") {
|
5
|
-
factory();
|
6
|
-
} else {
|
7
|
-
var mod = {
|
8
|
-
exports: {}
|
9
|
-
};
|
10
|
-
factory();
|
11
|
-
global.bootstrapTableTreeColumn = mod.exports;
|
12
|
-
}
|
13
|
-
})(this, function () {
|
14
|
-
'use strict';
|
15
|
-
|
16
|
-
/**
|
17
|
-
* @author: KingYang
|
18
|
-
* @webSite: https://github.com/kingyang
|
19
|
-
* @version: v1.0.0
|
20
|
-
*/
|
21
|
-
|
22
|
-
!function ($) {
|
23
|
-
|
24
|
-
'use strict';
|
25
|
-
|
26
|
-
$.extend($.fn.bootstrapTable.defaults, {
|
27
|
-
treeShowField: null,
|
28
|
-
idField: 'id',
|
29
|
-
parentIdField: 'pid',
|
30
|
-
treeVerticalcls: 'vertical',
|
31
|
-
treeVerticalLastcls: 'vertical last',
|
32
|
-
treeSpacecls: 'space',
|
33
|
-
treeNodecls: 'node',
|
34
|
-
treeCellcls: 'treenode',
|
35
|
-
treeTextcls: 'text',
|
36
|
-
onTreeFormatter: function onTreeFormatter(row) {
|
37
|
-
var that = this,
|
38
|
-
options = that.options,
|
39
|
-
level = row._level || 0,
|
40
|
-
plevel = row._parent && row._parent._level || 0,
|
41
|
-
paddings = [];
|
42
|
-
for (var i = 0; i < plevel; i++) {
|
43
|
-
paddings.push('<i class="' + options.treeVerticalcls + '"></i>');
|
44
|
-
paddings.push('<i class="' + options.treeSpacecls + '"></i>');
|
45
|
-
}
|
46
|
-
|
47
|
-
for (var i = plevel; i < level; i++) {
|
48
|
-
if (row._last && i === level - 1) {
|
49
|
-
paddings.push('<i class="' + options.treeVerticalLastcls + '"></i>');
|
50
|
-
} else {
|
51
|
-
paddings.push('<i class="' + options.treeVerticalcls + '"></i>');
|
52
|
-
}
|
53
|
-
paddings.push('<i class="' + options.treeNodecls + '"></i>');
|
54
|
-
}
|
55
|
-
return paddings.join('');
|
56
|
-
}, onGetNodes: function onGetNodes(row, data) {
|
57
|
-
var that = this;
|
58
|
-
var nodes = [];
|
59
|
-
$.each(data, function (i, item) {
|
60
|
-
if (row[that.options.idField] === item[that.options.parentIdField]) {
|
61
|
-
nodes.push(item);
|
62
|
-
}
|
63
|
-
});
|
64
|
-
return nodes;
|
65
|
-
},
|
66
|
-
onCheckLeaf: function onCheckLeaf(row, data) {
|
67
|
-
if (row.isLeaf !== undefined) {
|
68
|
-
return row.isLeaf;
|
69
|
-
}
|
70
|
-
return !row._nodes || !row._nodes.length;
|
71
|
-
}, onCheckRoot: function onCheckRoot(row, data) {
|
72
|
-
var that = this;
|
73
|
-
return !row[that.options.parentIdField];
|
74
|
-
}
|
75
|
-
});
|
76
|
-
|
77
|
-
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
78
|
-
_initRow = BootstrapTable.prototype.initRow,
|
79
|
-
_initHeader = BootstrapTable.prototype.initHeader;
|
80
|
-
|
81
|
-
BootstrapTable.prototype.initHeader = function () {
|
82
|
-
var that = this;
|
83
|
-
_initHeader.apply(that, Array.prototype.slice.apply(arguments));
|
84
|
-
var treeShowField = that.options.treeShowField;
|
85
|
-
if (treeShowField) {
|
86
|
-
$.each(this.header.fields, function (i, field) {
|
87
|
-
if (treeShowField === field) {
|
88
|
-
that.treeEnable = true;
|
89
|
-
var _formatter = that.header.formatters[i];
|
90
|
-
var _class = [that.options.treeCellcls];
|
91
|
-
if (that.header.classes[i]) {
|
92
|
-
_class.push(that.header.classes[i].split('"')[1] || '');
|
93
|
-
}
|
94
|
-
that.header.classes[i] = ' class="' + _class.join(' ') + '"';
|
95
|
-
that.header.formatters[i] = function (value, row, index) {
|
96
|
-
var colTree = [that.options.onTreeFormatter.apply(that, [row])];
|
97
|
-
colTree.push('<span class="' + that.options.treeTextcls + '">');
|
98
|
-
if (_formatter) {
|
99
|
-
colTree.push(_formatter.apply(this, Array.prototype.slice.apply(arguments)));
|
100
|
-
} else {
|
101
|
-
colTree.push(value);
|
102
|
-
}
|
103
|
-
colTree.push('</span>');
|
104
|
-
return colTree.join('');
|
105
|
-
};
|
106
|
-
return false;
|
107
|
-
}
|
108
|
-
});
|
109
|
-
}
|
110
|
-
};
|
111
|
-
|
112
|
-
var initNode = function initNode(item, idx, data, parentDom) {
|
113
|
-
var that = this;
|
114
|
-
var nodes = that.options.onGetNodes.apply(that, [item, data]);
|
115
|
-
item._nodes = nodes;
|
116
|
-
parentDom.append(_initRow.apply(that, [item, idx, data, parentDom]));
|
117
|
-
var len = nodes.length - 1;
|
118
|
-
for (var i = 0; i <= len; i++) {
|
119
|
-
var node = nodes[i];
|
120
|
-
node._level = item._level + 1;
|
121
|
-
node._parent = item;
|
122
|
-
if (i === len) node._last = 1;
|
123
|
-
initNode.apply(that, [node, $.inArray(node, data), data, parentDom]);
|
124
|
-
}
|
125
|
-
};
|
126
|
-
|
127
|
-
BootstrapTable.prototype.initRow = function (item, idx, data, parentDom) {
|
128
|
-
var that = this;
|
129
|
-
if (that.treeEnable) {
|
130
|
-
if (that.options.onCheckRoot.apply(that, [item, data])) {
|
131
|
-
if (item._level === undefined) {
|
132
|
-
item._level = 0;
|
133
|
-
}
|
134
|
-
initNode.apply(that, [item, idx, data, parentDom]);
|
135
|
-
return true;
|
136
|
-
}
|
137
|
-
return false;
|
138
|
-
}
|
139
|
-
return _initRow.apply(that, Array.prototype.slice.apply(arguments));
|
140
|
-
};
|
141
|
-
}(jQuery);
|
142
|
-
});
|