jquery-datatables 1.10.13 → 1.10.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -3
- data/Rakefile +1 -1
- data/app/assets/javascripts/datatables/dataTables.bootstrap2.js +162 -0
- data/app/assets/javascripts/datatables/dataTables.bootstrap4.js +7 -7
- data/app/assets/javascripts/datatables/dataTables.semanticui.js +2 -2
- data/app/assets/javascripts/datatables/extensions/AutoFill/dataTables.autoFill.js +104 -13
- data/app/assets/javascripts/datatables/extensions/Buttons/buttons.colVis.js +17 -9
- data/app/assets/javascripts/datatables/extensions/Buttons/buttons.flash.js +41 -15
- data/app/assets/javascripts/datatables/extensions/Buttons/buttons.html5.js +48 -18
- data/app/assets/javascripts/datatables/extensions/Buttons/buttons.print.js +29 -13
- data/app/assets/javascripts/datatables/extensions/Buttons/dataTables.buttons.js +46 -5
- data/app/assets/javascripts/datatables/extensions/ColReorder/dataTables.colReorder.js +37 -19
- data/app/assets/javascripts/datatables/extensions/KeyTable/dataTables.keyTable.js +65 -37
- data/app/assets/javascripts/datatables/extensions/RowGroup/dataTables.rowGroup.js +386 -0
- data/app/assets/javascripts/datatables/extensions/Select/dataTables.select.js +24 -14
- data/app/assets/javascripts/datatables/jquery.dataTables.js +48 -10
- data/app/assets/stylesheets/datatables/dataTables.bootstrap.css +7 -7
- data/app/assets/stylesheets/datatables/dataTables.bootstrap2.css +178 -0
- data/app/assets/stylesheets/datatables/dataTables.bootstrap4.css +1 -0
- data/app/assets/stylesheets/datatables/dataTables.foundation.css +8 -6
- data/app/assets/stylesheets/datatables/dataTables.jqueryui.css +6 -5
- data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.bootstrap.css +56 -0
- data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.bootstrap4.css +56 -0
- data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.dataTables.css +56 -0
- data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.foundation.css +60 -0
- data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.jqueryui.css +56 -0
- data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.semanticui.css +57 -0
- data/app/assets/stylesheets/datatables/extensions/Buttons/mixins.scss +47 -0
- data/app/assets/stylesheets/datatables/extensions/RowGroup/rowGroup.bootstrap.css +4 -0
- data/app/assets/stylesheets/datatables/extensions/RowGroup/rowGroup.bootstrap4.css +4 -0
- data/app/assets/stylesheets/datatables/extensions/RowGroup/rowGroup.dataTables.css +4 -0
- data/app/assets/stylesheets/datatables/extensions/RowGroup/rowGroup.foundation.css +4 -0
- data/app/assets/stylesheets/datatables/extensions/RowGroup/rowGroup.jqueryui.css +4 -0
- data/app/assets/stylesheets/datatables/extensions/RowGroup/rowGroup.semanticui.css +4 -0
- data/app/assets/stylesheets/datatables/extensions/Select/select.bootstrap.css +7 -7
- data/app/assets/stylesheets/datatables/extensions/Select/select.bootstrap4.css +7 -7
- data/app/assets/stylesheets/datatables/extensions/Select/select.dataTables.css +7 -7
- data/app/assets/stylesheets/datatables/extensions/Select/select.foundation.css +7 -7
- data/app/assets/stylesheets/datatables/extensions/Select/select.jqueryui.css +7 -7
- data/app/assets/stylesheets/datatables/extensions/Select/select.semanticui.css +7 -7
- data/app/assets/stylesheets/datatables/jquery.dataTables.css +14 -11
- data/lib/generators/jquery/datatables/templates/bootstrap2.css.tt +15 -0
- data/lib/generators/jquery/datatables/templates/bootstrap2.js.tt +22 -0
- data/lib/jquery-datatables/version.rb +1 -1
- metadata +14 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 236b87ab9a5acc3e8d1b7f36de1a9c759a758735
|
4
|
+
data.tar.gz: 34548dbb8cfa48d3b40dc055cc96aacfed251a68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65964e17c7052585ab64d0bc25cb16a45f506c77786d2a055e4d988813289f89740ad15aa3450a04008e83a6a3ae0b2d5d12230245da707c4a7a03a5267fae4b
|
7
|
+
data.tar.gz: 53a1cfde92f8afe6e94f3c3a4a70a396c7d32db464b20c3ccad207748b20068efae32d3b417e9fc2c31bcf25f19c8cff4a79f8eff5b9a1e905b2a85aa3246122
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# jquery-datatables [![Gem Version](https://badge.fury.io/rb/jquery-datatables.svg)](http://badge.fury.io/rb/jquery-datatables)
|
2
2
|
Jquery datatables assets pipeline :: sprockets
|
3
3
|
|
4
|
-
Include [jQuery DataTables](http://www.datatables.net/) in your asset pipeline with ease using [
|
4
|
+
Include [jQuery DataTables](http://www.datatables.net/) in your asset pipeline with ease using [jquery-datatables](https://rubygems.org/gems/jquery-datatables) gem.
|
5
5
|
|
6
6
|
## Gem Installation
|
7
7
|
|
@@ -38,7 +38,7 @@ rails g jquery:datatables:install bootstrap
|
|
38
38
|
this generator will:
|
39
39
|
- 1. append ```//= require datatables ``` add `app/assets/javascripts/application.js`
|
40
40
|
- 2. append ```*= require datatables ``` add `app/assets/stylesheets/application.css`
|
41
|
-
- 3. create datatable.js in ```app/assets/
|
41
|
+
- 3. create datatable.js in ```app/assets/javascripts/```
|
42
42
|
- 4. create datatable.css in ```app/assets/stylesheets/```
|
43
43
|
|
44
44
|
## Manual install
|
@@ -107,7 +107,6 @@ $(document).ready(function() {
|
|
107
107
|
```
|
108
108
|
|
109
109
|
## Todo
|
110
|
-
- add plugins
|
111
110
|
- update instructions
|
112
111
|
|
113
112
|
## Contributing
|
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
|
3
3
|
datatables_dir = "DataTablesSrc"
|
4
|
-
extensions = %w(AutoFill Buttons ColReorder FixedColumns FixedHeader KeyTable Responsive RowReorder Scroller Select)
|
4
|
+
extensions = %w(AutoFill Buttons ColReorder FixedColumns FixedHeader KeyTable Responsive RowReorder Scroller Select RowGroup)
|
5
5
|
frameworks = %w(regular bootstrap bootstrap4 foundation jqueryui material semanticui uikit)
|
6
6
|
|
7
7
|
namespace :images do
|
@@ -0,0 +1,162 @@
|
|
1
|
+
/*! DataTables Bootstrap 2 integration
|
2
|
+
* ©2011-2014 SpryMedia Ltd - datatables.net/license
|
3
|
+
*/
|
4
|
+
|
5
|
+
/**
|
6
|
+
* DataTables integration for Bootstrap 2. This requires Bootstrap 2 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, $, DataTable, undefined){
|
14
|
+
|
15
|
+
$.extend( true, DataTable.defaults, {
|
16
|
+
"dom":
|
17
|
+
"<'row-fluid'<'span6'l><'span6'f>r>" +
|
18
|
+
"<'row-fluid'<'span12't>>" +
|
19
|
+
"<'row-fluid'<'span6'i><'span6'p>>",
|
20
|
+
renderer: 'bootstrap'
|
21
|
+
} );
|
22
|
+
|
23
|
+
|
24
|
+
/* Default class modification */
|
25
|
+
$.extend( DataTable.ext.classes, {
|
26
|
+
sWrapper: "dataTables_wrapper form-inline dt-bootstrap"
|
27
|
+
} );
|
28
|
+
|
29
|
+
|
30
|
+
/* Bootstrap paging button renderer */
|
31
|
+
DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) {
|
32
|
+
var api = new DataTable.Api( settings );
|
33
|
+
var classes = settings.oClasses;
|
34
|
+
var lang = settings.oLanguage.oPaginate;
|
35
|
+
var btnDisplay, btnClass;
|
36
|
+
|
37
|
+
var attach = function( container, buttons ) {
|
38
|
+
var i, ien, node, button;
|
39
|
+
var clickHandler = function ( e ) {
|
40
|
+
e.preventDefault();
|
41
|
+
if ( !$(e.currentTarget).hasClass('disabled') ) {
|
42
|
+
api.page( e.data.action ).draw( false );
|
43
|
+
}
|
44
|
+
};
|
45
|
+
|
46
|
+
for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
|
47
|
+
button = buttons[i];
|
48
|
+
|
49
|
+
if ( $.isArray( button ) ) {
|
50
|
+
attach( container, button );
|
51
|
+
}
|
52
|
+
else {
|
53
|
+
btnDisplay = '';
|
54
|
+
btnClass = '';
|
55
|
+
|
56
|
+
switch ( button ) {
|
57
|
+
case 'ellipsis':
|
58
|
+
btnDisplay = '…';
|
59
|
+
btnClass = 'disabled';
|
60
|
+
break;
|
61
|
+
|
62
|
+
case 'first':
|
63
|
+
btnDisplay = lang.sFirst;
|
64
|
+
btnClass = button + (page > 0 ?
|
65
|
+
'' : ' disabled');
|
66
|
+
break;
|
67
|
+
|
68
|
+
case 'previous':
|
69
|
+
btnDisplay = lang.sPrevious;
|
70
|
+
btnClass = button + (page > 0 ?
|
71
|
+
'' : ' disabled');
|
72
|
+
break;
|
73
|
+
|
74
|
+
case 'next':
|
75
|
+
btnDisplay = lang.sNext;
|
76
|
+
btnClass = button + (page < pages-1 ?
|
77
|
+
'' : ' disabled');
|
78
|
+
break;
|
79
|
+
|
80
|
+
case 'last':
|
81
|
+
btnDisplay = lang.sLast;
|
82
|
+
btnClass = button + (page < pages-1 ?
|
83
|
+
'' : ' disabled');
|
84
|
+
break;
|
85
|
+
|
86
|
+
default:
|
87
|
+
btnDisplay = button + 1;
|
88
|
+
btnClass = page === button ?
|
89
|
+
'active' : '';
|
90
|
+
break;
|
91
|
+
}
|
92
|
+
|
93
|
+
if ( btnDisplay ) {
|
94
|
+
node = $('<li>', {
|
95
|
+
'class': classes.sPageButton+' '+btnClass,
|
96
|
+
'aria-controls': settings.sTableId,
|
97
|
+
'tabindex': settings.iTabIndex,
|
98
|
+
'id': idx === 0 && typeof button === 'string' ?
|
99
|
+
settings.sTableId +'_'+ button :
|
100
|
+
null
|
101
|
+
} )
|
102
|
+
.append( $('<a>', {
|
103
|
+
'href': '#'
|
104
|
+
} )
|
105
|
+
.html( btnDisplay )
|
106
|
+
)
|
107
|
+
.appendTo( container );
|
108
|
+
|
109
|
+
settings.oApi._fnBindAction(
|
110
|
+
node, {action: button}, clickHandler
|
111
|
+
);
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
};
|
116
|
+
|
117
|
+
attach(
|
118
|
+
$(host).empty().html('<div class="pagination"><ul/></div>').find('ul'),
|
119
|
+
buttons
|
120
|
+
);
|
121
|
+
};
|
122
|
+
|
123
|
+
|
124
|
+
/*
|
125
|
+
* TableTools Bootstrap compatibility
|
126
|
+
* Required TableTools 2.1+
|
127
|
+
*/
|
128
|
+
if ( DataTable.TableTools ) {
|
129
|
+
// Set the classes that TableTools uses to something suitable for Bootstrap
|
130
|
+
$.extend( true, DataTable.TableTools.classes, {
|
131
|
+
"container": "DTTT btn-group",
|
132
|
+
"buttons": {
|
133
|
+
"normal": "btn",
|
134
|
+
"disabled": "disabled"
|
135
|
+
},
|
136
|
+
"collection": {
|
137
|
+
"container": "DTTT_dropdown dropdown-menu",
|
138
|
+
"buttons": {
|
139
|
+
"normal": "",
|
140
|
+
"disabled": "disabled"
|
141
|
+
}
|
142
|
+
},
|
143
|
+
"print": {
|
144
|
+
"info": "DTTT_print_info modal"
|
145
|
+
},
|
146
|
+
"select": {
|
147
|
+
"row": "active"
|
148
|
+
}
|
149
|
+
} );
|
150
|
+
|
151
|
+
// Have the collection use a bootstrap compatible dropdown
|
152
|
+
$.extend( true, DataTable.TableTools.DEFAULTS.oTags, {
|
153
|
+
"collection": {
|
154
|
+
"container": "ul",
|
155
|
+
"button": "li",
|
156
|
+
"liner": "a"
|
157
|
+
}
|
158
|
+
} );
|
159
|
+
}
|
160
|
+
|
161
|
+
|
162
|
+
})(window, document, jQuery, jQuery.fn.dataTable);
|
@@ -46,19 +46,19 @@ var DataTable = $.fn.dataTable;
|
|
46
46
|
/* Set the defaults for DataTables initialisation */
|
47
47
|
$.extend( true, DataTable.defaults, {
|
48
48
|
dom:
|
49
|
-
"<'row'<'col-
|
50
|
-
"<'row'<'col-
|
51
|
-
"<'row'<'col-
|
49
|
+
"<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>>" +
|
50
|
+
"<'row'<'col-sm-12'tr>>" +
|
51
|
+
"<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
|
52
52
|
renderer: 'bootstrap'
|
53
53
|
} );
|
54
54
|
|
55
55
|
|
56
56
|
/* Default class modification */
|
57
57
|
$.extend( DataTable.ext.classes, {
|
58
|
-
sWrapper: "dataTables_wrapper
|
59
|
-
sFilterInput: "form-control
|
60
|
-
sLengthSelect: "form-control
|
61
|
-
sProcessing: "dataTables_processing
|
58
|
+
sWrapper: "dataTables_wrapper container-fluid dt-bootstrap4",
|
59
|
+
sFilterInput: "form-control form-control-sm",
|
60
|
+
sLengthSelect: "form-control form-control-sm",
|
61
|
+
sProcessing: "dataTables_processing card",
|
62
62
|
sPageButton: "paginate_button page-item"
|
63
63
|
} );
|
64
64
|
|
@@ -46,7 +46,7 @@ var DataTable = $.fn.dataTable;
|
|
46
46
|
/* Set the defaults for DataTables initialisation */
|
47
47
|
$.extend( true, DataTable.defaults, {
|
48
48
|
dom:
|
49
|
-
"<'ui grid'"+
|
49
|
+
"<'ui stackable grid'"+
|
50
50
|
"<'row'"+
|
51
51
|
"<'eight wide column'l>"+
|
52
52
|
"<'right aligned eight wide column'f>"+
|
@@ -179,7 +179,7 @@ DataTable.ext.renderer.pageButton.semanticUI = function ( settings, host, idx, b
|
|
179
179
|
catch (e) {}
|
180
180
|
|
181
181
|
attach(
|
182
|
-
$(host).empty().html('<div class="ui pagination menu"/>').children(),
|
182
|
+
$(host).empty().html('<div class="ui stackable pagination menu"/>').children(),
|
183
183
|
buttons
|
184
184
|
);
|
185
185
|
|
@@ -1,11 +1,11 @@
|
|
1
|
-
/*! AutoFill 2.
|
1
|
+
/*! AutoFill 2.2.0
|
2
2
|
* ©2008-2016 SpryMedia Ltd - datatables.net/license
|
3
3
|
*/
|
4
4
|
|
5
5
|
/**
|
6
6
|
* @summary AutoFill
|
7
7
|
* @description Add Excel like click and drag auto-fill options to DataTables
|
8
|
-
* @version 2.
|
8
|
+
* @version 2.2.0
|
9
9
|
* @file dataTables.autoFill.js
|
10
10
|
* @author SpryMedia Ltd (www.sprymedia.co.uk)
|
11
11
|
* @contact www.sprymedia.co.uk/contact
|
@@ -92,7 +92,13 @@ var AutoFill = function( dt, opts )
|
|
92
92
|
handle: {
|
93
93
|
height: 0,
|
94
94
|
width: 0
|
95
|
-
}
|
95
|
+
},
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Enabled setting
|
99
|
+
* @type {Boolean}
|
100
|
+
*/
|
101
|
+
enabled: false
|
96
102
|
};
|
97
103
|
|
98
104
|
|
@@ -136,6 +142,45 @@ var AutoFill = function( dt, opts )
|
|
136
142
|
|
137
143
|
|
138
144
|
$.extend( AutoFill.prototype, {
|
145
|
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
146
|
+
* Public methods (exposed via the DataTables API below)
|
147
|
+
*/
|
148
|
+
enabled: function ()
|
149
|
+
{
|
150
|
+
return this.s.enabled;
|
151
|
+
},
|
152
|
+
|
153
|
+
|
154
|
+
enable: function ( flag )
|
155
|
+
{
|
156
|
+
var that = this;
|
157
|
+
|
158
|
+
if ( flag === false ) {
|
159
|
+
return this.disable();
|
160
|
+
}
|
161
|
+
|
162
|
+
this.s.enabled = true;
|
163
|
+
|
164
|
+
this._focusListener();
|
165
|
+
|
166
|
+
this.dom.handle.on( 'mousedown', function (e) {
|
167
|
+
that._mousedown( e );
|
168
|
+
return false;
|
169
|
+
} );
|
170
|
+
|
171
|
+
return this;
|
172
|
+
},
|
173
|
+
|
174
|
+
disable: function ()
|
175
|
+
{
|
176
|
+
this.s.enabled = false;
|
177
|
+
|
178
|
+
this._focusListenerRemove();
|
179
|
+
|
180
|
+
return this;
|
181
|
+
},
|
182
|
+
|
183
|
+
|
139
184
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
140
185
|
* Constructor
|
141
186
|
*/
|
@@ -151,6 +196,9 @@ $.extend( AutoFill.prototype, {
|
|
151
196
|
var dt = this.s.dt;
|
152
197
|
var dtScroll = $('div.dataTables_scrollBody', this.s.dt.table().container());
|
153
198
|
|
199
|
+
// Make the instance accessible to the API
|
200
|
+
dt.settings()[0].autoFill = this;
|
201
|
+
|
154
202
|
if ( dtScroll.length ) {
|
155
203
|
this.dom.dtScroll = dtScroll;
|
156
204
|
|
@@ -160,17 +208,12 @@ $.extend( AutoFill.prototype, {
|
|
160
208
|
}
|
161
209
|
}
|
162
210
|
|
163
|
-
this.
|
164
|
-
|
165
|
-
|
166
|
-
that._mousedown( e );
|
167
|
-
return false;
|
168
|
-
} );
|
211
|
+
if ( this.c.enable !== false ) {
|
212
|
+
this.enable();
|
213
|
+
}
|
169
214
|
|
170
215
|
dt.on( 'destroy.autoFill', function () {
|
171
|
-
|
172
|
-
$(dt.table().body()).off( that.s.namespace );
|
173
|
-
$(document.body).off( that.s.namespace );
|
216
|
+
that._focusListenerRemove();
|
174
217
|
} );
|
175
218
|
},
|
176
219
|
|
@@ -516,6 +559,16 @@ $.extend( AutoFill.prototype, {
|
|
516
559
|
},
|
517
560
|
|
518
561
|
|
562
|
+
_focusListenerRemove: function ()
|
563
|
+
{
|
564
|
+
var dt = this.s.dt;
|
565
|
+
|
566
|
+
dt.off( '.autoFill' );
|
567
|
+
$(dt.table().body()).off( this.s.namespace );
|
568
|
+
$(document.body).off( this.s.namespace );
|
569
|
+
},
|
570
|
+
|
571
|
+
|
519
572
|
/**
|
520
573
|
* Get the position of a node, relative to another, including any scrolling
|
521
574
|
* offsets.
|
@@ -1002,7 +1055,7 @@ AutoFill.actions = {
|
|
1002
1055
|
* @static
|
1003
1056
|
* @type String
|
1004
1057
|
*/
|
1005
|
-
AutoFill.version = '2.
|
1058
|
+
AutoFill.version = '2.2.0';
|
1006
1059
|
|
1007
1060
|
|
1008
1061
|
/**
|
@@ -1020,6 +1073,9 @@ AutoFill.defaults = {
|
|
1020
1073
|
/** @type {column-selector} Columns to provide auto fill for */
|
1021
1074
|
columns: '', // all
|
1022
1075
|
|
1076
|
+
/** @type {Boolean} Enable AutoFill on load */
|
1077
|
+
enable: true,
|
1078
|
+
|
1023
1079
|
/** @type {boolean|null} Update the cells after a drag */
|
1024
1080
|
update: null, // false is editor given, true otherwise
|
1025
1081
|
|
@@ -1039,6 +1095,41 @@ AutoFill.classes = {
|
|
1039
1095
|
};
|
1040
1096
|
|
1041
1097
|
|
1098
|
+
/*
|
1099
|
+
* API
|
1100
|
+
*/
|
1101
|
+
var Api = $.fn.dataTable.Api;
|
1102
|
+
|
1103
|
+
// Doesn't do anything - Not documented
|
1104
|
+
Api.register( 'autoFill()', function () {
|
1105
|
+
return this;
|
1106
|
+
} );
|
1107
|
+
|
1108
|
+
Api.register( 'autoFill().enabled()', function () {
|
1109
|
+
var ctx = this.context[0];
|
1110
|
+
|
1111
|
+
return ctx.autoFill ?
|
1112
|
+
ctx.autoFill.enabled() :
|
1113
|
+
false;
|
1114
|
+
} );
|
1115
|
+
|
1116
|
+
Api.register( 'autoFill().enable()', function ( flag ) {
|
1117
|
+
return this.iterator( 'table', function ( ctx ) {
|
1118
|
+
if ( ctx.autoFill ) {
|
1119
|
+
ctx.autoFill.enable( flag );
|
1120
|
+
}
|
1121
|
+
} );
|
1122
|
+
} );
|
1123
|
+
|
1124
|
+
Api.register( 'autoFill().disable()', function () {
|
1125
|
+
return this.iterator( 'table', function ( ctx ) {
|
1126
|
+
if ( ctx.autoFill ) {
|
1127
|
+
ctx.autoFill.disable();
|
1128
|
+
}
|
1129
|
+
} );
|
1130
|
+
} );
|
1131
|
+
|
1132
|
+
|
1042
1133
|
// Attach a listener to the document which listens for DataTables initialisation
|
1043
1134
|
// events so we can automatically initialise
|
1044
1135
|
$(document).on( 'preInit.dt.autofill', function (e, settings, json) {
|
@@ -48,7 +48,8 @@ $.extend( DataTable.ext.buttons, {
|
|
48
48
|
className: 'buttons-colvis',
|
49
49
|
buttons: [ {
|
50
50
|
extend: 'columnsToggle',
|
51
|
-
columns: conf.columns
|
51
|
+
columns: conf.columns,
|
52
|
+
columnText: conf.columnText
|
52
53
|
} ]
|
53
54
|
};
|
54
55
|
},
|
@@ -58,7 +59,8 @@ $.extend( DataTable.ext.buttons, {
|
|
58
59
|
var columns = dt.columns( conf.columns ).indexes().map( function ( idx ) {
|
59
60
|
return {
|
60
61
|
extend: 'columnToggle',
|
61
|
-
columns: idx
|
62
|
+
columns: idx,
|
63
|
+
columnText: conf.columnText
|
62
64
|
};
|
63
65
|
} ).toArray();
|
64
66
|
|
@@ -69,7 +71,8 @@ $.extend( DataTable.ext.buttons, {
|
|
69
71
|
columnToggle: function ( dt, conf ) {
|
70
72
|
return {
|
71
73
|
extend: 'columnVisibility',
|
72
|
-
columns: conf.columns
|
74
|
+
columns: conf.columns,
|
75
|
+
columnText: conf.columnText
|
73
76
|
};
|
74
77
|
},
|
75
78
|
|
@@ -79,7 +82,8 @@ $.extend( DataTable.ext.buttons, {
|
|
79
82
|
return {
|
80
83
|
extend: 'columnVisibility',
|
81
84
|
columns: idx,
|
82
|
-
visibility: conf.visibility
|
85
|
+
visibility: conf.visibility,
|
86
|
+
columnText: conf.columnText
|
83
87
|
};
|
84
88
|
} ).toArray();
|
85
89
|
|
@@ -90,7 +94,7 @@ $.extend( DataTable.ext.buttons, {
|
|
90
94
|
columnVisibility: {
|
91
95
|
columns: undefined, // column selector
|
92
96
|
text: function ( dt, button, conf ) {
|
93
|
-
return conf._columnText( dt, conf
|
97
|
+
return conf._columnText( dt, conf );
|
94
98
|
},
|
95
99
|
className: 'buttons-columnVisibility',
|
96
100
|
action: function ( e, dt, button, conf ) {
|
@@ -124,7 +128,7 @@ $.extend( DataTable.ext.buttons, {
|
|
124
128
|
|
125
129
|
var col = dt.column( conf.columns );
|
126
130
|
|
127
|
-
that.text( conf._columnText( dt, conf
|
131
|
+
that.text( conf._columnText( dt, conf ) );
|
128
132
|
that.active( col.visible() );
|
129
133
|
} );
|
130
134
|
|
@@ -136,16 +140,20 @@ $.extend( DataTable.ext.buttons, {
|
|
136
140
|
.off( 'column-reorder.dt'+conf.namespace );
|
137
141
|
},
|
138
142
|
|
139
|
-
_columnText: function ( dt,
|
143
|
+
_columnText: function ( dt, conf ) {
|
140
144
|
// Use DataTables' internal data structure until this is presented
|
141
145
|
// is a public API. The other option is to use
|
142
146
|
// `$( column(col).node() ).text()` but the node might not have been
|
143
147
|
// populated when Buttons is constructed.
|
144
|
-
var idx = dt.column(
|
145
|
-
|
148
|
+
var idx = dt.column( conf.columns ).index();
|
149
|
+
var title = dt.settings()[0].aoColumns[ idx ].sTitle
|
146
150
|
.replace(/\n/g," ") // remove new lines
|
147
151
|
.replace( /<.*?>/g, "" ) // strip HTML
|
148
152
|
.replace(/^\s+|\s+$/g,""); // trim
|
153
|
+
|
154
|
+
return conf.columnText ?
|
155
|
+
conf.columnText( dt, idx, title ) :
|
156
|
+
title;
|
149
157
|
}
|
150
158
|
},
|
151
159
|
|