snipe-it/public/js/extensions/multiple-search/bootstrap-table-multiple-search.min.js
2017-05-31 10:31:56 -07:00

7 lines
1.2 KiB
JavaScript
Executable file

/*
* bootstrap-table - v1.9.1 - 2015-10-25
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2015 zhixin wen
* Licensed MIT License
*/
!function(a){"use strict";a.extend(a.fn.bootstrapTable.defaults,{multipleSearch:!1});var b=a.fn.bootstrapTable.Constructor,c=b.prototype.initSearch;b.prototype.initSearch=function(){if(this.options.multipleSearch){var b=this.searchText.split(" "),d=this,e=(a.isEmptyObject(this.filterColumns)?null:this.filterColumns,[]);if(1===b.length)c.apply(this,Array.prototype.slice.apply(arguments));else{for(var f=0;f<b.length;f++){var g=b[f].trim();e=g?a.grep(0===e.length?this.options.data:e,function(b,c){for(var e in b){e=a.isNumeric(e)?parseInt(e,10):e;var f=b[e],h=d.columns[a.fn.bootstrapTable.utils.getFieldIndex(d.columns,e)],i=a.inArray(e,d.header.fields);h&&h.searchFormatter&&(f=a.fn.bootstrapTable.utils.calculateObjectValue(h,d.header.formatters[i],[f,b,c],f));var j=a.inArray(e,d.header.fields);if(-1!==j&&d.header.searchables[j]&&("string"==typeof f||"number"==typeof f))if(d.options.strictSearch){if((f+"").toLowerCase()===g)return!0}else if(-1!==(f+"").toLowerCase().indexOf(g))return!0}return!1}):this.data}this.data=e}}else c.apply(this,Array.prototype.slice.apply(arguments))}}(jQuery);