jquery-datatables-rails 1.10.0 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +35 -22
- data/lib/jquery/datatables/rails/version.rb +1 -1
- data/vendor/assets/javascripts/dataTables/extras/AutoFill.js +820 -0
- data/vendor/assets/javascripts/dataTables/extras/ColReorder.js +956 -0
- data/vendor/assets/javascripts/dataTables/extras/ColVis.js +1013 -0
- data/vendor/assets/javascripts/dataTables/extras/FixedColumns.js +144 -130
- data/vendor/assets/javascripts/dataTables/extras/KeyTable.js +1111 -0
- data/vendor/assets/javascripts/dataTables/extras/Scroller.js +904 -0
- data/vendor/assets/javascripts/dataTables/extras/TableTools.js +2406 -0
- data/vendor/assets/javascripts/dataTables/extras/ZeroClipboard.js +367 -0
- data/vendor/assets/javascripts/dataTables/jquery.dataTables.api.fnFilterOnReturn.js +17 -0
- data/vendor/assets/javascripts/dataTables/jquery.dataTables.js +1711 -1686
- metadata +11 -2
@@ -2,7 +2,7 @@
|
|
2
2
|
* @summary FixedColumns
|
3
3
|
* @description Freeze columns in place on a scrolling DataTable
|
4
4
|
* @file FixedColumns.js
|
5
|
-
* @version 2.0.
|
5
|
+
* @version 2.0.4.dev
|
6
6
|
* @author Allan Jardine (www.sprymedia.co.uk)
|
7
7
|
* @license GPL v2 or BSD 3 point style
|
8
8
|
* @contact www.sprymedia.co.uk/contact
|
@@ -22,11 +22,11 @@ var FixedColumns;
|
|
22
22
|
(function($, window, document) {
|
23
23
|
|
24
24
|
|
25
|
-
/**
|
26
|
-
* When making use of DataTables' x-axis scrolling feature, you may wish to
|
27
|
-
* fix the left most column in place. This plug-in for DataTables provides
|
28
|
-
* exactly this option (note for non-scrolling tables, please use the
|
29
|
-
* FixedHeader plug-in, which can fix headers, footers and columns). Key
|
25
|
+
/**
|
26
|
+
* When making use of DataTables' x-axis scrolling feature, you may wish to
|
27
|
+
* fix the left most column in place. This plug-in for DataTables provides
|
28
|
+
* exactly this option (note for non-scrolling tables, please use the
|
29
|
+
* FixedHeader plug-in, which can fix headers, footers and columns). Key
|
30
30
|
* features include:
|
31
31
|
* <ul class="limit_length">
|
32
32
|
* <li>Freezes the left or right most columns to the side of the table</li>
|
@@ -39,10 +39,10 @@ var FixedColumns;
|
|
39
39
|
* @constructor
|
40
40
|
* @param {object} oDT DataTables instance
|
41
41
|
* @param {object} [oInit={}] Configuration object for FixedColumns. Options are defined by {@link FixedColumns.defaults}
|
42
|
-
*
|
42
|
+
*
|
43
43
|
* @requires jQuery 1.3+
|
44
44
|
* @requires DataTables 1.8.0+
|
45
|
-
*
|
45
|
+
*
|
46
46
|
* @example
|
47
47
|
* var oTable = $('#example').dataTable( {
|
48
48
|
* "sScrollX": "100%"
|
@@ -56,40 +56,49 @@ FixedColumns = function ( oDT, oInit ) {
|
|
56
56
|
alert( "FixedColumns warning: FixedColumns must be initialised with the 'new' keyword." );
|
57
57
|
return;
|
58
58
|
}
|
59
|
-
|
59
|
+
|
60
60
|
if ( typeof oInit == 'undefined' )
|
61
61
|
{
|
62
62
|
oInit = {};
|
63
63
|
}
|
64
|
-
|
64
|
+
|
65
65
|
/**
|
66
66
|
* Settings object which contains customisable information for FixedColumns instance
|
67
67
|
* @namespace
|
68
68
|
* @extends FixedColumns.defaults
|
69
69
|
*/
|
70
70
|
this.s = {
|
71
|
-
/**
|
71
|
+
/**
|
72
72
|
* DataTables settings objects
|
73
73
|
* @type object
|
74
74
|
* @default Obtained from DataTables instance
|
75
75
|
*/
|
76
76
|
"dt": oDT.fnSettings(),
|
77
|
-
|
78
|
-
/**
|
77
|
+
|
78
|
+
/**
|
79
79
|
* Number of columns in the DataTable - stored for quick access
|
80
80
|
* @type int
|
81
81
|
* @default Obtained from DataTables instance
|
82
82
|
*/
|
83
83
|
"iTableColumns": oDT.fnSettings().aoColumns.length,
|
84
|
-
|
85
|
-
/**
|
86
|
-
* Original widths of the columns as rendered by DataTables
|
84
|
+
|
85
|
+
/**
|
86
|
+
* Original outer widths of the columns as rendered by DataTables - used to calculate
|
87
|
+
* the FixedColumns grid bounding box
|
87
88
|
* @type array.<int>
|
88
89
|
* @default []
|
89
90
|
*/
|
90
|
-
"
|
91
|
-
|
92
|
-
/**
|
91
|
+
"aiOuterWidths": [],
|
92
|
+
|
93
|
+
/**
|
94
|
+
* Original inner widths of the columns as rendered by DataTables - used to apply widths
|
95
|
+
* to the columns
|
96
|
+
* @type array.<int>
|
97
|
+
* @default []
|
98
|
+
*/
|
99
|
+
"aiInnerWidths": [],
|
100
|
+
|
101
|
+
/**
|
93
102
|
* Flag to indicate if we are dealing with IE6/7 as these browsers need a little hack
|
94
103
|
* in the odd place
|
95
104
|
* @type boolean
|
@@ -98,12 +107,12 @@ FixedColumns = function ( oDT, oInit ) {
|
|
98
107
|
*/
|
99
108
|
"bOldIE": ($.browser.msie && ($.browser.version == "6.0" || $.browser.version == "7.0"))
|
100
109
|
};
|
101
|
-
|
102
|
-
|
110
|
+
|
111
|
+
|
103
112
|
/**
|
104
113
|
* DOM elements used by the class instance
|
105
114
|
* @namespace
|
106
|
-
*
|
115
|
+
*
|
107
116
|
*/
|
108
117
|
this.dom = {
|
109
118
|
/**
|
@@ -112,21 +121,21 @@ FixedColumns = function ( oDT, oInit ) {
|
|
112
121
|
* @default null
|
113
122
|
*/
|
114
123
|
"scroller": null,
|
115
|
-
|
124
|
+
|
116
125
|
/**
|
117
126
|
* DataTables header table
|
118
127
|
* @type node
|
119
128
|
* @default null
|
120
129
|
*/
|
121
130
|
"header": null,
|
122
|
-
|
131
|
+
|
123
132
|
/**
|
124
133
|
* DataTables body table
|
125
134
|
* @type node
|
126
135
|
* @default null
|
127
136
|
*/
|
128
137
|
"body": null,
|
129
|
-
|
138
|
+
|
130
139
|
/**
|
131
140
|
* DataTables footer table
|
132
141
|
* @type node
|
@@ -177,7 +186,7 @@ FixedColumns = function ( oDT, oInit ) {
|
|
177
186
|
"foot": null
|
178
187
|
}
|
179
188
|
},
|
180
|
-
|
189
|
+
|
181
190
|
/**
|
182
191
|
* Cloned table nodes
|
183
192
|
* @namespace
|
@@ -194,14 +203,14 @@ FixedColumns = function ( oDT, oInit ) {
|
|
194
203
|
* @default null
|
195
204
|
*/
|
196
205
|
"header": null,
|
197
|
-
|
206
|
+
|
198
207
|
/**
|
199
208
|
* Cloned body table
|
200
209
|
* @type node
|
201
210
|
* @default null
|
202
211
|
*/
|
203
212
|
"body": null,
|
204
|
-
|
213
|
+
|
205
214
|
/**
|
206
215
|
* Cloned footer table
|
207
216
|
* @type node
|
@@ -209,7 +218,7 @@ FixedColumns = function ( oDT, oInit ) {
|
|
209
218
|
*/
|
210
219
|
"footer": null
|
211
220
|
},
|
212
|
-
|
221
|
+
|
213
222
|
/**
|
214
223
|
* Right column cloned table nodes
|
215
224
|
* @namespace
|
@@ -221,14 +230,14 @@ FixedColumns = function ( oDT, oInit ) {
|
|
221
230
|
* @default null
|
222
231
|
*/
|
223
232
|
"header": null,
|
224
|
-
|
233
|
+
|
225
234
|
/**
|
226
235
|
* Cloned body table
|
227
236
|
* @type node
|
228
237
|
* @default null
|
229
238
|
*/
|
230
239
|
"body": null,
|
231
|
-
|
240
|
+
|
232
241
|
/**
|
233
242
|
* Cloned footer table
|
234
243
|
* @type node
|
@@ -241,7 +250,7 @@ FixedColumns = function ( oDT, oInit ) {
|
|
241
250
|
|
242
251
|
/* Attach the instance to the DataTables instance so it can be accessed easily */
|
243
252
|
this.s.dt.oFixedColumns = this;
|
244
|
-
|
253
|
+
|
245
254
|
/* Let's do it */
|
246
255
|
this._fnConstruct( oInit );
|
247
256
|
};
|
@@ -252,7 +261,7 @@ FixedColumns.prototype = {
|
|
252
261
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
253
262
|
* Public methods
|
254
263
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
255
|
-
|
264
|
+
|
256
265
|
/**
|
257
266
|
* Update the fixed columns - including headers and footers. Note that FixedColumns will
|
258
267
|
* automatically update the display whenever the host DataTable redraws.
|
@@ -262,7 +271,7 @@ FixedColumns.prototype = {
|
|
262
271
|
* "sScrollX": "100%"
|
263
272
|
* } );
|
264
273
|
* var oFC = new FixedColumns( oTable );
|
265
|
-
*
|
274
|
+
*
|
266
275
|
* // at some later point when the table has been manipulated....
|
267
276
|
* oFC.fnUpdate();
|
268
277
|
*/
|
@@ -270,8 +279,8 @@ FixedColumns.prototype = {
|
|
270
279
|
{
|
271
280
|
this._fnDraw( true );
|
272
281
|
},
|
273
|
-
|
274
|
-
|
282
|
+
|
283
|
+
|
275
284
|
/**
|
276
285
|
* Recalculate the resizes of the 3x3 grid that FixedColumns uses for display of the table.
|
277
286
|
* This is useful if you update the width of the table container. Note that FixedColumns will
|
@@ -282,7 +291,7 @@ FixedColumns.prototype = {
|
|
282
291
|
* "sScrollX": "100%"
|
283
292
|
* } );
|
284
293
|
* var oFC = new FixedColumns( oTable );
|
285
|
-
*
|
294
|
+
*
|
286
295
|
* // Resize the table container and then have FixedColumns adjust its layout....
|
287
296
|
* $('#content').width( 1200 );
|
288
297
|
* oFC.fnRedrawLayout();
|
@@ -291,8 +300,8 @@ FixedColumns.prototype = {
|
|
291
300
|
{
|
292
301
|
this._fnGridLayout();
|
293
302
|
},
|
294
|
-
|
295
|
-
|
303
|
+
|
304
|
+
|
296
305
|
/**
|
297
306
|
* Mark a row such that it's height should be recalculated when using 'semiauto' row
|
298
307
|
* height matching. This function will have no effect when 'none' or 'auto' row height
|
@@ -304,7 +313,7 @@ FixedColumns.prototype = {
|
|
304
313
|
* "sScrollX": "100%"
|
305
314
|
* } );
|
306
315
|
* var oFC = new FixedColumns( oTable );
|
307
|
-
*
|
316
|
+
*
|
308
317
|
* // manipulate the table - mark the row as needing an update then update the table
|
309
318
|
* // this allows the redraw performed by DataTables fnUpdate to recalculate the row
|
310
319
|
* // height
|
@@ -316,8 +325,8 @@ FixedColumns.prototype = {
|
|
316
325
|
nTr._DTTC_iHeight = null;
|
317
326
|
nTr.style.height = 'auto';
|
318
327
|
},
|
319
|
-
|
320
|
-
|
328
|
+
|
329
|
+
|
321
330
|
/**
|
322
331
|
* Set the height of a given row - provides cross browser compatibility
|
323
332
|
* @param {Node} nTarget TR element that should have it's height recalculated
|
@@ -328,7 +337,7 @@ FixedColumns.prototype = {
|
|
328
337
|
* "sScrollX": "100%"
|
329
338
|
* } );
|
330
339
|
* var oFC = new FixedColumns( oTable );
|
331
|
-
*
|
340
|
+
*
|
332
341
|
* // You may want to do this after manipulating a row in the fixed column
|
333
342
|
* oFC.fnSetRowHeight( $('#example tbody tr:eq(0)')[0], 50 );
|
334
343
|
*/
|
@@ -347,13 +356,13 @@ FixedColumns.prototype = {
|
|
347
356
|
$(nTarget).children().height( iHeight-iBoxHack );
|
348
357
|
}
|
349
358
|
},
|
350
|
-
|
351
|
-
|
352
|
-
|
359
|
+
|
360
|
+
|
361
|
+
|
353
362
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
354
363
|
* Private methods (they are of course public in JS, but recommended as private)
|
355
364
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
356
|
-
|
365
|
+
|
357
366
|
/**
|
358
367
|
* Initialisation for FixedColumns
|
359
368
|
* @param {Object} oInit User settings for initialisation
|
@@ -364,7 +373,7 @@ FixedColumns.prototype = {
|
|
364
373
|
{
|
365
374
|
var i, iLen, iWidth,
|
366
375
|
that = this;
|
367
|
-
|
376
|
+
|
368
377
|
/* Sanity checking */
|
369
378
|
if ( typeof this.s.dt.oInstance.fnVersionCheck != 'function' ||
|
370
379
|
this.s.dt.oInstance.fnVersionCheck( '1.8.0' ) !== true )
|
@@ -373,7 +382,7 @@ FixedColumns.prototype = {
|
|
373
382
|
"Please upgrade your DataTables installation" );
|
374
383
|
return;
|
375
384
|
}
|
376
|
-
|
385
|
+
|
377
386
|
if ( this.s.dt.oScroll.sX === "" )
|
378
387
|
{
|
379
388
|
this.s.dt.oInstance.oApi._fnLog( this.s.dt, 1, "FixedColumns is not needed (no "+
|
@@ -381,7 +390,7 @@ FixedColumns.prototype = {
|
|
381
390
|
"column fixing when scrolling is not enabled" );
|
382
391
|
return;
|
383
392
|
}
|
384
|
-
|
393
|
+
|
385
394
|
/* Apply the settings from the user / defaults */
|
386
395
|
this.s = $.extend( true, this.s, FixedColumns.defaults, oInit );
|
387
396
|
|
@@ -393,9 +402,14 @@ FixedColumns.prototype = {
|
|
393
402
|
var iLeftWidth = 0;
|
394
403
|
var iRightWidth = 0;
|
395
404
|
|
396
|
-
$('tbody>tr:eq(0)>td', this.s.dt.nTable).each( function (i) {
|
405
|
+
$('tbody>tr:eq(0)>td, tbody>tr:eq(0)>th', this.s.dt.nTable).each( function (i) {
|
406
|
+
// Inner width is used to assign widths to cells
|
407
|
+
that.s.aiInnerWidths.push( $(this).width() );
|
408
|
+
|
409
|
+
// Outer width is used to calculate the container
|
397
410
|
iWidth = $(this).outerWidth();
|
398
|
-
that.s.
|
411
|
+
that.s.aiOuterWidths.push( iWidth );
|
412
|
+
|
399
413
|
if ( i < that.s.iLeftColumns )
|
400
414
|
{
|
401
415
|
iLeftWidth += iWidth;
|
@@ -409,7 +423,7 @@ FixedColumns.prototype = {
|
|
409
423
|
if ( this.s.iLeftWidth === null )
|
410
424
|
{
|
411
425
|
this.s.iLeftWidth = this.s.sLeftWidth == 'fixed' ?
|
412
|
-
iLeftWidth : (iLeftWidth/iScrollWidth) * 100;
|
426
|
+
iLeftWidth : (iLeftWidth/iScrollWidth) * 100;
|
413
427
|
}
|
414
428
|
|
415
429
|
if ( this.s.iRightWidth === null )
|
@@ -417,7 +431,7 @@ FixedColumns.prototype = {
|
|
417
431
|
this.s.iRightWidth = this.s.sRightWidth == 'fixed' ?
|
418
432
|
iRightWidth : (iRightWidth/iScrollWidth) * 100;
|
419
433
|
}
|
420
|
-
|
434
|
+
|
421
435
|
/* Set up the DOM that we want for the fixed column layout grid */
|
422
436
|
this._fnGridSetup();
|
423
437
|
|
@@ -443,7 +457,7 @@ FixedColumns.prototype = {
|
|
443
457
|
$(window).resize( function () {
|
444
458
|
that._fnGridLayout.call( that );
|
445
459
|
} );
|
446
|
-
|
460
|
+
|
447
461
|
var bFirstDraw = true;
|
448
462
|
this.s.dt.aoDrawCallback = [ {
|
449
463
|
"fn": function () {
|
@@ -453,7 +467,7 @@ FixedColumns.prototype = {
|
|
453
467
|
},
|
454
468
|
"sName": "FixedColumns"
|
455
469
|
} ].concat( this.s.dt.aoDrawCallback );
|
456
|
-
|
470
|
+
|
457
471
|
/* Get things right to start with - note that due to adjusting the columns, there must be
|
458
472
|
* another redraw of the main table. It doesn't need to be a full redraw however.
|
459
473
|
*/
|
@@ -461,8 +475,8 @@ FixedColumns.prototype = {
|
|
461
475
|
this._fnGridHeight();
|
462
476
|
this.s.dt.oInstance.fnDraw(false);
|
463
477
|
},
|
464
|
-
|
465
|
-
|
478
|
+
|
479
|
+
|
466
480
|
/**
|
467
481
|
* Set up the DOM for the fixed column. The way the layout works is to create a 1x3 grid
|
468
482
|
* for the left column, the DataTable (for which we just reuse the scrolling element DataTable
|
@@ -479,8 +493,8 @@ FixedColumns.prototype = {
|
|
479
493
|
this.dom.body = this.s.dt.nTable;
|
480
494
|
this.dom.header = this.s.dt.nTHead.parentNode;
|
481
495
|
this.dom.header.parentNode.parentNode.style.position = "relative";
|
482
|
-
|
483
|
-
var nSWrapper =
|
496
|
+
|
497
|
+
var nSWrapper =
|
484
498
|
$('<div class="DTFC_ScrollWrapper" style="position:relative; clear:both;">'+
|
485
499
|
'<div class="DTFC_LeftWrapper" style="position:absolute; top:0; left:0;">'+
|
486
500
|
'<div class="DTFC_LeftHeadWrapper" style="position:relative; top:0; left:0; overflow:hidden;"></div>'+
|
@@ -507,7 +521,7 @@ FixedColumns.prototype = {
|
|
507
521
|
this.dom.grid.right.head = nRight.childNodes[0];
|
508
522
|
this.dom.grid.right.body = nRight.childNodes[1];
|
509
523
|
}
|
510
|
-
|
524
|
+
|
511
525
|
if ( this.s.dt.nTFoot )
|
512
526
|
{
|
513
527
|
this.dom.footer = this.s.dt.nTFoot.parentNode;
|
@@ -527,8 +541,8 @@ FixedColumns.prototype = {
|
|
527
541
|
this.dom.grid.dt.style.left = this.s.iLeftWidth+"px";
|
528
542
|
this.dom.grid.dt.style.width = ($(this.dom.grid.dt).width()-this.s.iLeftWidth-this.s.iRightWidth)+"px";
|
529
543
|
},
|
530
|
-
|
531
|
-
|
544
|
+
|
545
|
+
|
532
546
|
/**
|
533
547
|
* Style and position the grid used for the FixedColumns layout based on the instance settings.
|
534
548
|
* Specifically sLeftWidth ('fixed' or 'absolute'), iLeftWidth (px if fixed, % if absolute) and
|
@@ -572,10 +586,10 @@ FixedColumns.prototype = {
|
|
572
586
|
oGrid.right.wrapper.style.left = (iTotal-iRight)+"px";
|
573
587
|
}
|
574
588
|
},
|
575
|
-
|
576
|
-
|
589
|
+
|
590
|
+
|
577
591
|
/**
|
578
|
-
* Recalculate and set the height of the grid components used for positioning of the
|
592
|
+
* Recalculate and set the height of the grid components used for positioning of the
|
579
593
|
* FixedColumn display grid.
|
580
594
|
* @returns {void}
|
581
595
|
* @private
|
@@ -588,15 +602,15 @@ FixedColumns.prototype = {
|
|
588
602
|
oGrid.wrapper.style.height = iHeight+"px";
|
589
603
|
oGrid.left.body.style.height = $(this.dom.scroller).height()+"px";
|
590
604
|
oGrid.left.wrapper.style.height = iHeight+"px";
|
591
|
-
|
605
|
+
|
592
606
|
if ( this.s.iRightColumns > 0 )
|
593
607
|
{
|
594
608
|
oGrid.right.wrapper.style.height = iHeight+"px";
|
595
609
|
oGrid.right.body.style.height = $(this.dom.scroller).height()+"px";
|
596
610
|
}
|
597
611
|
},
|
598
|
-
|
599
|
-
|
612
|
+
|
613
|
+
|
600
614
|
/**
|
601
615
|
* Clone and position the fixed columns
|
602
616
|
* @returns {void}
|
@@ -615,13 +629,13 @@ FixedColumns.prototype = {
|
|
615
629
|
}
|
616
630
|
|
617
631
|
/* Event triggering */
|
618
|
-
$(this).trigger( 'draw', {
|
632
|
+
$(this).trigger( 'draw', {
|
619
633
|
"leftClone": this.dom.clone.left,
|
620
634
|
"rightClone": this.dom.clone.right
|
621
635
|
} );
|
622
636
|
},
|
623
|
-
|
624
|
-
|
637
|
+
|
638
|
+
|
625
639
|
/**
|
626
640
|
* Clone the right columns
|
627
641
|
* @returns {void}
|
@@ -634,7 +648,7 @@ FixedColumns.prototype = {
|
|
634
648
|
{
|
635
649
|
return;
|
636
650
|
}
|
637
|
-
|
651
|
+
|
638
652
|
var that = this,
|
639
653
|
i, jq,
|
640
654
|
aiColumns = [];
|
@@ -646,8 +660,8 @@ FixedColumns.prototype = {
|
|
646
660
|
|
647
661
|
this._fnClone( this.dom.clone.right, this.dom.grid.right, aiColumns, bAll );
|
648
662
|
},
|
649
|
-
|
650
|
-
|
663
|
+
|
664
|
+
|
651
665
|
/**
|
652
666
|
* Clone the left columns
|
653
667
|
* @returns {void}
|
@@ -660,11 +674,11 @@ FixedColumns.prototype = {
|
|
660
674
|
{
|
661
675
|
return;
|
662
676
|
}
|
663
|
-
|
677
|
+
|
664
678
|
var that = this,
|
665
679
|
i, jq,
|
666
680
|
aiColumns = [];
|
667
|
-
|
681
|
+
|
668
682
|
for ( i=0 ; i<this.s.iLeftColumns ; i++ )
|
669
683
|
{
|
670
684
|
aiColumns.push( i );
|
@@ -672,8 +686,8 @@ FixedColumns.prototype = {
|
|
672
686
|
|
673
687
|
this._fnClone( this.dom.clone.left, this.dom.grid.left, aiColumns, bAll );
|
674
688
|
},
|
675
|
-
|
676
|
-
|
689
|
+
|
690
|
+
|
677
691
|
/**
|
678
692
|
* Make a copy of the layout object for a header or footer element from DataTables. Note that
|
679
693
|
* this method will clone the nodes in the layout object.
|
@@ -720,19 +734,19 @@ FixedColumns.prototype = {
|
|
720
734
|
} );
|
721
735
|
}
|
722
736
|
}
|
723
|
-
|
737
|
+
|
724
738
|
aReturn.push( aRow );
|
725
739
|
}
|
726
740
|
|
727
741
|
return aReturn;
|
728
742
|
},
|
729
|
-
|
730
|
-
|
743
|
+
|
744
|
+
|
731
745
|
/**
|
732
746
|
* Clone the DataTable nodes and place them in the DOM (sized correctly)
|
733
747
|
* @returns {void}
|
734
748
|
* @param {Object} oClone Object containing the header, footer and body cloned DOM elements
|
735
|
-
* @param {Object} oGrid Grid object containing the display grid elements for the cloned
|
749
|
+
* @param {Object} oGrid Grid object containing the display grid elements for the cloned
|
736
750
|
* column (left or right)
|
737
751
|
* @param {Array} aiColumns Column indexes which should be operated on from the DataTable
|
738
752
|
* @param {Boolean} bAll Indicate if the header and footer should be updated as well (true)
|
@@ -743,7 +757,7 @@ FixedColumns.prototype = {
|
|
743
757
|
var that = this,
|
744
758
|
i, iLen, j, jLen, jq, nTarget, iColumn, nClone, iIndex;
|
745
759
|
|
746
|
-
/*
|
760
|
+
/*
|
747
761
|
* Header
|
748
762
|
*/
|
749
763
|
if ( bAll )
|
@@ -756,7 +770,7 @@ FixedColumns.prototype = {
|
|
756
770
|
oClone.header.className += " DTFC_Cloned";
|
757
771
|
oClone.header.style.width = "100%";
|
758
772
|
oGrid.head.appendChild( oClone.header );
|
759
|
-
|
773
|
+
|
760
774
|
/* Copy the DataTables layout cache for the header for our floating column */
|
761
775
|
var aoCloneLayout = this._fnCopyLayout( this.s.dt.aoHeader, aiColumns );
|
762
776
|
var jqCloneThead = $('>thead', oClone.header);
|
@@ -776,31 +790,31 @@ FixedColumns.prototype = {
|
|
776
790
|
else
|
777
791
|
{
|
778
792
|
/* To ensure that we copy cell classes exactly, regardless of colspan, multiple rows
|
779
|
-
* etc, we make a copy of the header from the DataTable again, but don't insert the
|
793
|
+
* etc, we make a copy of the header from the DataTable again, but don't insert the
|
780
794
|
* cloned cells, just copy the classes across. To get the matching layout for the
|
781
795
|
* fixed component, we use the DataTables _fnDetectHeader method, allowing 1:1 mapping
|
782
796
|
*/
|
783
797
|
var aoCloneLayout = this._fnCopyLayout( this.s.dt.aoHeader, aiColumns );
|
784
|
-
var
|
798
|
+
var aoFixedHeader=[];
|
785
799
|
|
786
|
-
this.s.dt.oApi._fnDetectHeader(
|
800
|
+
this.s.dt.oApi._fnDetectHeader( aoFixedHeader, $('>thead', oClone.header)[0] );
|
787
801
|
|
788
802
|
for ( i=0, iLen=aoCloneLayout.length ; i<iLen ; i++ )
|
789
803
|
{
|
790
804
|
for ( j=0, jLen=aoCloneLayout[i].length ; j<jLen ; j++ )
|
791
805
|
{
|
792
|
-
|
806
|
+
aoFixedHeader[i][j].cell.className = aoCloneLayout[i][j].cell.className;
|
793
807
|
|
794
808
|
// If jQuery UI theming is used we need to copy those elements as well
|
795
|
-
$('span.DataTables_sort_icon',
|
809
|
+
$('span.DataTables_sort_icon', aoFixedHeader[i][j].cell).each( function () {
|
796
810
|
this.className = $('span.DataTables_sort_icon', aoCloneLayout[i][j].cell)[0].className;
|
797
811
|
} );
|
798
812
|
}
|
799
813
|
}
|
800
814
|
}
|
801
815
|
this._fnEqualiseHeights( 'thead', this.dom.header, oClone.header );
|
802
|
-
|
803
|
-
/*
|
816
|
+
|
817
|
+
/*
|
804
818
|
* Body
|
805
819
|
*/
|
806
820
|
if ( this.s.sHeightMatch == 'auto' )
|
@@ -808,13 +822,13 @@ FixedColumns.prototype = {
|
|
808
822
|
/* Remove any heights which have been applied already and let the browser figure it out */
|
809
823
|
$('>tbody>tr', that.dom.body).css('height', 'auto');
|
810
824
|
}
|
811
|
-
|
825
|
+
|
812
826
|
if ( oClone.body !== null )
|
813
827
|
{
|
814
828
|
oClone.body.parentNode.removeChild( oClone.body );
|
815
829
|
oClone.body = null;
|
816
830
|
}
|
817
|
-
|
831
|
+
|
818
832
|
oClone.body = $(this.dom.body).clone(true)[0];
|
819
833
|
oClone.body.className += " DTFC_Cloned";
|
820
834
|
oClone.body.style.paddingBottom = this.s.dt.oScroll.iBarWidth+"px";
|
@@ -823,10 +837,10 @@ FixedColumns.prototype = {
|
|
823
837
|
{
|
824
838
|
oClone.body.removeAttribute('id');
|
825
839
|
}
|
826
|
-
|
840
|
+
|
827
841
|
$('>thead>tr', oClone.body).empty();
|
828
842
|
$('>tfoot', oClone.body).remove();
|
829
|
-
|
843
|
+
|
830
844
|
var nBody = $('tbody', oClone.body)[0];
|
831
845
|
$(nBody).empty();
|
832
846
|
if ( this.s.dt.aiDisplay.length > 0 )
|
@@ -840,7 +854,7 @@ FixedColumns.prototype = {
|
|
840
854
|
{
|
841
855
|
iColumn = aiColumns[iIndex];
|
842
856
|
|
843
|
-
nClone = this.s.dt.aoColumns[iColumn].nTh;
|
857
|
+
nClone = $(this.s.dt.aoColumns[iColumn].nTh).clone(true)[0];
|
844
858
|
nClone.innerHTML = "";
|
845
859
|
|
846
860
|
oStyle = nClone.style;
|
@@ -849,7 +863,7 @@ FixedColumns.prototype = {
|
|
849
863
|
oStyle.borderTopWidth = "0";
|
850
864
|
oStyle.borderBottomWidth = "0";
|
851
865
|
oStyle.height = 0;
|
852
|
-
oStyle.width = that.s.
|
866
|
+
oStyle.width = that.s.aiInnerWidths[iColumn]+"px";
|
853
867
|
|
854
868
|
nInnerThead.appendChild( nClone );
|
855
869
|
}
|
@@ -880,12 +894,12 @@ FixedColumns.prototype = {
|
|
880
894
|
nBody.appendChild( nClone );
|
881
895
|
} );
|
882
896
|
}
|
883
|
-
|
897
|
+
|
884
898
|
oClone.body.style.width = "100%";
|
885
899
|
oGrid.body.appendChild( oClone.body );
|
886
900
|
|
887
901
|
this._fnEqualiseHeights( 'tbody', that.dom.body, oClone.body );
|
888
|
-
|
902
|
+
|
889
903
|
/*
|
890
904
|
* Footer
|
891
905
|
*/
|
@@ -906,7 +920,7 @@ FixedColumns.prototype = {
|
|
906
920
|
var aoCloneLayout = this._fnCopyLayout( this.s.dt.aoFooter, aiColumns );
|
907
921
|
var jqCloneTfoot = $('>tfoot', oClone.footer);
|
908
922
|
jqCloneTfoot.empty();
|
909
|
-
|
923
|
+
|
910
924
|
for ( i=0, iLen=aoCloneLayout.length ; i<iLen ; i++ )
|
911
925
|
{
|
912
926
|
jqCloneTfoot[0].appendChild( aoCloneLayout[i].nTr );
|
@@ -935,7 +949,7 @@ FixedColumns.prototype = {
|
|
935
949
|
var anUnique = this.s.dt.oApi._fnGetUniqueThs( this.s.dt, $('>thead', oClone.header)[0] );
|
936
950
|
$(anUnique).each( function (i) {
|
937
951
|
iColumn = aiColumns[i];
|
938
|
-
this.style.width = that.s.
|
952
|
+
this.style.width = that.s.aiInnerWidths[iColumn]+"px";
|
939
953
|
} );
|
940
954
|
|
941
955
|
if ( that.s.dt.nTFoot !== null )
|
@@ -943,12 +957,12 @@ FixedColumns.prototype = {
|
|
943
957
|
anUnique = this.s.dt.oApi._fnGetUniqueThs( this.s.dt, $('>tfoot', oClone.footer)[0] );
|
944
958
|
$(anUnique).each( function (i) {
|
945
959
|
iColumn = aiColumns[i];
|
946
|
-
this.style.width = that.s.
|
960
|
+
this.style.width = that.s.aiInnerWidths[iColumn]+"px";
|
947
961
|
} );
|
948
962
|
}
|
949
963
|
},
|
950
|
-
|
951
|
-
|
964
|
+
|
965
|
+
|
952
966
|
/**
|
953
967
|
* From a given table node (THEAD etc), get a list of TR direct child elements
|
954
968
|
* @param {Node} nIn Table element to search for TR elements (THEAD, TBODY or TFOOT element)
|
@@ -968,7 +982,7 @@ FixedColumns.prototype = {
|
|
968
982
|
return aOut;
|
969
983
|
},
|
970
984
|
|
971
|
-
|
985
|
+
|
972
986
|
/**
|
973
987
|
* Equalise the heights of the rows in a given table node in a cross browser way
|
974
988
|
* @returns {void}
|
@@ -983,7 +997,7 @@ FixedColumns.prototype = {
|
|
983
997
|
{
|
984
998
|
return;
|
985
999
|
}
|
986
|
-
|
1000
|
+
|
987
1001
|
var that = this,
|
988
1002
|
i, iLen, iHeight, iHeight2, iHeightOriginal, iHeightClone,
|
989
1003
|
rootOriginal = original.getElementsByTagName(nodeName)[0],
|
@@ -992,10 +1006,10 @@ FixedColumns.prototype = {
|
|
992
1006
|
iBoxHack = jqBoxHack.outerHeight() - jqBoxHack.height(),
|
993
1007
|
anOriginal = this._fnGetTrNodes( rootOriginal ),
|
994
1008
|
anClone = this._fnGetTrNodes( rootClone );
|
995
|
-
|
1009
|
+
|
996
1010
|
for ( i=0, iLen=anClone.length ; i<iLen ; i++ )
|
997
1011
|
{
|
998
|
-
if ( this.s.sHeightMatch == 'semiauto' && typeof anOriginal[i]._DTTC_iHeight != 'undefined' &&
|
1012
|
+
if ( this.s.sHeightMatch == 'semiauto' && typeof anOriginal[i]._DTTC_iHeight != 'undefined' &&
|
999
1013
|
anOriginal[i]._DTTC_iHeight !== null )
|
1000
1014
|
{
|
1001
1015
|
/* Oddly enough, IE / Chrome seem not to copy the style height - Mozilla and Opera keep it */
|
@@ -1005,21 +1019,21 @@ FixedColumns.prototype = {
|
|
1005
1019
|
}
|
1006
1020
|
continue;
|
1007
1021
|
}
|
1008
|
-
|
1022
|
+
|
1009
1023
|
iHeightOriginal = anOriginal[i].offsetHeight;
|
1010
1024
|
iHeightClone = anClone[i].offsetHeight;
|
1011
1025
|
iHeight = iHeightClone > iHeightOriginal ? iHeightClone : iHeightOriginal;
|
1012
|
-
|
1026
|
+
|
1013
1027
|
if ( this.s.sHeightMatch == 'semiauto' )
|
1014
1028
|
{
|
1015
1029
|
anOriginal[i]._DTTC_iHeight = iHeight;
|
1016
1030
|
}
|
1017
|
-
|
1031
|
+
|
1018
1032
|
/* Can we use some kind of object detection here?! This is very nasty - damn browsers */
|
1019
1033
|
if ( $.browser.msie && $.browser.version < 8 )
|
1020
1034
|
{
|
1021
1035
|
$(anClone[i]).children().height( iHeight-iBoxHack );
|
1022
|
-
$(anOriginal[i]).children().height( iHeight-iBoxHack );
|
1036
|
+
$(anOriginal[i]).children().height( iHeight-iBoxHack );
|
1023
1037
|
}
|
1024
1038
|
else
|
1025
1039
|
{
|
@@ -1043,7 +1057,7 @@ FixedColumns.prototype = {
|
|
1043
1057
|
* @static
|
1044
1058
|
*/
|
1045
1059
|
FixedColumns.defaults = {
|
1046
|
-
/**
|
1060
|
+
/**
|
1047
1061
|
* Number of left hand columns to fix in position
|
1048
1062
|
* @type int
|
1049
1063
|
* @default 1
|
@@ -1057,8 +1071,8 @@ FixedColumns.defaults = {
|
|
1057
1071
|
* } );
|
1058
1072
|
*/
|
1059
1073
|
"iLeftColumns": 1,
|
1060
|
-
|
1061
|
-
/**
|
1074
|
+
|
1075
|
+
/**
|
1062
1076
|
* Number of right hand columns to fix in position
|
1063
1077
|
* @type int
|
1064
1078
|
* @default 0
|
@@ -1072,8 +1086,8 @@ FixedColumns.defaults = {
|
|
1072
1086
|
* } );
|
1073
1087
|
*/
|
1074
1088
|
"iRightColumns": 0,
|
1075
|
-
|
1076
|
-
/**
|
1089
|
+
|
1090
|
+
/**
|
1077
1091
|
* Draw callback function which is called when FixedColumns has redrawn the fixed assets
|
1078
1092
|
* @type function(object, object):void
|
1079
1093
|
* @default null
|
@@ -1089,8 +1103,8 @@ FixedColumns.defaults = {
|
|
1089
1103
|
* } );
|
1090
1104
|
*/
|
1091
1105
|
"fnDrawCallback": null,
|
1092
|
-
|
1093
|
-
/**
|
1106
|
+
|
1107
|
+
/**
|
1094
1108
|
* Type of left column size calculation. Can take the values of "fixed", whereby the iLeftWidth
|
1095
1109
|
* value will be treated as a pixel value, or "relative" for which case iLeftWidth will be
|
1096
1110
|
* treated as a percentage value.
|
@@ -1107,8 +1121,8 @@ FixedColumns.defaults = {
|
|
1107
1121
|
* } );
|
1108
1122
|
*/
|
1109
1123
|
"sLeftWidth": "fixed",
|
1110
|
-
|
1111
|
-
/**
|
1124
|
+
|
1125
|
+
/**
|
1112
1126
|
* Width to set for the width of the left fixed column(s) - note that the behaviour of this
|
1113
1127
|
* property is directly effected by the sLeftWidth property. If not defined then this property
|
1114
1128
|
* is calculated automatically from what has been assigned by DataTables.
|
@@ -1124,10 +1138,10 @@ FixedColumns.defaults = {
|
|
1124
1138
|
* } );
|
1125
1139
|
*/
|
1126
1140
|
"iLeftWidth": null,
|
1127
|
-
|
1128
|
-
/**
|
1129
|
-
* Type of right column size calculation. Can take the values of "fixed", whereby the
|
1130
|
-
* iRightWidth value will be treated as a pixel value, or "relative" for which case
|
1141
|
+
|
1142
|
+
/**
|
1143
|
+
* Type of right column size calculation. Can take the values of "fixed", whereby the
|
1144
|
+
* iRightWidth value will be treated as a pixel value, or "relative" for which case
|
1131
1145
|
* iRightWidth will be treated as a percentage value.
|
1132
1146
|
* @type string
|
1133
1147
|
* @default fixed
|
@@ -1142,7 +1156,7 @@ FixedColumns.defaults = {
|
|
1142
1156
|
* } );
|
1143
1157
|
*/
|
1144
1158
|
"sRightWidth": "fixed",
|
1145
|
-
|
1159
|
+
|
1146
1160
|
/**
|
1147
1161
|
* Width to set for the width of the right fixed column(s) - note that the behaviour of this
|
1148
1162
|
* property is directly effected by the sRightWidth property. If not defined then this property
|
@@ -1159,8 +1173,8 @@ FixedColumns.defaults = {
|
|
1159
1173
|
* } );
|
1160
1174
|
*/
|
1161
1175
|
"iRightWidth": null,
|
1162
|
-
|
1163
|
-
/**
|
1176
|
+
|
1177
|
+
/**
|
1164
1178
|
* Height matching algorthim to use. This can be "none" which will result in no height
|
1165
1179
|
* matching being applied by FixedColumns (height matching could be forced by CSS in this
|
1166
1180
|
* case), "semiauto" whereby the height calculation will be performed once, and the result
|
@@ -1204,7 +1218,7 @@ FixedColumns.prototype.CLASS = "FixedColumns";
|
|
1204
1218
|
* @default See code
|
1205
1219
|
* @static
|
1206
1220
|
*/
|
1207
|
-
FixedColumns.VERSION = "2.0.
|
1221
|
+
FixedColumns.VERSION = "2.0.4.dev";
|
1208
1222
|
|
1209
1223
|
|
1210
1224
|
|