effective_datatables 1.4.3 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +25 -2
- data/app/assets/images/dataTables/sort_asc.png +0 -0
- data/app/assets/images/dataTables/sort_both.png +0 -0
- data/app/assets/images/dataTables/sort_desc.png +0 -0
- data/app/assets/javascripts/dataTables/bootstrap/2/jquery.dataTables.bootstrap.js +148 -0
- data/app/assets/javascripts/dataTables/bootstrap/3/jquery.dataTables.bootstrap.js +185 -0
- data/app/assets/javascripts/dataTables/dataTables.colReorder.min.js +26 -0
- data/app/assets/javascripts/dataTables/dataTables.colVis.min.js +24 -0
- data/app/assets/javascripts/dataTables/dataTables.fixedColumns.min.js +30 -0
- data/app/assets/javascripts/dataTables/dataTables.tableTools.min.js +70 -0
- data/app/assets/javascripts/dataTables/jquery.dataTables.min.js +160 -0
- data/app/assets/javascripts/effective_datatables.bootstrap2.js +6 -5
- data/app/assets/javascripts/effective_datatables.js +6 -5
- data/app/assets/javascripts/effective_datatables/initialize.js.coffee.erb +52 -39
- data/app/assets/javascripts/vendor/jquery.debounce.min.js +9 -0
- data/app/assets/stylesheets/dataTables/bootstrap/2/jquery.dataTables.bootstrap.scss +207 -0
- data/app/assets/stylesheets/dataTables/bootstrap/3/jquery.dataTables.bootstrap.scss +280 -0
- data/app/assets/stylesheets/dataTables/dataTables.colReorder.min.css +1 -0
- data/app/assets/stylesheets/dataTables/dataTables.colVis.min.css +1 -0
- data/app/assets/stylesheets/dataTables/dataTables.fixedColumns.min.css +1 -0
- data/app/assets/stylesheets/dataTables/dataTables.tableTools.min.css +1 -0
- data/app/assets/stylesheets/dataTables/jquery.dataTables.min.css +1 -0
- data/app/assets/stylesheets/effective_datatables.bootstrap2.scss +4 -3
- data/app/assets/stylesheets/effective_datatables.scss +4 -3
- data/app/assets/stylesheets/effective_datatables/_overrides.scss.erb +71 -63
- data/app/controllers/effective/datatables_controller.rb +4 -4
- data/app/helpers/effective_datatables_helper.rb +24 -30
- data/app/models/effective/active_record_datatable_tool.rb +6 -6
- data/app/models/effective/array_datatable_tool.rb +18 -8
- data/app/models/effective/datatable.rb +98 -44
- data/app/views/effective/datatables/_datatable.html.haml +41 -15
- data/lib/effective_datatables.rb +0 -1
- data/lib/effective_datatables/version.rb +1 -1
- metadata +20 -17
- data/app/assets/javascripts/vendor/jquery.dataTables.columnFilter.js +0 -832
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fabe5b2b8e75c584dd3eb44ee8481f70f21958b
|
4
|
+
data.tar.gz: 550c680a2636e3d91af2a0e2a6f23b83ca93ac4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49e135394b7e9dd1b47e764fc383a0ff7c5b34832e1454c12e652f24bcfad70b3137a99fc353e62a66b52238d6d59377a6ec7bc694df23f062669f89c071bb97
|
7
|
+
data.tar.gz: 5d19d2a57f249310a51ed07048fe3aae489475261fa1f3203cfa7f3d4d7ef0b74c1ca1eeec2aa863c7caa93ca558d2d87683508630ce0e28edafddf0a8e8872d
|
data/README.md
CHANGED
@@ -285,7 +285,6 @@ table_column :created_at, :filter => {...} # Enable filtering with these opti
|
|
285
285
|
Some additional, lesser used options include:
|
286
286
|
|
287
287
|
```ruby
|
288
|
-
:filter => {:when_hidden => true} # By default a hidden column's search filter will be ignored, unless this is true. Can be used for scoping.
|
289
288
|
:filter => {:fuzzy => true} # Will use an ILIKE/includes rather than = when filtering. Use this for selects.
|
290
289
|
```
|
291
290
|
|
@@ -444,7 +443,7 @@ This gem does its best to provide "just works" filtering of both raw SQL (table_
|
|
444
443
|
|
445
444
|
It's also very easy to override the filter behaviour on a per-column basis.
|
446
445
|
|
447
|
-
Keep in mind,
|
446
|
+
Keep in mind, the filter terms on hidden columns will still be considered in filter results.
|
448
447
|
|
449
448
|
For custom filter behaviour, specify a `def search_column` method in the datatables model file:
|
450
449
|
|
@@ -660,6 +659,30 @@ rescue_from Effective::AccessDenied do |exception|
|
|
660
659
|
end
|
661
660
|
```
|
662
661
|
|
662
|
+
## Examples
|
663
|
+
|
664
|
+
### Search by a belongs_to objects' field
|
665
|
+
|
666
|
+
In this example, a User belongs_to an Applicant. But instead of using the built in belongs_to functionality and displaying a dropdown of users, instead we want to search by the user's email address:
|
667
|
+
|
668
|
+
```ruby
|
669
|
+
module Effective
|
670
|
+
module Datatables
|
671
|
+
class Applicants < Effective::Datatable
|
672
|
+
table_column :id, visible: true
|
673
|
+
|
674
|
+
table_column :user, :type => :string, :column => 'users.email' do |applicant|
|
675
|
+
link_to applicant.user.try(:email), edit_admin_user_path(applicant.user)
|
676
|
+
end
|
677
|
+
|
678
|
+
def collection
|
679
|
+
col = Applicant.joins(:user).includes(:user).references(:user)
|
680
|
+
end
|
681
|
+
end
|
682
|
+
end
|
683
|
+
end
|
684
|
+
```
|
685
|
+
|
663
686
|
|
664
687
|
## License
|
665
688
|
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,148 @@
|
|
1
|
+
/* Set the defaults for DataTables initialisation */
|
2
|
+
$.extend( true, $.fn.dataTable.defaults, {
|
3
|
+
"sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
|
4
|
+
"sPaginationType": "bootstrap",
|
5
|
+
"oLanguage": {
|
6
|
+
"sLengthMenu": "_MENU_ records per page"
|
7
|
+
}
|
8
|
+
} );
|
9
|
+
|
10
|
+
|
11
|
+
/* Default class modification */
|
12
|
+
$.extend( $.fn.dataTableExt.oStdClasses, {
|
13
|
+
"sWrapper": "dataTables_wrapper form-inline"
|
14
|
+
} );
|
15
|
+
|
16
|
+
|
17
|
+
/* API method to get paging information */
|
18
|
+
$.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings )
|
19
|
+
{
|
20
|
+
return {
|
21
|
+
"iStart": oSettings._iDisplayStart,
|
22
|
+
"iEnd": oSettings.fnDisplayEnd(),
|
23
|
+
"iLength": oSettings._iDisplayLength,
|
24
|
+
"iTotal": oSettings.fnRecordsTotal(),
|
25
|
+
"iFilteredTotal": oSettings.fnRecordsDisplay(),
|
26
|
+
"iPage": oSettings._iDisplayLength === -1 ?
|
27
|
+
0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ),
|
28
|
+
"iTotalPages": oSettings._iDisplayLength === -1 ?
|
29
|
+
0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength )
|
30
|
+
};
|
31
|
+
};
|
32
|
+
|
33
|
+
|
34
|
+
/* Bootstrap style pagination control */
|
35
|
+
$.extend( $.fn.dataTableExt.oPagination, {
|
36
|
+
"bootstrap": {
|
37
|
+
"fnInit": function( oSettings, nPaging, fnDraw ) {
|
38
|
+
var oLang = oSettings.oLanguage.oPaginate;
|
39
|
+
var fnClickHandler = function ( e ) {
|
40
|
+
e.preventDefault();
|
41
|
+
if ( oSettings.oApi._fnPageChange(oSettings, e.data.action) ) {
|
42
|
+
fnDraw( oSettings );
|
43
|
+
}
|
44
|
+
};
|
45
|
+
|
46
|
+
$(nPaging).addClass('pagination').append(
|
47
|
+
'<ul>'+
|
48
|
+
'<li class="prev disabled"><a href="#">← '+oLang.sPrevious+'</a></li>'+
|
49
|
+
'<li class="next disabled"><a href="#">'+oLang.sNext+' → </a></li>'+
|
50
|
+
'</ul>'
|
51
|
+
);
|
52
|
+
var els = $('a', nPaging);
|
53
|
+
$(els[0]).bind( 'click.DT', { action: "previous" }, fnClickHandler );
|
54
|
+
$(els[1]).bind( 'click.DT', { action: "next" }, fnClickHandler );
|
55
|
+
},
|
56
|
+
|
57
|
+
"fnUpdate": function ( oSettings, fnDraw ) {
|
58
|
+
var iListLength = 5;
|
59
|
+
var oPaging = oSettings.oInstance.fnPagingInfo();
|
60
|
+
var an = oSettings.aanFeatures.p;
|
61
|
+
var i, ien, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2);
|
62
|
+
|
63
|
+
if ( oPaging.iTotalPages < iListLength) {
|
64
|
+
iStart = 1;
|
65
|
+
iEnd = oPaging.iTotalPages;
|
66
|
+
}
|
67
|
+
else if ( oPaging.iPage <= iHalf ) {
|
68
|
+
iStart = 1;
|
69
|
+
iEnd = iListLength;
|
70
|
+
} else if ( oPaging.iPage >= (oPaging.iTotalPages-iHalf) ) {
|
71
|
+
iStart = oPaging.iTotalPages - iListLength + 1;
|
72
|
+
iEnd = oPaging.iTotalPages;
|
73
|
+
} else {
|
74
|
+
iStart = oPaging.iPage - iHalf + 1;
|
75
|
+
iEnd = iStart + iListLength - 1;
|
76
|
+
}
|
77
|
+
|
78
|
+
for ( i=0, ien=an.length ; i<ien ; i++ ) {
|
79
|
+
// Remove the middle elements
|
80
|
+
$('li:gt(0)', an[i]).filter(':not(:last)').remove();
|
81
|
+
|
82
|
+
// Add the new list items and their event handlers
|
83
|
+
for ( j=iStart ; j<=iEnd ; j++ ) {
|
84
|
+
sClass = (j==oPaging.iPage+1) ? 'class="active"' : '';
|
85
|
+
$('<li '+sClass+'><a href="#">'+j+'</a></li>')
|
86
|
+
.insertBefore( $('li:last', an[i])[0] )
|
87
|
+
.bind('click', function (e) {
|
88
|
+
e.preventDefault();
|
89
|
+
oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength;
|
90
|
+
fnDraw( oSettings );
|
91
|
+
} );
|
92
|
+
}
|
93
|
+
|
94
|
+
// Add / remove disabled classes from the static elements
|
95
|
+
if ( oPaging.iPage === 0 ) {
|
96
|
+
$('li:first', an[i]).addClass('disabled');
|
97
|
+
} else {
|
98
|
+
$('li:first', an[i]).removeClass('disabled');
|
99
|
+
}
|
100
|
+
|
101
|
+
if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) {
|
102
|
+
$('li:last', an[i]).addClass('disabled');
|
103
|
+
} else {
|
104
|
+
$('li:last', an[i]).removeClass('disabled');
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
}
|
109
|
+
} );
|
110
|
+
|
111
|
+
|
112
|
+
/*
|
113
|
+
* TableTools Bootstrap compatibility
|
114
|
+
* Required TableTools 2.1+
|
115
|
+
*/
|
116
|
+
if ( $.fn.DataTable.TableTools ) {
|
117
|
+
// Set the classes that TableTools uses to something suitable for Bootstrap
|
118
|
+
$.extend( true, $.fn.DataTable.TableTools.classes, {
|
119
|
+
"container": "DTTT btn-group",
|
120
|
+
"buttons": {
|
121
|
+
"normal": "btn",
|
122
|
+
"disabled": "disabled"
|
123
|
+
},
|
124
|
+
"collection": {
|
125
|
+
"container": "DTTT_dropdown dropdown-menu",
|
126
|
+
"buttons": {
|
127
|
+
"normal": "",
|
128
|
+
"disabled": "disabled"
|
129
|
+
}
|
130
|
+
},
|
131
|
+
"print": {
|
132
|
+
"info": "DTTT_print_info modal"
|
133
|
+
},
|
134
|
+
"select": {
|
135
|
+
"row": "active"
|
136
|
+
}
|
137
|
+
} );
|
138
|
+
|
139
|
+
// Have the collection use a bootstrap compatible dropdown
|
140
|
+
$.extend( true, $.fn.DataTable.TableTools.DEFAULTS.oTags, {
|
141
|
+
"collection": {
|
142
|
+
"container": "ul",
|
143
|
+
"button": "li",
|
144
|
+
"liner": "a"
|
145
|
+
}
|
146
|
+
} );
|
147
|
+
}
|
148
|
+
|
@@ -0,0 +1,185 @@
|
|
1
|
+
/*! DataTables Bootstrap integration
|
2
|
+
* ©2011-2014 SpryMedia Ltd - datatables.net/license
|
3
|
+
*/
|
4
|
+
|
5
|
+
/**
|
6
|
+
* DataTables integration for Bootstrap 3. This requires Bootstrap 3 and
|
7
|
+
* DataTables 1.10 or newer.
|
8
|
+
*
|
9
|
+
* This file sets the defaults and adds options to DataTables to style its
|
10
|
+
* controls using Bootstrap. See http://datatables.net/manual/styling/bootstrap
|
11
|
+
* for further information.
|
12
|
+
*/
|
13
|
+
(function(window, document, undefined){
|
14
|
+
|
15
|
+
var factory = function( $, DataTable ) {
|
16
|
+
"use strict";
|
17
|
+
|
18
|
+
|
19
|
+
/* Set the defaults for DataTables initialisation */
|
20
|
+
$.extend( true, DataTable.defaults, {
|
21
|
+
dom:
|
22
|
+
"<'row'<'col-xs-6'l><'col-xs-6'f>r>"+
|
23
|
+
"t"+
|
24
|
+
"<'row'<'col-xs-6'i><'col-xs-6'p>>",
|
25
|
+
renderer: 'bootstrap'
|
26
|
+
} );
|
27
|
+
|
28
|
+
|
29
|
+
/* Default class modification */
|
30
|
+
$.extend( DataTable.ext.classes, {
|
31
|
+
sWrapper: "dataTables_wrapper form-inline dt-bootstrap",
|
32
|
+
sFilterInput: "form-control input-sm",
|
33
|
+
sLengthSelect: "form-control input-sm"
|
34
|
+
} );
|
35
|
+
|
36
|
+
|
37
|
+
/* Bootstrap paging button renderer */
|
38
|
+
DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) {
|
39
|
+
var api = new DataTable.Api( settings );
|
40
|
+
var classes = settings.oClasses;
|
41
|
+
var lang = settings.oLanguage.oPaginate;
|
42
|
+
var btnDisplay, btnClass;
|
43
|
+
|
44
|
+
var attach = function( container, buttons ) {
|
45
|
+
var i, ien, node, button;
|
46
|
+
var clickHandler = function ( e ) {
|
47
|
+
e.preventDefault();
|
48
|
+
if ( e.data.action !== 'ellipsis' ) {
|
49
|
+
api.page( e.data.action ).draw( false );
|
50
|
+
}
|
51
|
+
};
|
52
|
+
|
53
|
+
for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
|
54
|
+
button = buttons[i];
|
55
|
+
|
56
|
+
if ( $.isArray( button ) ) {
|
57
|
+
attach( container, button );
|
58
|
+
}
|
59
|
+
else {
|
60
|
+
btnDisplay = '';
|
61
|
+
btnClass = '';
|
62
|
+
|
63
|
+
switch ( button ) {
|
64
|
+
case 'ellipsis':
|
65
|
+
btnDisplay = '…';
|
66
|
+
btnClass = 'disabled';
|
67
|
+
break;
|
68
|
+
|
69
|
+
case 'first':
|
70
|
+
btnDisplay = lang.sFirst;
|
71
|
+
btnClass = button + (page > 0 ?
|
72
|
+
'' : ' disabled');
|
73
|
+
break;
|
74
|
+
|
75
|
+
case 'previous':
|
76
|
+
btnDisplay = lang.sPrevious;
|
77
|
+
btnClass = button + (page > 0 ?
|
78
|
+
'' : ' disabled');
|
79
|
+
break;
|
80
|
+
|
81
|
+
case 'next':
|
82
|
+
btnDisplay = lang.sNext;
|
83
|
+
btnClass = button + (page < pages-1 ?
|
84
|
+
'' : ' disabled');
|
85
|
+
break;
|
86
|
+
|
87
|
+
case 'last':
|
88
|
+
btnDisplay = lang.sLast;
|
89
|
+
btnClass = button + (page < pages-1 ?
|
90
|
+
'' : ' disabled');
|
91
|
+
break;
|
92
|
+
|
93
|
+
default:
|
94
|
+
btnDisplay = button + 1;
|
95
|
+
btnClass = page === button ?
|
96
|
+
'active' : '';
|
97
|
+
break;
|
98
|
+
}
|
99
|
+
|
100
|
+
if ( btnDisplay ) {
|
101
|
+
node = $('<li>', {
|
102
|
+
'class': classes.sPageButton+' '+btnClass,
|
103
|
+
'aria-controls': settings.sTableId,
|
104
|
+
'tabindex': settings.iTabIndex,
|
105
|
+
'id': idx === 0 && typeof button === 'string' ?
|
106
|
+
settings.sTableId +'_'+ button :
|
107
|
+
null
|
108
|
+
} )
|
109
|
+
.append( $('<a>', {
|
110
|
+
'href': '#'
|
111
|
+
} )
|
112
|
+
.html( btnDisplay )
|
113
|
+
)
|
114
|
+
.appendTo( container );
|
115
|
+
|
116
|
+
settings.oApi._fnBindAction(
|
117
|
+
node, {action: button}, clickHandler
|
118
|
+
);
|
119
|
+
}
|
120
|
+
}
|
121
|
+
}
|
122
|
+
};
|
123
|
+
|
124
|
+
attach(
|
125
|
+
$(host).empty().html('<ul class="pagination"/>').children('ul'),
|
126
|
+
buttons
|
127
|
+
);
|
128
|
+
};
|
129
|
+
|
130
|
+
|
131
|
+
/*
|
132
|
+
* TableTools Bootstrap compatibility
|
133
|
+
* Required TableTools 2.1+
|
134
|
+
*/
|
135
|
+
if ( DataTable.TableTools ) {
|
136
|
+
// Set the classes that TableTools uses to something suitable for Bootstrap
|
137
|
+
$.extend( true, DataTable.TableTools.classes, {
|
138
|
+
"container": "DTTT btn-group",
|
139
|
+
"buttons": {
|
140
|
+
"normal": "btn btn-default",
|
141
|
+
"disabled": "disabled"
|
142
|
+
},
|
143
|
+
"collection": {
|
144
|
+
"container": "DTTT_dropdown dropdown-menu",
|
145
|
+
"buttons": {
|
146
|
+
"normal": "",
|
147
|
+
"disabled": "disabled"
|
148
|
+
}
|
149
|
+
},
|
150
|
+
"print": {
|
151
|
+
"info": "DTTT_print_info modal"
|
152
|
+
},
|
153
|
+
"select": {
|
154
|
+
"row": "active"
|
155
|
+
}
|
156
|
+
} );
|
157
|
+
|
158
|
+
// Have the collection use a bootstrap compatible drop down
|
159
|
+
$.extend( true, DataTable.TableTools.DEFAULTS.oTags, {
|
160
|
+
"collection": {
|
161
|
+
"container": "ul",
|
162
|
+
"button": "li",
|
163
|
+
"liner": "a"
|
164
|
+
}
|
165
|
+
} );
|
166
|
+
}
|
167
|
+
|
168
|
+
}; // /factory
|
169
|
+
|
170
|
+
|
171
|
+
// Define as an AMD module if possible
|
172
|
+
if ( typeof define === 'function' && define.amd ) {
|
173
|
+
define( ['jquery', 'datatables'], factory );
|
174
|
+
}
|
175
|
+
else if ( typeof exports === 'object' ) {
|
176
|
+
// Node/CommonJS
|
177
|
+
factory( require('jquery'), require('datatables') );
|
178
|
+
}
|
179
|
+
else if ( jQuery ) {
|
180
|
+
// Otherwise simply initialise as normal, stopping multiple evaluation
|
181
|
+
factory( jQuery, jQuery.fn.dataTable );
|
182
|
+
}
|
183
|
+
|
184
|
+
|
185
|
+
})(window, document);
|
@@ -0,0 +1,26 @@
|
|
1
|
+
/*!
|
2
|
+
ColReorder 1.1.3
|
3
|
+
©2010-2014 SpryMedia Ltd - datatables.net/license
|
4
|
+
*/
|
5
|
+
(function(o,r,s){function p(d){for(var f=[],a=0,b=d.length;a<b;a++)f[d[a]]=a;return f}function l(d,f,a){f=d.splice(f,1)[0];d.splice(a,0,f)}function q(d,f,a){for(var b=[],e=0,h=d.childNodes.length;e<h;e++)1==d.childNodes[e].nodeType&&b.push(d.childNodes[e]);f=b[f];null!==a?d.insertBefore(f,b[a]):d.appendChild(f)}o=function(d){d.fn.dataTableExt.oApi.fnColReorder=function(a,b,e){var h=d.fn.dataTable.Api?!0:!1,c,g,f,m,n=a.aoColumns.length,i,j;i=function(a,b,c){if(a[b]){var e=a[b].split("."),d=e.shift();
|
6
|
+
isNaN(1*d)||(a[b]=c[1*d]+"."+e.join("."))}};if(b!=e)if(0>b||b>=n)this.oApi._fnLog(a,1,"ColReorder 'from' index is out of bounds: "+b);else if(0>e||e>=n)this.oApi._fnLog(a,1,"ColReorder 'to' index is out of bounds: "+e);else{f=[];c=0;for(g=n;c<g;c++)f[c]=c;l(f,b,e);var k=p(f);c=0;for(g=a.aaSorting.length;c<g;c++)a.aaSorting[c][0]=k[a.aaSorting[c][0]];if(null!==a.aaSortingFixed){c=0;for(g=a.aaSortingFixed.length;c<g;c++)a.aaSortingFixed[c][0]=k[a.aaSortingFixed[c][0]]}c=0;for(g=n;c<g;c++){j=a.aoColumns[c];
|
7
|
+
f=0;for(m=j.aDataSort.length;f<m;f++)j.aDataSort[f]=k[j.aDataSort[f]];h&&(j.idx=k[j.idx])}h&&d.each(a.aLastSort,function(b,c){a.aLastSort[b].src=k[c.src]});c=0;for(g=n;c<g;c++)j=a.aoColumns[c],"number"==typeof j.mData?(j.mData=k[j.mData],a.oApi._fnColumnOptions(a,c,{})):d.isPlainObject(j.mData)&&(i(j.mData,"_",k),i(j.mData,"filter",k),i(j.mData,"sort",k),i(j.mData,"type",k),a.oApi._fnColumnOptions(a,c,{}));if(a.aoColumns[b].bVisible){f=this.oApi._fnColumnIndexToVisible(a,b);m=null;for(c=e<b?e:e+1;null===
|
8
|
+
m&&c<n;)m=this.oApi._fnColumnIndexToVisible(a,c),c++;i=a.nTHead.getElementsByTagName("tr");c=0;for(g=i.length;c<g;c++)q(i[c],f,m);if(null!==a.nTFoot){i=a.nTFoot.getElementsByTagName("tr");c=0;for(g=i.length;c<g;c++)q(i[c],f,m)}c=0;for(g=a.aoData.length;c<g;c++)null!==a.aoData[c].nTr&&q(a.aoData[c].nTr,f,m)}l(a.aoColumns,b,e);l(a.aoPreSearchCols,b,e);c=0;for(g=a.aoData.length;c<g;c++)i=a.aoData[c],h?(i.anCells&&l(i.anCells,b,e),"dom"!==i.src&&d.isArray(i._aData)&&l(i._aData,b,e)):(d.isArray(i._aData)&&
|
9
|
+
l(i._aData,b,e),l(i._anHidden,b,e));c=0;for(g=a.aoHeader.length;c<g;c++)l(a.aoHeader[c],b,e);if(null!==a.aoFooter){c=0;for(g=a.aoFooter.length;c<g;c++)l(a.aoFooter[c],b,e)}h&&(new d.fn.dataTable.Api(a)).rows().invalidate();c=0;for(g=n;c<g;c++)d(a.aoColumns[c].nTh).off("click.DT"),this.oApi._fnSortAttachListener(a,a.aoColumns[c].nTh,c);d(a.oInstance).trigger("column-reorder",[a,{iFrom:b,iTo:e,aiInvertMapping:k}])}};var f=function(a,b){var e;d.fn.dataTable.Api?e=(new d.fn.dataTable.Api(a)).settings()[0]:
|
10
|
+
a.fnSettings?e=a.fnSettings():"string"===typeof a?d.fn.dataTable.fnIsDataTable(d(a)[0])&&(e=d(a).eq(0).dataTable().fnSettings()):a.nodeName&&"table"===a.nodeName.toLowerCase()?d.fn.dataTable.fnIsDataTable(a.nodeName)&&(e=d(a.nodeName).dataTable().fnSettings()):a instanceof jQuery?d.fn.dataTable.fnIsDataTable(a[0])&&(e=a.eq(0).dataTable().fnSettings()):e=a;if(e._colReorder)throw"ColReorder already initialised on table #"+e.nTable.id;var h=d.fn.dataTable.camelToHungarian;h&&(h(f.defaults,f.defaults,
|
11
|
+
!0),h(f.defaults,b||{}));this.s={dt:null,init:d.extend(!0,{},f.defaults,b),fixed:0,fixedRight:0,reorderCallback:null,mouse:{startX:-1,startY:-1,offsetX:-1,offsetY:-1,target:-1,targetIndex:-1,fromIndex:-1},aoTargets:[]};this.dom={drag:null,pointer:null};this.s.dt=e;this.s.dt._colReorder=this;this._fnConstruct();e.oApi._fnCallbackReg(e,"aoDestroyCallback",d.proxy(this._fnDestroy,this),"ColReorder");return this};f.prototype={fnReset:function(){for(var a=[],b=0,e=this.s.dt.aoColumns.length;b<e;b++)a.push(this.s.dt.aoColumns[b]._ColReorder_iOrigCol);
|
12
|
+
this._fnOrderColumns(a);return this},fnGetCurrentOrder:function(){return this.fnOrder()},fnOrder:function(a){if(a===s){for(var a=[],b=0,e=this.s.dt.aoColumns.length;b<e;b++)a.push(this.s.dt.aoColumns[b]._ColReorder_iOrigCol);return a}this._fnOrderColumns(p(a));return this},_fnConstruct:function(){var a=this,b=this.s.dt.aoColumns.length,e;this.s.init.iFixedColumns&&(this.s.fixed=this.s.init.iFixedColumns);this.s.fixedRight=this.s.init.iFixedColumnsRight?this.s.init.iFixedColumnsRight:0;this.s.init.fnReorderCallback&&
|
13
|
+
(this.s.reorderCallback=this.s.init.fnReorderCallback);for(e=0;e<b;e++)e>this.s.fixed-1&&e<b-this.s.fixedRight&&this._fnMouseListener(e,this.s.dt.aoColumns[e].nTh),this.s.dt.aoColumns[e]._ColReorder_iOrigCol=e;this.s.dt.oApi._fnCallbackReg(this.s.dt,"aoStateSaveParams",function(b,c){a._fnStateSave.call(a,c)},"ColReorder_State");var d=null;this.s.init.aiOrder&&(d=this.s.init.aiOrder.slice());this.s.dt.oLoadedState&&("undefined"!=typeof this.s.dt.oLoadedState.ColReorder&&this.s.dt.oLoadedState.ColReorder.length==
|
14
|
+
this.s.dt.aoColumns.length)&&(d=this.s.dt.oLoadedState.ColReorder);if(d)if(a.s.dt._bInitComplete)b=p(d),a._fnOrderColumns.call(a,b);else{var c=!1;this.s.dt.aoDrawCallback.push({fn:function(){if(!a.s.dt._bInitComplete&&!c){c=true;var b=p(d);a._fnOrderColumns.call(a,b)}},sName:"ColReorder_Pre"})}else this._fnSetColumnIndexes()},_fnOrderColumns:function(a){if(a.length!=this.s.dt.aoColumns.length)this.s.dt.oInstance.oApi._fnLog(this.s.dt,1,"ColReorder - array reorder does not match known number of columns. Skipping.");
|
15
|
+
else{for(var b=0,e=a.length;b<e;b++){var h=d.inArray(b,a);b!=h&&(l(a,h,b),this.s.dt.oInstance.fnColReorder(h,b))}(""!==this.s.dt.oScroll.sX||""!==this.s.dt.oScroll.sY)&&this.s.dt.oInstance.fnAdjustColumnSizing(!1);this.s.dt.oInstance.oApi._fnSaveState(this.s.dt);this._fnSetColumnIndexes();null!==this.s.reorderCallback&&this.s.reorderCallback.call(this)}},_fnStateSave:function(a){var b,e,h,c=this.s.dt.aoColumns;a.ColReorder=[];if(a.aaSorting){for(b=0;b<a.aaSorting.length;b++)a.aaSorting[b][0]=c[a.aaSorting[b][0]]._ColReorder_iOrigCol;
|
16
|
+
var f=d.extend(!0,[],a.aoSearchCols);b=0;for(e=c.length;b<e;b++)h=c[b]._ColReorder_iOrigCol,a.aoSearchCols[h]=f[b],a.abVisCols[h]=c[b].bVisible,a.ColReorder.push(h)}else if(a.order){for(b=0;b<a.order.length;b++)a.order[b][0]=c[a.order[b][0]]._ColReorder_iOrigCol;f=d.extend(!0,[],a.columns);b=0;for(e=c.length;b<e;b++)h=c[b]._ColReorder_iOrigCol,a.columns[h]=f[b],a.ColReorder.push(h)}},_fnMouseListener:function(a,b){var e=this;d(b).on("mousedown.ColReorder",function(a){a.preventDefault();e._fnMouseDown.call(e,
|
17
|
+
a,b)})},_fnMouseDown:function(a,b){var e=this,f=d(a.target).closest("th, td").offset(),c=parseInt(d(b).attr("data-column-index"),10);c!==s&&(this.s.mouse.startX=a.pageX,this.s.mouse.startY=a.pageY,this.s.mouse.offsetX=a.pageX-f.left,this.s.mouse.offsetY=a.pageY-f.top,this.s.mouse.target=this.s.dt.aoColumns[c].nTh,this.s.mouse.targetIndex=c,this.s.mouse.fromIndex=c,this._fnRegions(),d(r).on("mousemove.ColReorder",function(a){e._fnMouseMove.call(e,a)}).on("mouseup.ColReorder",function(a){e._fnMouseUp.call(e,
|
18
|
+
a)}))},_fnMouseMove:function(a){if(null===this.dom.drag){if(5>Math.pow(Math.pow(a.pageX-this.s.mouse.startX,2)+Math.pow(a.pageY-this.s.mouse.startY,2),0.5))return;this._fnCreateDragNode()}this.dom.drag.css({left:a.pageX-this.s.mouse.offsetX,top:a.pageY-this.s.mouse.offsetY});for(var b=!1,e=this.s.mouse.toIndex,d=1,c=this.s.aoTargets.length;d<c;d++)if(a.pageX<this.s.aoTargets[d-1].x+(this.s.aoTargets[d].x-this.s.aoTargets[d-1].x)/2){this.dom.pointer.css("left",this.s.aoTargets[d-1].x);this.s.mouse.toIndex=
|
19
|
+
this.s.aoTargets[d-1].to;b=!0;break}b||(this.dom.pointer.css("left",this.s.aoTargets[this.s.aoTargets.length-1].x),this.s.mouse.toIndex=this.s.aoTargets[this.s.aoTargets.length-1].to);this.s.init.bRealtime&&e!==this.s.mouse.toIndex&&(this.s.dt.oInstance.fnColReorder(this.s.mouse.fromIndex,this.s.mouse.toIndex),this.s.mouse.fromIndex=this.s.mouse.toIndex,this._fnRegions())},_fnMouseUp:function(){d(r).off("mousemove.ColReorder mouseup.ColReorder");null!==this.dom.drag&&(this.dom.drag.remove(),this.dom.pointer.remove(),
|
20
|
+
this.dom.drag=null,this.dom.pointer=null,this.s.dt.oInstance.fnColReorder(this.s.mouse.fromIndex,this.s.mouse.toIndex),this._fnSetColumnIndexes(),(""!==this.s.dt.oScroll.sX||""!==this.s.dt.oScroll.sY)&&this.s.dt.oInstance.fnAdjustColumnSizing(!1),this.s.dt.oInstance.oApi._fnSaveState(this.s.dt),null!==this.s.reorderCallback&&this.s.reorderCallback.call(this))},_fnRegions:function(){var a=this.s.dt.aoColumns;this.s.aoTargets.splice(0,this.s.aoTargets.length);this.s.aoTargets.push({x:d(this.s.dt.nTable).offset().left,
|
21
|
+
to:0});for(var b=0,e=0,f=a.length;e<f;e++)e!=this.s.mouse.fromIndex&&b++,a[e].bVisible&&this.s.aoTargets.push({x:d(a[e].nTh).offset().left+d(a[e].nTh).outerWidth(),to:b});0!==this.s.fixedRight&&this.s.aoTargets.splice(this.s.aoTargets.length-this.s.fixedRight);0!==this.s.fixed&&this.s.aoTargets.splice(0,this.s.fixed)},_fnCreateDragNode:function(){var a=""!==this.s.dt.oScroll.sX||""!==this.s.dt.oScroll.sY,b=this.s.dt.aoColumns[this.s.mouse.targetIndex].nTh,e=b.parentNode,f=e.parentNode,c=f.parentNode,
|
22
|
+
g=d(b).clone();this.dom.drag=d(c.cloneNode(!1)).addClass("DTCR_clonedTable").append(d(f.cloneNode(!1)).append(d(e.cloneNode(!1)).append(g[0]))).css({position:"absolute",top:0,left:0,width:d(b).outerWidth(),height:d(b).outerHeight()}).appendTo("body");this.dom.pointer=d("<div></div>").addClass("DTCR_pointer").css({position:"absolute",top:a?d("div.dataTables_scroll",this.s.dt.nTableWrapper).offset().top:d(this.s.dt.nTable).offset().top,height:a?d("div.dataTables_scroll",this.s.dt.nTableWrapper).height():
|
23
|
+
d(this.s.dt.nTable).height()}).appendTo("body")},_fnDestroy:function(){var a,b;a=0;for(b=this.s.dt.aoDrawCallback.length;a<b;a++)if("ColReorder_Pre"===this.s.dt.aoDrawCallback[a].sName){this.s.dt.aoDrawCallback.splice(a,1);break}d(this.s.dt.nTHead).find("*").off(".ColReorder");d.each(this.s.dt.aoColumns,function(a,b){d(b.nTh).removeAttr("data-column-index")});this.s=this.s.dt._colReorder=null},_fnSetColumnIndexes:function(){d.each(this.s.dt.aoColumns,function(a,b){d(b.nTh).attr("data-column-index",
|
24
|
+
a)})}};f.defaults={aiOrder:null,bRealtime:!1,iFixedColumns:0,iFixedColumnsRight:0,fnReorderCallback:null};f.version="1.1.3";d.fn.dataTable.ColReorder=f;d.fn.DataTable.ColReorder=f;"function"==typeof d.fn.dataTable&&"function"==typeof d.fn.dataTableExt.fnVersionCheck&&d.fn.dataTableExt.fnVersionCheck("1.9.3")?d.fn.dataTableExt.aoFeatures.push({fnInit:function(a){var b=a.oInstance;a._colReorder?b.oApi._fnLog(a,1,"ColReorder attempted to initialise twice. Ignoring second"):(b=a.oInit,new f(a,b.colReorder||
|
25
|
+
b.oColReorder||{}));return null},cFeature:"R",sFeature:"ColReorder"}):alert("Warning: ColReorder requires DataTables 1.9.3 or greater - www.datatables.net/download");d.fn.dataTable.Api&&(d.fn.dataTable.Api.register("colReorder.reset()",function(){return this.iterator("table",function(a){a._colReorder.fnReset()})}),d.fn.dataTable.Api.register("colReorder.order()",function(a){return a?this.iterator("table",function(b){b._colReorder.fnOrder(a)}):this.context.length?this.context[0]._colReorder.fnOrder():
|
26
|
+
null}));return f};"function"===typeof define&&define.amd?define(["jquery","datatables"],o):"object"===typeof exports?o(require("jquery"),require("datatables")):jQuery&&!jQuery.fn.dataTable.ColReorder&&o(jQuery,jQuery.fn.dataTable)})(window,document);
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/*!
|
2
|
+
ColVis 1.1.2
|
3
|
+
©2010-2015 SpryMedia Ltd - datatables.net/license
|
4
|
+
*/
|
5
|
+
(function(j,i,k){j=function(d){var e=function(a,b){(!this.CLASS||"ColVis"!=this.CLASS)&&alert("Warning: ColVis must be initialised with the keyword 'new'");"undefined"==typeof b&&(b={});var c=d.fn.dataTable.camelToHungarian;c&&(c(e.defaults,e.defaults,!0),c(e.defaults,b));this.s={dt:null,oInit:b,hidden:!0,abOriginal:[]};this.dom={wrapper:null,button:null,collection:null,background:null,catcher:null,buttons:[],groupButtons:[],restore:null};e.aInstances.push(this);this.s.dt=d.fn.dataTable.Api?(new d.fn.dataTable.Api(a)).settings()[0]:
|
6
|
+
a;this._fnConstruct(b);return this};e.prototype={button:function(){return this.dom.wrapper},fnRebuild:function(){this.rebuild()},rebuild:function(){for(var a=this.dom.buttons.length-1;0<=a;a--)this.dom.collection.removeChild(this.dom.buttons[a]);this.dom.buttons.splice(0,this.dom.buttons.length);this.dom.groupButtons.splice(0,this.dom.groupButtons.length);this.dom.restore&&this.dom.restore.parentNode(this.dom.restore);this._fnAddGroups();this._fnAddButtons();this._fnDrawCallback()},_fnConstruct:function(a){this._fnApplyCustomisation(a);
|
7
|
+
var b=this,c,f;this.dom.wrapper=i.createElement("div");this.dom.wrapper.className="ColVis";this.dom.button=d("<button />",{"class":!this.s.dt.bJUI?"ColVis_Button ColVis_MasterButton":"ColVis_Button ColVis_MasterButton ui-button ui-state-default"}).append("<span>"+this.s.buttonText+"</span>").bind("mouseover"==this.s.activate?"mouseover":"click",function(a){a.preventDefault();b._fnCollectionShow()}).appendTo(this.dom.wrapper)[0];this.dom.catcher=this._fnDomCatcher();this.dom.collection=this._fnDomCollection();
|
8
|
+
this.dom.background=this._fnDomBackground();this._fnAddGroups();this._fnAddButtons();c=0;for(f=this.s.dt.aoColumns.length;c<f;c++)this.s.abOriginal.push(this.s.dt.aoColumns[c].bVisible);this.s.dt.aoDrawCallback.push({fn:function(){b._fnDrawCallback.call(b)},sName:"ColVis"});d(this.s.dt.oInstance).bind("column-reorder.dt",function(a,d,e){c=0;for(f=b.s.aiExclude.length;c<f;c++)b.s.aiExclude[c]=e.aiInvertMapping[b.s.aiExclude[c]];a=b.s.abOriginal.splice(e.iFrom,1)[0];b.s.abOriginal.splice(e.iTo,0,a);
|
9
|
+
b.fnRebuild()});d(this.s.dt.oInstance).bind("destroy.dt",function(){d(b.dom.wrapper).remove()});this._fnDrawCallback()},_fnApplyCustomisation:function(a){d.extend(!0,this.s,e.defaults,a);!this.s.showAll&&this.s.bShowAll&&(this.s.showAll=this.s.sShowAll);!this.s.restore&&this.s.bRestore&&(this.s.restore=this.s.sRestore);var a=this.s.groups,b=this.s.aoGroups;if(a)for(var c=0,f=a.length;c<f;c++)if(a[c].title&&(b[c].sTitle=a[c].title),a[c].columns)b[c].aiColumns=a[c].columns},_fnDrawCallback:function(){for(var a=
|
10
|
+
this.s.dt.aoColumns,b=this.dom.buttons,c=this.s.aoGroups,f,g=0,h=b.length;g<h;g++)f=b[g],f.__columnIdx!==k&&d("input",f).prop("checked",a[f.__columnIdx].bVisible);b=0;for(f=c.length;b<f;b++){a:{for(var g=c[b].aiColumns,h=0,e=g.length;h<e;h++)if(!1===a[g[h]].bVisible){g=!1;break a}g=!0}if(g)d("input",this.dom.groupButtons[b]).prop("checked",!0),d("input",this.dom.groupButtons[b]).prop("indeterminate",!1);else{a:{g=c[b].aiColumns;h=0;for(e=g.length;h<e;h++)if(!0===a[g[h]].bVisible){g=!1;break a}g=!0}g?
|
11
|
+
(d("input",this.dom.groupButtons[b]).prop("checked",!1),d("input",this.dom.groupButtons[b]).prop("indeterminate",!1)):d("input",this.dom.groupButtons[b]).prop("indeterminate",!0)}}},_fnAddGroups:function(){var a;if("undefined"!=typeof this.s.aoGroups)for(var b=0,c=this.s.aoGroups.length;b<c;b++)a=this._fnDomGroupButton(b),this.dom.groupButtons.push(a),this.dom.buttons.push(a),this.dom.collection.appendChild(a)},_fnAddButtons:function(){var a,b=this.s.dt.aoColumns;if(-1===d.inArray("all",this.s.aiExclude))for(var c=
|
12
|
+
0,f=b.length;c<f;c++)-1===d.inArray(c,this.s.aiExclude)&&(a=this._fnDomColumnButton(c),a.__columnIdx=c,this.dom.buttons.push(a));"alpha"===this.s.order&&this.dom.buttons.sort(function(a,c){var d=b[a.__columnIdx].sTitle,f=b[c.__columnIdx].sTitle;return d===f?0:d<f?-1:1});this.s.restore&&(a=this._fnDomRestoreButton(),a.className+=" ColVis_Restore",this.dom.buttons.push(a));this.s.showAll&&(a=this._fnDomShowXButton(this.s.showAll,!0),a.className+=" ColVis_ShowAll",this.dom.buttons.push(a));this.s.showNone&&
|
13
|
+
(a=this._fnDomShowXButton(this.s.showNone,!1),a.className+=" ColVis_ShowNone",this.dom.buttons.push(a));d(this.dom.collection).append(this.dom.buttons)},_fnDomRestoreButton:function(){var a=this;return d('<li class="ColVis_Special '+(this.s.dt.bJUI?"ui-button ui-state-default":"")+'">'+this.s.restore+"</li>").click(function(){for(var b=0,c=a.s.abOriginal.length;b<c;b++)a.s.dt.oInstance.fnSetColumnVis(b,a.s.abOriginal[b],!1);a._fnAdjustOpenRows();a.s.dt.oInstance.fnAdjustColumnSizing(!1);a.s.dt.oInstance.fnDraw(!1)})[0]},
|
14
|
+
_fnDomShowXButton:function(a,b){var c=this;return d('<li class="ColVis_Special '+(this.s.dt.bJUI?"ui-button ui-state-default":"")+'">'+a+"</li>").click(function(){for(var a=0,d=c.s.abOriginal.length;a<d;a++)-1===c.s.aiExclude.indexOf(a)&&c.s.dt.oInstance.fnSetColumnVis(a,b,!1);c._fnAdjustOpenRows();c.s.dt.oInstance.fnAdjustColumnSizing(!1);c.s.dt.oInstance.fnDraw(!1)})[0]},_fnDomGroupButton:function(a){var b=this,c=this.s.aoGroups[a];return d('<li class="ColVis_Special '+(this.s.dt.bJUI?"ui-button ui-state-default":
|
15
|
+
"")+'"><label><input type="checkbox" /><span>'+c.sTitle+"</span></label></li>").click(function(a){var g=!d("input",this).is(":checked");"li"!==a.target.nodeName.toLowerCase()&&(g=!g);for(a=0;a<c.aiColumns.length;a++)b.s.dt.oInstance.fnSetColumnVis(c.aiColumns[a],g)})[0]},_fnDomColumnButton:function(a){var b=this,c=this.s.dt.aoColumns[a],f=this.s.dt,c=null===this.s.fnLabel?c.sTitle:this.s.fnLabel(a,c.sTitle,c.nTh);return d("<li "+(f.bJUI?'class="ui-button ui-state-default"':"")+'><label><input type="checkbox" /><span>'+
|
16
|
+
c+"</span></label></li>").click(function(c){var e=!d("input",this).is(":checked");if("li"!==c.target.nodeName.toLowerCase()&&("input"==c.target.nodeName.toLowerCase()||null===b.s.fnStateChange))e=!e;var i=d.fn.dataTableExt.iApiIndex;d.fn.dataTableExt.iApiIndex=b._fnDataTablesApiIndex.call(b);f.oFeatures.bServerSide?(b.s.dt.oInstance.fnSetColumnVis(a,e,!1),b.s.dt.oInstance.fnAdjustColumnSizing(!1),(""!==f.oScroll.sX||""!==f.oScroll.sY)&&b.s.dt.oInstance.oApi._fnScrollDraw(b.s.dt),b._fnDrawCallback()):
|
17
|
+
b.s.dt.oInstance.fnSetColumnVis(a,e);d.fn.dataTableExt.iApiIndex=i;null!==b.s.fnStateChange&&("span"==c.target.nodeName.toLowerCase()&&c.preventDefault(),b.s.fnStateChange.call(b,a,e))})[0]},_fnDataTablesApiIndex:function(){for(var a=0,b=this.s.dt.oInstance.length;a<b;a++)if(this.s.dt.oInstance[a]==this.s.dt.nTable)return a;return 0},_fnDomCollection:function(){return d("<ul />",{"class":!this.s.dt.bJUI?"ColVis_collection":"ColVis_collection ui-buttonset ui-buttonset-multi"}).css({display:"none",
|
18
|
+
opacity:0,position:!this.s.bCssPosition?"absolute":""})[0]},_fnDomCatcher:function(){var a=this,b=i.createElement("div");b.className="ColVis_catcher";d(b).click(function(){a._fnCollectionHide.call(a,null,null)});return b},_fnDomBackground:function(){var a=this,b=d("<div></div>").addClass("ColVis_collectionBackground").css("opacity",0).click(function(){a._fnCollectionHide.call(a,null,null)});"mouseover"==this.s.activate&&b.mouseover(function(){a.s.overcollection=!1;a._fnCollectionHide.call(a,null,
|
19
|
+
null)});return b[0]},_fnCollectionShow:function(){var a=this,b;b=d(this.dom.button).offset();var c=this.dom.collection,f=this.dom.background,e=parseInt(b.left,10),h=parseInt(b.top+d(this.dom.button).outerHeight(),10);this.s.bCssPosition||(c.style.top=h+"px",c.style.left=e+"px");d(c).css({display:"block",opacity:0});f.style.bottom="0px";f.style.right="0px";h=this.dom.catcher.style;h.height=d(this.dom.button).outerHeight()+"px";h.width=d(this.dom.button).outerWidth()+"px";h.top=b.top+"px";h.left=e+
|
20
|
+
"px";i.body.appendChild(f);i.body.appendChild(c);i.body.appendChild(this.dom.catcher);d(c).animate({opacity:1},a.s.iOverlayFade);d(f).animate({opacity:0.1},a.s.iOverlayFade,"linear",function(){d.browser&&(d.browser.msie&&d.browser.version=="6.0")&&a._fnDrawCallback()});this.s.bCssPosition||(b="left"==this.s.sAlign?e:e-d(c).outerWidth()+d(this.dom.button).outerWidth(),c.style.left=b+"px",f=d(c).outerWidth(),d(c).outerHeight(),e=d(i).width(),b+f>e&&(c.style.left=e-f+"px"));this.s.hidden=!1},_fnCollectionHide:function(){var a=
|
21
|
+
this;!this.s.hidden&&null!==this.dom.collection&&(this.s.hidden=!0,d(this.dom.collection).animate({opacity:0},a.s.iOverlayFade,function(){this.style.display="none"}),d(this.dom.background).animate({opacity:0},a.s.iOverlayFade,function(){i.body.removeChild(a.dom.background);i.body.removeChild(a.dom.catcher)}))},_fnAdjustOpenRows:function(){for(var a=this.s.dt.aoOpenRows,b=this.s.dt.oApi._fnVisbleColumns(this.s.dt),c=0,d=a.length;c<d;c++)a[c].nTr.getElementsByTagName("td")[0].colSpan=b}};e.fnRebuild=
|
22
|
+
function(a){var b=null;"undefined"!=typeof a&&(b=d.fn.dataTable.Api?(new d.fn.dataTable.Api(a)).table().node():a.fnSettings().nTable);for(var c=0,f=e.aInstances.length;c<f;c++)("undefined"==typeof a||b==e.aInstances[c].s.dt.nTable)&&e.aInstances[c].fnRebuild()};e.defaults={active:"click",buttonText:"Show / hide columns",aiExclude:[],bRestore:!1,sRestore:"Restore original",bShowAll:!1,sShowAll:"Show All",sAlign:"left",fnStateChange:null,iOverlayFade:500,fnLabel:null,bCssPosition:!1,aoGroups:[],order:"column"};
|
23
|
+
e.aInstances=[];e.prototype.CLASS="ColVis";e.VERSION="1.1.2";e.prototype.VERSION=e.VERSION;"function"==typeof d.fn.dataTable&&"function"==typeof d.fn.dataTableExt.fnVersionCheck&&d.fn.dataTableExt.fnVersionCheck("1.7.0")?d.fn.dataTableExt.aoFeatures.push({fnInit:function(a){var b=a.oInit;return(new e(a,b.colVis||b.oColVis||{})).button()},cFeature:"C",sFeature:"ColVis"}):alert("Warning: ColVis requires DataTables 1.7 or greater - www.datatables.net/download");d.fn.dataTable.ColVis=e;return d.fn.DataTable.ColVis=
|
24
|
+
e};"function"===typeof define&&define.amd?define(["jquery","datatables"],j):"object"===typeof exports?j(require("jquery"),require("datatables")):jQuery&&!jQuery.fn.dataTable.ColVis&&j(jQuery,jQuery.fn.dataTable)})(window,document);
|