corrade-nucleus-nucleons – Blame information for rev 24
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | /** |
2 | * @author zhixin wen <wenzhixin2010@gmail.com> |
||
3 | * extensions: https://github.com/lukaskral/bootstrap-table-filter |
||
4 | */ |
||
5 | |||
6 | !function($) { |
||
7 | |||
8 | 'use strict'; |
||
9 | |||
10 | $.extend($.fn.bootstrapTable.defaults, { |
||
11 | showFilter: false |
||
12 | }); |
||
13 | |||
14 | var BootstrapTable = $.fn.bootstrapTable.Constructor, |
||
15 | _init = BootstrapTable.prototype.init, |
||
16 | _initSearch = BootstrapTable.prototype.initSearch; |
||
17 | |||
18 | BootstrapTable.prototype.init = function () { |
||
19 | _init.apply(this, Array.prototype.slice.apply(arguments)); |
||
20 | |||
21 | var that = this; |
||
22 | this.$el.on('load-success.bs.table', function () { |
||
23 | if (that.options.showFilter) { |
||
24 | $(that.options.toolbar).bootstrapTableFilter({ |
||
25 | connectTo: that.$el |
||
26 | }); |
||
27 | } |
||
28 | }); |
||
29 | }; |
||
30 | |||
31 | BootstrapTable.prototype.initSearch = function () { |
||
32 | _initSearch.apply(this, Array.prototype.slice.apply(arguments)); |
||
33 | |||
34 | if (this.options.sidePagination !== 'server') { |
||
35 | if (typeof this.searchCallback === 'function') { |
||
36 | this.data = $.grep(this.options.data, this.searchCallback); |
||
37 | } |
||
38 | } |
||
39 | }; |
||
40 | |||
41 | BootstrapTable.prototype.getData = function () { |
||
42 | return (this.searchText || this.searchCallback) ? this.data : this.options.data; |
||
43 | }; |
||
44 | |||
45 | BootstrapTable.prototype.getColumns = function () { |
||
46 | return this.columns; |
||
47 | }; |
||
48 | |||
49 | BootstrapTable.prototype.registerSearchCallback = function (callback) { |
||
50 | this.searchCallback = callback; |
||
51 | }; |
||
52 | |||
53 | BootstrapTable.prototype.updateSearch = function () { |
||
54 | this.options.pageNumber = 1; |
||
55 | this.initSearch(); |
||
56 | this.updatePagination(); |
||
57 | }; |
||
58 | |||
59 | BootstrapTable.prototype.getServerUrl = function () { |
||
60 | return (this.options.sidePagination === 'server') ? this.options.url : false; |
||
61 | }; |
||
62 | |||
63 | $.fn.bootstrapTable.methods.push('getColumns', |
||
64 | 'registerSearchCallback', 'updateSearch', |
||
65 | 'getServerUrl'); |
||
66 | |||
67 | }(jQuery); |