corrade-nucleus-nucleons – Blame information for rev 20
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | /** |
2 | * @author: Dennis Hernández |
||
3 | * @webSite: http://djhvscf.github.io/Blog |
||
4 | * @version: v1.0.0 |
||
5 | */ |
||
6 | |||
7 | !function ($) { |
||
8 | |||
9 | 'use strict'; |
||
10 | |||
11 | $.extend($.fn.bootstrapTable.defaults, { |
||
12 | multipleSearch: false, |
||
13 | delimeter: " " |
||
14 | }); |
||
15 | |||
16 | var BootstrapTable = $.fn.bootstrapTable.Constructor, |
||
17 | _initSearch = BootstrapTable.prototype.initSearch; |
||
18 | |||
19 | BootstrapTable.prototype.initSearch = function () { |
||
20 | if (this.options.multipleSearch) { |
||
21 | if (this.searchText === undefined) { |
||
22 | return; |
||
23 | } |
||
24 | var strArray = this.searchText.split(this.options.delimeter), |
||
25 | that = this, |
||
26 | f = $.isEmptyObject(this.filterColumns) ? null : this.filterColumns, |
||
27 | dataFiltered = []; |
||
28 | |||
29 | if (strArray.length === 1) { |
||
30 | _initSearch.apply(this, Array.prototype.slice.apply(arguments)); |
||
31 | } else { |
||
32 | for (var i = 0; i < strArray.length; i++) { |
||
33 | var str = strArray[i].trim(); |
||
34 | dataFiltered = str ? $.grep(dataFiltered.length === 0 ? this.options.data : dataFiltered, function (item, i) { |
||
35 | for (var key in item) { |
||
36 | key = $.isNumeric(key) ? parseInt(key, 10) : key; |
||
37 | var value = item[key], |
||
38 | column = that.columns[$.fn.bootstrapTable.utils.getFieldIndex(that.columns, key)], |
||
39 | j = $.inArray(key, that.header.fields); |
||
40 | |||
41 | // Fix #142: search use formated data |
||
42 | if (column && column.searchFormatter) { |
||
43 | value = $.fn.bootstrapTable.utils.calculateObjectValue(column, |
||
44 | that.header.formatters[j], [value, item, i], value); |
||
45 | } |
||
46 | |||
47 | var index = $.inArray(key, that.header.fields); |
||
48 | if (index !== -1 && that.header.searchables[index] && (typeof value === 'string' || typeof value === 'number')) { |
||
49 | if (that.options.strictSearch) { |
||
50 | if ((value + '').toLowerCase() === str) { |
||
51 | return true; |
||
52 | } |
||
53 | } else { |
||
54 | if ((value + '').toLowerCase().indexOf(str) !== -1) { |
||
55 | return true; |
||
56 | } |
||
57 | } |
||
58 | } |
||
59 | } |
||
60 | return false; |
||
61 | }) : this.data; |
||
62 | } |
||
63 | |||
64 | this.data = dataFiltered; |
||
65 | } |
||
66 | } else { |
||
67 | _initSearch.apply(this, Array.prototype.slice.apply(arguments)); |
||
68 | } |
||
69 | }; |
||
70 | |||
71 | }(jQuery); |