|
@@ -8,6 +8,43 @@
|
|
|
|
|
|
|
|
'use strict';
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
+ var filterFn = function () {
|
|
|
|
|
+ if (!Array.prototype.filter) {
|
|
|
|
|
+ Array.prototype.filter = function(fun/*, thisArg*/) {
|
|
|
|
|
+ 'use strict';
|
|
|
|
|
+
|
|
|
|
|
+ if (this === void 0 || this === null) {
|
|
|
|
|
+ throw new TypeError();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ var t = Object(this);
|
|
|
|
|
+ var len = t.length >>> 0;
|
|
|
|
|
+ if (typeof fun !== 'function') {
|
|
|
|
|
+ throw new TypeError();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ var res = [];
|
|
|
|
|
+ var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
|
|
|
|
|
+ for (var i = 0; i < len; i++) {
|
|
|
|
|
+ if (i in t) {
|
|
|
|
|
+ var val = t[i];
|
|
|
|
|
+
|
|
|
|
|
+ // NOTE: Technically this should Object.defineProperty at
|
|
|
|
|
+ // the next index, as push can be affected by
|
|
|
|
|
+ // properties on Object.prototype and Array.prototype.
|
|
|
|
|
+ // But that method's new, and collisions should be
|
|
|
|
|
+ // rare, so use the more-compatible alternative.
|
|
|
|
|
+ if (fun.call(thisArg, val, i, t)) {
|
|
|
|
|
+ res.push(val);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return res;
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
$.extend($.fn.bootstrapTable.defaults, {
|
|
$.extend($.fn.bootstrapTable.defaults, {
|
|
|
reorderableColumns: false,
|
|
reorderableColumns: false,
|
|
|
maxMovingRows: 10,
|
|
maxMovingRows: 10,
|
|
@@ -85,7 +122,8 @@
|
|
|
formatters = [],
|
|
formatters = [],
|
|
|
columns = [],
|
|
columns = [],
|
|
|
columnsHidden = [],
|
|
columnsHidden = [],
|
|
|
- columnIndex = -1;
|
|
|
|
|
|
|
+ columnIndex = -1,
|
|
|
|
|
+ optionsColumns = [];
|
|
|
that.$header.find('th').each(function (i) {
|
|
that.$header.find('th').each(function (i) {
|
|
|
ths.push($(this).data('field'));
|
|
ths.push($(this).data('field'));
|
|
|
formatters.push($(this).data('formatter'));
|
|
formatters.push($(this).data('formatter'));
|
|
@@ -111,6 +149,23 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
that.columns = that.columns.concat(columns);
|
|
that.columns = that.columns.concat(columns);
|
|
|
|
|
+
|
|
|
|
|
+ filterFn(); //Support <IE9
|
|
|
|
|
+ $.each(that.columns, function(i, column) {
|
|
|
|
|
+ var found = false,
|
|
|
|
|
+ field = column.field;
|
|
|
|
|
+ that.options.columns[0].filter(function(item) {
|
|
|
|
|
+ if(!found && item["field"] == field) {
|
|
|
|
|
+ optionsColumns.push(item);
|
|
|
|
|
+ found = true;
|
|
|
|
|
+ return false;
|
|
|
|
|
+ } else
|
|
|
|
|
+ return true;
|
|
|
|
|
+ })
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ that.options.columns[0] = optionsColumns;
|
|
|
|
|
+
|
|
|
that.header.fields = ths;
|
|
that.header.fields = ths;
|
|
|
that.header.formatters = formatters;
|
|
that.header.formatters = formatters;
|
|
|
that.resetView();
|
|
that.resetView();
|