jquery-datatables-rails 3.2.0 → 3.3.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/app/assets/javascripts/dataTables/bootstrap/2/jquery.dataTables.bootstrap.js +110 -96
- data/app/assets/javascripts/dataTables/bootstrap/3/jquery.dataTables.bootstrap.js +6 -6
- data/app/assets/javascripts/dataTables/extras/dataTables.colReorder.js +28 -27
- data/app/assets/javascripts/dataTables/extras/dataTables.colVis.js +27 -11
- data/app/assets/javascripts/dataTables/extras/dataTables.fixedColumns.js +53 -29
- data/app/assets/javascripts/dataTables/extras/dataTables.responsive.js +110 -47
- data/app/assets/javascripts/dataTables/extras/dataTables.tableTools.js +90 -25
- data/app/assets/javascripts/dataTables/jquery.dataTables.foundation.js +133 -139
- data/app/assets/javascripts/dataTables/jquery.dataTables.js +483 -375
- data/app/assets/javascripts/dataTables/jquery.dataTables.sorting.numbersHtml.js +37 -14
- data/app/assets/javascripts/dataTables/jquery.dataTables.typeDetection.numbersHtml.js +49 -33
- data/app/assets/media/dataTables/extras/swf/copy_csv_xls.swf +0 -0
- data/app/assets/media/dataTables/extras/swf/copy_csv_xls_pdf.swf +0 -0
- data/app/assets/stylesheets/dataTables/bootstrap/2/jquery.dataTables.bootstrap.scss +34 -9
- data/app/assets/stylesheets/dataTables/bootstrap/3/jquery.dataTables.bootstrap.scss +122 -31
- data/app/assets/stylesheets/dataTables/extras/dataTables.colvis.jqueryui.scss +18 -0
- data/app/assets/stylesheets/dataTables/extras/dataTables.fixedColumns.scss +1 -0
- data/app/assets/stylesheets/dataTables/extras/dataTables.responsive.scss +29 -12
- data/app/assets/stylesheets/dataTables/extras/dataTables.tableTools.scss +43 -19
- data/app/assets/stylesheets/dataTables/jquery.dataTables.foundation.scss +15 -4
- data/app/assets/stylesheets/dataTables/jquery.dataTables.scss +22 -11
- data/lib/jquery/datatables/rails/version.rb +1 -1
- metadata +18 -18
@@ -1,11 +1,11 @@
|
|
1
|
-
/*! FixedColumns 3.0.
|
1
|
+
/*! FixedColumns 3.0.4
|
2
2
|
* ©2010-2014 SpryMedia Ltd - datatables.net/license
|
3
3
|
*/
|
4
4
|
|
5
5
|
/**
|
6
6
|
* @summary FixedColumns
|
7
7
|
* @description Freeze columns in place on a scrolling DataTable
|
8
|
-
* @version 3.0.
|
8
|
+
* @version 3.0.4
|
9
9
|
* @file dataTables.fixedColumns.js
|
10
10
|
* @author SpryMedia Ltd (www.sprymedia.co.uk)
|
11
11
|
* @contact www.sprymedia.co.uk/contact
|
@@ -62,7 +62,7 @@ var FixedColumns = function ( dt, init ) {
|
|
62
62
|
var that = this;
|
63
63
|
|
64
64
|
/* Sanity check - you just know it will happen */
|
65
|
-
if ( ! this instanceof FixedColumns )
|
65
|
+
if ( ! ( this instanceof FixedColumns ) )
|
66
66
|
{
|
67
67
|
alert( "FixedColumns warning: FixedColumns must be initialised with the 'new' keyword." );
|
68
68
|
return;
|
@@ -75,8 +75,10 @@ var FixedColumns = function ( dt, init ) {
|
|
75
75
|
|
76
76
|
// Use the DataTables Hungarian notation mapping method, if it exists to
|
77
77
|
// provide forwards compatibility for camel case variables
|
78
|
-
|
79
|
-
|
78
|
+
var camelToHungarian = $.fn.dataTable.camelToHungarian;
|
79
|
+
if ( camelToHungarian ) {
|
80
|
+
camelToHungarian( FixedColumns.defaults, FixedColumns.defaults, true );
|
81
|
+
camelToHungarian( FixedColumns.defaults, init );
|
80
82
|
}
|
81
83
|
|
82
84
|
// v1.10 allows the settings object to be got form a number of sources
|
@@ -746,6 +748,18 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
|
|
746
748
|
iLeftWidth = this.s.iLeftWidth,
|
747
749
|
iRightWidth = this.s.iRightWidth,
|
748
750
|
iRight;
|
751
|
+
var scrollbarAdjust = function ( node, width ) {
|
752
|
+
if ( ! oOverflow.bar ) {
|
753
|
+
// If there is no scrollbar (Macs) we need to hide the auto scrollbar
|
754
|
+
node.style.width = (width+20)+"px";
|
755
|
+
node.style.paddingRight = "20px";
|
756
|
+
node.style.boxSizing = "border-box";
|
757
|
+
}
|
758
|
+
else {
|
759
|
+
// Otherwise just overflow by the scrollbar
|
760
|
+
node.style.width = (width+oOverflow.bar)+"px";
|
761
|
+
}
|
762
|
+
};
|
749
763
|
|
750
764
|
// When x scrolling - don't paint the fixed columns over the x scrollbar
|
751
765
|
if ( oOverflow.x )
|
@@ -764,7 +778,7 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
|
|
764
778
|
oGrid.left.foot.style.top = (oOverflow.x ? oOverflow.bar : 0)+"px"; // shift footer for scrollbar
|
765
779
|
}
|
766
780
|
|
767
|
-
oGrid.left.liner
|
781
|
+
scrollbarAdjust( oGrid.left.liner, iLeftWidth );
|
768
782
|
oGrid.left.liner.style.height = iBodyHeight+"px";
|
769
783
|
}
|
770
784
|
|
@@ -784,7 +798,7 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
|
|
784
798
|
oGrid.right.foot.style.top = (oOverflow.x ? oOverflow.bar : 0)+"px";
|
785
799
|
}
|
786
800
|
|
787
|
-
oGrid.right.liner
|
801
|
+
scrollbarAdjust( oGrid.right.liner, iRightWidth );
|
788
802
|
oGrid.right.liner.style.height = iBodyHeight+"px";
|
789
803
|
|
790
804
|
oGrid.right.headBlock.style.display = oOverflow.y ? 'block' : 'none';
|
@@ -970,7 +984,8 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
|
|
970
984
|
{
|
971
985
|
var that = this,
|
972
986
|
i, iLen, j, jLen, jq, nTarget, iColumn, nClone, iIndex, aoCloneLayout,
|
973
|
-
jqCloneThead, aoFixedHeader
|
987
|
+
jqCloneThead, aoFixedHeader,
|
988
|
+
dt = this.s.dt;
|
974
989
|
|
975
990
|
/*
|
976
991
|
* Header
|
@@ -987,7 +1002,7 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
|
|
987
1002
|
oGrid.head.appendChild( oClone.header );
|
988
1003
|
|
989
1004
|
/* Copy the DataTables layout cache for the header for our floating column */
|
990
|
-
aoCloneLayout = this._fnCopyLayout(
|
1005
|
+
aoCloneLayout = this._fnCopyLayout( dt.aoHeader, aiColumns );
|
991
1006
|
jqCloneThead = $('>thead', oClone.header);
|
992
1007
|
jqCloneThead.empty();
|
993
1008
|
|
@@ -1000,7 +1015,7 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
|
|
1000
1015
|
/* Use the handy _fnDrawHead function in DataTables to do the rowspan/colspan
|
1001
1016
|
* calculations for us
|
1002
1017
|
*/
|
1003
|
-
|
1018
|
+
dt.oApi._fnDrawHead( dt, aoCloneLayout, true );
|
1004
1019
|
}
|
1005
1020
|
else
|
1006
1021
|
{
|
@@ -1009,10 +1024,10 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
|
|
1009
1024
|
* cloned cells, just copy the classes across. To get the matching layout for the
|
1010
1025
|
* fixed component, we use the DataTables _fnDetectHeader method, allowing 1:1 mapping
|
1011
1026
|
*/
|
1012
|
-
aoCloneLayout = this._fnCopyLayout(
|
1027
|
+
aoCloneLayout = this._fnCopyLayout( dt.aoHeader, aiColumns );
|
1013
1028
|
aoFixedHeader=[];
|
1014
1029
|
|
1015
|
-
|
1030
|
+
dt.oApi._fnDetectHeader( aoFixedHeader, $('>thead', oClone.header)[0] );
|
1016
1031
|
|
1017
1032
|
for ( i=0, iLen=aoCloneLayout.length ; i<iLen ; i++ )
|
1018
1033
|
{
|
@@ -1046,8 +1061,8 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
|
|
1046
1061
|
|
1047
1062
|
oClone.body = $(this.dom.body).clone(true)[0];
|
1048
1063
|
oClone.body.className += " DTFC_Cloned";
|
1049
|
-
oClone.body.style.paddingBottom =
|
1050
|
-
oClone.body.style.marginBottom = (
|
1064
|
+
oClone.body.style.paddingBottom = dt.oScroll.iBarWidth+"px";
|
1065
|
+
oClone.body.style.marginBottom = (dt.oScroll.iBarWidth*2)+"px"; /* For IE */
|
1051
1066
|
if ( oClone.body.getAttribute('id') !== null )
|
1052
1067
|
{
|
1053
1068
|
oClone.body.removeAttribute('id');
|
@@ -1058,7 +1073,7 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
|
|
1058
1073
|
|
1059
1074
|
var nBody = $('tbody', oClone.body)[0];
|
1060
1075
|
$(nBody).empty();
|
1061
|
-
if (
|
1076
|
+
if ( dt.aiDisplay.length > 0 )
|
1062
1077
|
{
|
1063
1078
|
/* Copy the DataTables' header elements to force the column width in exactly the
|
1064
1079
|
* same way that DataTables does it - have the header element, apply the width and
|
@@ -1069,7 +1084,7 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
|
|
1069
1084
|
{
|
1070
1085
|
iColumn = aiColumns[iIndex];
|
1071
1086
|
|
1072
|
-
nClone = $(
|
1087
|
+
nClone = $(dt.aoColumns[iColumn].nTh).clone(true)[0];
|
1073
1088
|
nClone.innerHTML = "";
|
1074
1089
|
|
1075
1090
|
var oStyle = nClone.style;
|
@@ -1089,9 +1104,10 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
|
|
1089
1104
|
n.removeAttribute('id');
|
1090
1105
|
var i = that.s.dt.oFeatures.bServerSide===false ?
|
1091
1106
|
that.s.dt.aiDisplay[ that.s.dt._iDisplayStart+z ] : z;
|
1107
|
+
var aTds = that.s.dt.aoData[ i ].anCells || $(this).children('td, th');
|
1108
|
+
|
1092
1109
|
for ( iIndex=0 ; iIndex<aiColumns.length ; iIndex++ )
|
1093
1110
|
{
|
1094
|
-
var aTds = that.s.dt.aoData[i].anCells || that.s.dt.oApi._fnGetTdNodes( that.s.dt, i );
|
1095
1111
|
iColumn = aiColumns[iIndex];
|
1096
1112
|
|
1097
1113
|
if ( aTds.length > 0 )
|
@@ -1117,13 +1133,21 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
|
|
1117
1133
|
oClone.body.style.margin = "0";
|
1118
1134
|
oClone.body.style.padding = "0";
|
1119
1135
|
|
1120
|
-
|
1136
|
+
// Interop with Scroller - need to use a height forcing element in the
|
1137
|
+
// scrolling area in the same way that Scroller does in the body scroll.
|
1138
|
+
if ( dt.oScroller !== undefined )
|
1121
1139
|
{
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1140
|
+
var scrollerForcer = dt.oScroller.dom.force;
|
1141
|
+
|
1142
|
+
if ( ! oGrid.forcer ) {
|
1143
|
+
oGrid.forcer = scrollerForcer.cloneNode( true );
|
1144
|
+
oGrid.liner.appendChild( oGrid.forcer );
|
1145
|
+
}
|
1146
|
+
else {
|
1147
|
+
oGrid.forcer.style.height = scrollerForcer.style.height;
|
1125
1148
|
}
|
1126
1149
|
}
|
1150
|
+
|
1127
1151
|
oGrid.liner.appendChild( oClone.body );
|
1128
1152
|
|
1129
1153
|
this._fnEqualiseHeights( 'tbody', that.dom.body, oClone.body );
|
@@ -1131,7 +1155,7 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
|
|
1131
1155
|
/*
|
1132
1156
|
* Footer
|
1133
1157
|
*/
|
1134
|
-
if (
|
1158
|
+
if ( dt.nTFoot !== null )
|
1135
1159
|
{
|
1136
1160
|
if ( bAll )
|
1137
1161
|
{
|
@@ -1145,7 +1169,7 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
|
|
1145
1169
|
oGrid.foot.appendChild( oClone.footer );
|
1146
1170
|
|
1147
1171
|
/* Copy the footer just like we do for the header */
|
1148
|
-
aoCloneLayout = this._fnCopyLayout(
|
1172
|
+
aoCloneLayout = this._fnCopyLayout( dt.aoFooter, aiColumns );
|
1149
1173
|
var jqCloneTfoot = $('>tfoot', oClone.footer);
|
1150
1174
|
jqCloneTfoot.empty();
|
1151
1175
|
|
@@ -1153,14 +1177,14 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
|
|
1153
1177
|
{
|
1154
1178
|
jqCloneTfoot[0].appendChild( aoCloneLayout[i].nTr );
|
1155
1179
|
}
|
1156
|
-
|
1180
|
+
dt.oApi._fnDrawHead( dt, aoCloneLayout, true );
|
1157
1181
|
}
|
1158
1182
|
else
|
1159
1183
|
{
|
1160
|
-
aoCloneLayout = this._fnCopyLayout(
|
1184
|
+
aoCloneLayout = this._fnCopyLayout( dt.aoFooter, aiColumns );
|
1161
1185
|
var aoCurrFooter=[];
|
1162
1186
|
|
1163
|
-
|
1187
|
+
dt.oApi._fnDetectHeader( aoCurrFooter, $('>tfoot', oClone.footer)[0] );
|
1164
1188
|
|
1165
1189
|
for ( i=0, iLen=aoCloneLayout.length ; i<iLen ; i++ )
|
1166
1190
|
{
|
@@ -1174,7 +1198,7 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
|
|
1174
1198
|
}
|
1175
1199
|
|
1176
1200
|
/* Equalise the column widths between the header footer and body - body get's priority */
|
1177
|
-
var anUnique =
|
1201
|
+
var anUnique = dt.oApi._fnGetUniqueThs( dt, $('>thead', oClone.header)[0] );
|
1178
1202
|
$(anUnique).each( function (i) {
|
1179
1203
|
iColumn = aiColumns[i];
|
1180
1204
|
this.style.width = that.s.aiInnerWidths[iColumn]+"px";
|
@@ -1182,7 +1206,7 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
|
|
1182
1206
|
|
1183
1207
|
if ( that.s.dt.nTFoot !== null )
|
1184
1208
|
{
|
1185
|
-
anUnique =
|
1209
|
+
anUnique = dt.oApi._fnGetUniqueThs( dt, $('>tfoot', oClone.footer)[0] );
|
1186
1210
|
$(anUnique).each( function (i) {
|
1187
1211
|
iColumn = aiColumns[i];
|
1188
1212
|
this.style.width = that.s.aiInnerWidths[iColumn]+"px";
|
@@ -1352,7 +1376,7 @@ FixedColumns.defaults = /** @lends FixedColumns.defaults */{
|
|
1352
1376
|
* @default See code
|
1353
1377
|
* @static
|
1354
1378
|
*/
|
1355
|
-
FixedColumns.version = "3.0.
|
1379
|
+
FixedColumns.version = "3.0.4";
|
1356
1380
|
|
1357
1381
|
|
1358
1382
|
|
@@ -1,15 +1,15 @@
|
|
1
|
-
/*! Responsive 1.0.
|
2
|
-
* 2014 SpryMedia Ltd - datatables.net/license
|
1
|
+
/*! Responsive 1.0.5
|
2
|
+
* 2014-2015 SpryMedia Ltd - datatables.net/license
|
3
3
|
*/
|
4
4
|
|
5
5
|
/**
|
6
6
|
* @summary Responsive
|
7
7
|
* @description Responsive tables plug-in for DataTables
|
8
|
-
* @version 1.0.
|
8
|
+
* @version 1.0.5
|
9
9
|
* @file dataTables.responsive.js
|
10
10
|
* @author SpryMedia Ltd (www.sprymedia.co.uk)
|
11
11
|
* @contact www.sprymedia.co.uk/contact
|
12
|
-
* @copyright Copyright 2014 SpryMedia Ltd.
|
12
|
+
* @copyright Copyright 2014-2015 SpryMedia Ltd.
|
13
13
|
*
|
14
14
|
* This source file is free software, available under the following license:
|
15
15
|
* MIT license - http://datatables.net/license/mit
|
@@ -122,7 +122,7 @@ Responsive.prototype = {
|
|
122
122
|
|
123
123
|
// Destroy event handler
|
124
124
|
dt.on( 'destroy.dtr', function () {
|
125
|
-
$(window).off( 'resize.dtr orientationchange.dtr' );
|
125
|
+
$(window).off( 'resize.dtr orientationchange.dtr draw.dtr' );
|
126
126
|
} );
|
127
127
|
|
128
128
|
// Reorder the breakpoints array here in case they have been added out
|
@@ -133,16 +133,13 @@ Responsive.prototype = {
|
|
133
133
|
} );
|
134
134
|
|
135
135
|
// Determine which columns are already hidden, and should therefore
|
136
|
-
// remain hidden.
|
136
|
+
// remain hidden. todo - should this be done? See thread 22677
|
137
137
|
//
|
138
138
|
// this.s.alwaysHidden = dt.columns(':hidden').indexes();
|
139
139
|
|
140
140
|
this._classLogic();
|
141
141
|
this._resizeAuto();
|
142
142
|
|
143
|
-
// First pass - draw the table for the current viewport size
|
144
|
-
this._resize();
|
145
|
-
|
146
143
|
// Details handler
|
147
144
|
var details = this.c.details;
|
148
145
|
if ( details.type ) {
|
@@ -153,8 +150,24 @@ Responsive.prototype = {
|
|
153
150
|
that._detailsVis();
|
154
151
|
} );
|
155
152
|
|
153
|
+
// Redraw the details box on each draw. This is used until
|
154
|
+
// DataTables implements a native `updated` event for rows
|
155
|
+
dt.on( 'draw.dtr', function () {
|
156
|
+
dt.rows( {page: 'current'} ).iterator( 'row', function ( settings, idx ) {
|
157
|
+
var row = dt.row( idx );
|
158
|
+
|
159
|
+
if ( row.child.isShown() ) {
|
160
|
+
var info = that.c.details.renderer( dt, idx );
|
161
|
+
row.child( info, 'child' ).show();
|
162
|
+
}
|
163
|
+
} );
|
164
|
+
} );
|
165
|
+
|
156
166
|
$(dt.table().node()).addClass( 'dtr-'+details.type );
|
157
167
|
}
|
168
|
+
|
169
|
+
// First pass - draw the table for the current viewport size
|
170
|
+
this._resize();
|
158
171
|
},
|
159
172
|
|
160
173
|
|
@@ -200,25 +213,43 @@ Responsive.prototype = {
|
|
200
213
|
}
|
201
214
|
}
|
202
215
|
|
203
|
-
// Second pass, use up any remaining width for other columns
|
204
|
-
|
216
|
+
// Second pass, use up any remaining width for other columns. For
|
217
|
+
// scrolling tables we need to subtract the width of the scrollbar. It
|
218
|
+
// may not be requires which makes this sub-optimal, but it would
|
219
|
+
// require another full redraw to make complete use of those extra few
|
220
|
+
// pixels
|
221
|
+
var scrolling = dt.settings()[0].oScroll;
|
222
|
+
var bar = scrolling.sY || scrolling.sX ? scrolling.iBarWidth : 0;
|
223
|
+
var widthAvailable = dt.table().container().offsetWidth - bar;
|
205
224
|
var usedWidth = widthAvailable - requiredWidth;
|
206
225
|
|
226
|
+
// Control column needs to always be included. This makes it sub-
|
227
|
+
// optimal in terms of using the available with, but to stop layout
|
228
|
+
// thrashing or overflow. Also we need to account for the control column
|
229
|
+
// width first so we know how much width is available for the other
|
230
|
+
// columns, since the control column might not be the first one shown
|
207
231
|
for ( i=0, ien=display.length ; i<ien ; i++ ) {
|
208
|
-
// Control column needs to always be included. This makes it sub-
|
209
|
-
// optimal in terms of using the available with, but to stop layout
|
210
|
-
// thrashing or overflow
|
211
232
|
if ( columns[i].control ) {
|
212
233
|
usedWidth -= columns[i].minWidth;
|
213
234
|
}
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
//
|
235
|
+
}
|
236
|
+
|
237
|
+
// Allow columns to be shown (counting from the left) until we run out
|
238
|
+
// of room
|
239
|
+
var empty = false;
|
240
|
+
for ( i=0, ien=display.length ; i<ien ; i++ ) {
|
241
|
+
if ( display[i] === '-' && ! columns[i].control ) {
|
242
|
+
// Once we've found a column that won't fit we don't let any
|
243
|
+
// others display either, or columns might disappear in the
|
244
|
+
// middle of the table
|
245
|
+
if ( empty || usedWidth - columns[i].minWidth < 0 ) {
|
246
|
+
empty = true;
|
247
|
+
display[i] = false;
|
248
|
+
}
|
249
|
+
else {
|
250
|
+
display[i] = true;
|
251
|
+
}
|
252
|
+
|
222
253
|
usedWidth -= columns[i].minWidth;
|
223
254
|
}
|
224
255
|
}
|
@@ -476,11 +507,8 @@ Responsive.prototype = {
|
|
476
507
|
}
|
477
508
|
|
478
509
|
if ( haveHidden ) {
|
479
|
-
// Got hidden columns
|
480
|
-
$( dt.table().node() ).addClass('collapsed');
|
481
|
-
|
482
510
|
// Show all existing child rows
|
483
|
-
dt.rows().eq(0).each( function (idx) {
|
511
|
+
dt.rows( { page: 'current' } ).eq(0).each( function (idx) {
|
484
512
|
var row = dt.row( idx );
|
485
513
|
|
486
514
|
if ( row.child() ) {
|
@@ -497,11 +525,8 @@ Responsive.prototype = {
|
|
497
525
|
} );
|
498
526
|
}
|
499
527
|
else {
|
500
|
-
// No hidden columns
|
501
|
-
$( dt.table().node() ).removeClass('collapsed');
|
502
|
-
|
503
528
|
// Hide all existing child rows
|
504
|
-
dt.rows().eq(0).each( function (idx) {
|
529
|
+
dt.rows( { page: 'current' } ).eq(0).each( function (idx) {
|
505
530
|
dt.row( idx ).child.hide();
|
506
531
|
} );
|
507
532
|
}
|
@@ -538,9 +563,11 @@ Responsive.prototype = {
|
|
538
563
|
var width = $(window).width();
|
539
564
|
var breakpoints = this.c.breakpoints;
|
540
565
|
var breakpoint = breakpoints[0].name;
|
566
|
+
var columns = this.s.columns;
|
567
|
+
var i, ien;
|
541
568
|
|
542
569
|
// Determine what breakpoint we are currently at
|
543
|
-
for (
|
570
|
+
for ( i=breakpoints.length-1 ; i>=0 ; i-- ) {
|
544
571
|
if ( width <= breakpoints[i].width ) {
|
545
572
|
breakpoint = breakpoints[i].name;
|
546
573
|
break;
|
@@ -548,10 +575,23 @@ Responsive.prototype = {
|
|
548
575
|
}
|
549
576
|
|
550
577
|
// Show the columns for that break point
|
551
|
-
var
|
578
|
+
var columnsVis = this._columnsVisiblity( breakpoint );
|
579
|
+
|
580
|
+
// Set the class before the column visibility is changed so event
|
581
|
+
// listeners know what the state is. Need to determine if there are
|
582
|
+
// any columns that are not visible but can be shown
|
583
|
+
var collapsedClass = false;
|
584
|
+
for ( i=0, ien=columns.length ; i<ien ; i++ ) {
|
585
|
+
if ( columnsVis[i] === false && ! columns[i].never ) {
|
586
|
+
collapsedClass = true;
|
587
|
+
break;
|
588
|
+
}
|
589
|
+
}
|
590
|
+
|
591
|
+
$( dt.table().node() ).toggleClass('collapsed', collapsedClass );
|
552
592
|
|
553
593
|
dt.columns().eq(0).each( function ( colIdx, i ) {
|
554
|
-
dt.column( colIdx ).visible(
|
594
|
+
dt.column( colIdx ).visible( columnsVis[i] );
|
555
595
|
} );
|
556
596
|
},
|
557
597
|
|
@@ -587,6 +627,8 @@ Responsive.prototype = {
|
|
587
627
|
var clonedHeader = $( dt.table().header().cloneNode( false ) ).appendTo( clonedTable );
|
588
628
|
var clonedBody = $( dt.table().body().cloneNode( false ) ).appendTo( clonedTable );
|
589
629
|
|
630
|
+
$( dt.table().footer() ).clone( false ).appendTo( clonedTable );
|
631
|
+
|
590
632
|
// This is a bit slow, but we need to get a clone of each row that
|
591
633
|
// includes all columns. As such, try to do this as little as possible.
|
592
634
|
dt.rows( { page: 'current' } ).indexes().flatten().each( function ( idx ) {
|
@@ -599,8 +641,12 @@ Responsive.prototype = {
|
|
599
641
|
$(clone).appendTo( clonedBody );
|
600
642
|
} );
|
601
643
|
|
602
|
-
var cells
|
603
|
-
|
644
|
+
var cells = dt.columns().header().to$().clone( false );
|
645
|
+
$('<tr/>')
|
646
|
+
.append( cells )
|
647
|
+
.appendTo( clonedHeader );
|
648
|
+
|
649
|
+
var inserted = $('<div/>')
|
604
650
|
.css( {
|
605
651
|
width: 1,
|
606
652
|
height: 1,
|
@@ -699,10 +745,14 @@ Responsive.defaults = {
|
|
699
745
|
var cellData = dtPrivate.oApi._fnGetCellData(
|
700
746
|
dtPrivate, idx.row, idx.column, 'display'
|
701
747
|
);
|
748
|
+
var title = header.text();
|
749
|
+
if ( title ) {
|
750
|
+
title = title + ':';
|
751
|
+
}
|
702
752
|
|
703
753
|
return '<li data-dtr-index="'+idx.column+'">'+
|
704
754
|
'<span class="dtr-title">'+
|
705
|
-
|
755
|
+
title+
|
706
756
|
'</span> '+
|
707
757
|
'<span class="dtr-data">'+
|
708
758
|
cellData+
|
@@ -732,15 +782,6 @@ Api.register( 'responsive()', function () {
|
|
732
782
|
return this;
|
733
783
|
} );
|
734
784
|
|
735
|
-
Api.register( 'responsive.recalc()', function () {
|
736
|
-
this.iterator( 'table', function ( ctx ) {
|
737
|
-
if ( ctx._responsive ) {
|
738
|
-
ctx._responsive._resizeAuto();
|
739
|
-
ctx._responsive._resize();
|
740
|
-
}
|
741
|
-
} );
|
742
|
-
} );
|
743
|
-
|
744
785
|
Api.register( 'responsive.index()', function ( li ) {
|
745
786
|
li = $(li);
|
746
787
|
|
@@ -750,6 +791,23 @@ Api.register( 'responsive.index()', function ( li ) {
|
|
750
791
|
};
|
751
792
|
} );
|
752
793
|
|
794
|
+
Api.register( 'responsive.rebuild()', function () {
|
795
|
+
return this.iterator( 'table', function ( ctx ) {
|
796
|
+
if ( ctx._responsive ) {
|
797
|
+
ctx._responsive._classLogic();
|
798
|
+
}
|
799
|
+
} );
|
800
|
+
} );
|
801
|
+
|
802
|
+
Api.register( 'responsive.recalc()', function () {
|
803
|
+
return this.iterator( 'table', function ( ctx ) {
|
804
|
+
if ( ctx._responsive ) {
|
805
|
+
ctx._responsive._resizeAuto();
|
806
|
+
ctx._responsive._resize();
|
807
|
+
}
|
808
|
+
} );
|
809
|
+
} );
|
810
|
+
|
753
811
|
|
754
812
|
/**
|
755
813
|
* Version information
|
@@ -757,7 +815,7 @@ Api.register( 'responsive.index()', function ( li ) {
|
|
757
815
|
* @name Responsive.version
|
758
816
|
* @static
|
759
817
|
*/
|
760
|
-
Responsive.version = '1.0.
|
818
|
+
Responsive.version = '1.0.5';
|
761
819
|
|
762
820
|
|
763
821
|
$.fn.dataTable.Responsive = Responsive;
|
@@ -766,11 +824,17 @@ $.fn.DataTable.Responsive = Responsive;
|
|
766
824
|
// Attach a listener to the document which listens for DataTables initialisation
|
767
825
|
// events so we can automatically initialise
|
768
826
|
$(document).on( 'init.dt.dtr', function (e, settings, json) {
|
827
|
+
if ( e.namespace !== 'dt' ) {
|
828
|
+
return;
|
829
|
+
}
|
830
|
+
|
769
831
|
if ( $(settings.nTable).hasClass( 'responsive' ) ||
|
770
832
|
$(settings.nTable).hasClass( 'dt-responsive' ) ||
|
771
833
|
settings.oInit.responsive ||
|
772
834
|
DataTable.defaults.responsive
|
773
835
|
) {
|
836
|
+
console.log( e.namespace );
|
837
|
+
|
774
838
|
var init = settings.oInit.responsive;
|
775
839
|
|
776
840
|
if ( init !== false ) {
|
@@ -798,4 +862,3 @@ else if ( jQuery && !jQuery.fn.dataTable.Responsive ) {
|
|
798
862
|
|
799
863
|
|
800
864
|
})(window, document);
|
801
|
-
|