bootstrap-table-multiple-search.min.js 1.3 KB

1234567
  1. /*
  2. * bootstrap-table - v1.11.1 - 2017-02-22
  3. * https://github.com/wenzhixin/bootstrap-table
  4. * Copyright (c) 2017 zhixin wen
  5. * Licensed MIT License
  6. */
  7. !function(a){"use strict";a.extend(a.fn.bootstrapTable.defaults,{multipleSearch:!1,delimeter:" "});var b=a.fn.bootstrapTable.Constructor,c=b.prototype.initSearch;b.prototype.initSearch=function(){if(this.options.multipleSearch){if(void 0===this.searchText)return;var b=this.searchText.split(this.options.delimeter),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);