jquery-datatables-rails 1.11.3 → 1.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/{vendor → app}/assets/images/dataTables/back_disabled.png +0 -0
  3. data/{vendor → app}/assets/images/dataTables/back_enabled.png +0 -0
  4. data/{vendor → app}/assets/images/dataTables/back_enabled_hover.png +0 -0
  5. data/{vendor → app}/assets/images/dataTables/extras/background.png +0 -0
  6. data/{vendor → app}/assets/images/dataTables/extras/button.png +0 -0
  7. data/{vendor → app}/assets/images/dataTables/extras/collection.png +0 -0
  8. data/{vendor → app}/assets/images/dataTables/extras/collection_hover.png +0 -0
  9. data/{vendor → app}/assets/images/dataTables/extras/copy.png +0 -0
  10. data/{vendor → app}/assets/images/dataTables/extras/copy_hover.png +0 -0
  11. data/{vendor → app}/assets/images/dataTables/extras/csv.png +0 -0
  12. data/{vendor → app}/assets/images/dataTables/extras/csv_hover.png +0 -0
  13. data/{vendor → app}/assets/images/dataTables/extras/insert.png +0 -0
  14. data/{vendor → app}/assets/images/dataTables/extras/pdf.png +0 -0
  15. data/{vendor → app}/assets/images/dataTables/extras/pdf_hover.png +0 -0
  16. data/{vendor → app}/assets/images/dataTables/extras/print.png +0 -0
  17. data/{vendor → app}/assets/images/dataTables/extras/print_hover.png +0 -0
  18. data/{vendor → app}/assets/images/dataTables/extras/xls.png +0 -0
  19. data/{vendor → app}/assets/images/dataTables/extras/xls_hover.png +0 -0
  20. data/{vendor → app}/assets/images/dataTables/favicon.ico +0 -0
  21. data/{vendor → app}/assets/images/dataTables/forward_disabled.png +0 -0
  22. data/{vendor → app}/assets/images/dataTables/forward_enabled.png +0 -0
  23. data/{vendor → app}/assets/images/dataTables/forward_enabled_hover.png +0 -0
  24. data/{vendor → app}/assets/images/dataTables/foundation/sort_asc.png +0 -0
  25. data/{vendor → app}/assets/images/dataTables/foundation/sort_asc_disabled.png +0 -0
  26. data/{vendor → app}/assets/images/dataTables/foundation/sort_both.png +0 -0
  27. data/{vendor → app}/assets/images/dataTables/foundation/sort_desc.png +0 -0
  28. data/{vendor → app}/assets/images/dataTables/foundation/sort_desc_disabled.png +0 -0
  29. data/{vendor → app}/assets/images/dataTables/minus.png +0 -0
  30. data/{vendor → app}/assets/images/dataTables/plus.png +0 -0
  31. data/{vendor → app}/assets/images/dataTables/sort_asc.png +0 -0
  32. data/{vendor → app}/assets/images/dataTables/sort_asc_disabled.png +0 -0
  33. data/{vendor → app}/assets/images/dataTables/sort_both.png +0 -0
  34. data/{vendor → app}/assets/images/dataTables/sort_desc.png +0 -0
  35. data/{vendor → app}/assets/images/dataTables/sort_desc_disabled.png +0 -0
  36. data/{vendor → app}/assets/javascripts/dataTables/extras/AutoFill.js +0 -0
  37. data/{vendor → app}/assets/javascripts/dataTables/extras/ColReorder.js +0 -0
  38. data/{vendor → app}/assets/javascripts/dataTables/extras/ColVis.js +0 -0
  39. data/{vendor → app}/assets/javascripts/dataTables/extras/FixedColumns.js +491 -401
  40. data/{vendor → app}/assets/javascripts/dataTables/extras/FixedHeader.js +0 -0
  41. data/{vendor → app}/assets/javascripts/dataTables/extras/KeyTable.js +0 -0
  42. data/{vendor → app}/assets/javascripts/dataTables/extras/Scroller.js +0 -0
  43. data/{vendor → app}/assets/javascripts/dataTables/extras/TableTools.js +0 -0
  44. data/{vendor → app}/assets/javascripts/dataTables/extras/TableTools.min.js +0 -0
  45. data/{vendor → app}/assets/javascripts/dataTables/extras/ZeroClipboard.js +0 -0
  46. data/{vendor → app}/assets/javascripts/dataTables/jquery.dataTables.api.fnFilterOnReturn.js +0 -0
  47. data/{vendor → app}/assets/javascripts/dataTables/jquery.dataTables.api.fnGetColumnData.js +0 -0
  48. data/{vendor → app}/assets/javascripts/dataTables/jquery.dataTables.api.fnReloadAjax.js +0 -0
  49. data/{vendor → app}/assets/javascripts/dataTables/jquery.dataTables.api.fnSetFilteringDelay.js +0 -0
  50. data/{vendor → app}/assets/javascripts/dataTables/jquery.dataTables.bootstrap.js +0 -0
  51. data/{vendor → app}/assets/javascripts/dataTables/jquery.dataTables.bootstrap3.js +0 -0
  52. data/{vendor → app}/assets/javascripts/dataTables/jquery.dataTables.foundation.js +0 -0
  53. data/{vendor → app}/assets/javascripts/dataTables/jquery.dataTables.js +0 -0
  54. data/{vendor → app}/assets/javascripts/dataTables/jquery.dataTables.responsive.js +0 -0
  55. data/{vendor → app}/assets/javascripts/dataTables/jquery.dataTables.sorting.numbersHtml.js +0 -0
  56. data/{vendor → app}/assets/javascripts/dataTables/jquery.dataTables.typeDetection.numbersHtml.js +0 -0
  57. data/{vendor → app}/assets/media/dataTables/extras/as3/ZeroClipboard.as +0 -0
  58. data/{vendor → app}/assets/media/dataTables/extras/as3/ZeroClipboardPdf.as +0 -0
  59. data/{vendor → app}/assets/media/dataTables/extras/as3/lib/AlivePDF.swc +0 -0
  60. data/{vendor → app}/assets/media/dataTables/extras/swf/copy_csv_xls.swf +0 -0
  61. data/{vendor → app}/assets/media/dataTables/extras/swf/copy_csv_xls_pdf.swf +0 -0
  62. data/{vendor → app}/assets/stylesheets/dataTables/extras/ColReorder.css.erb +0 -0
  63. data/{vendor → app}/assets/stylesheets/dataTables/extras/ColVis.css +0 -0
  64. data/{vendor → app}/assets/stylesheets/dataTables/extras/ColVisAlt.css.erb +0 -0
  65. data/{vendor → app}/assets/stylesheets/dataTables/extras/TableTools.css.erb +0 -0
  66. data/{vendor → app}/assets/stylesheets/dataTables/extras/TableTools_JUI.css +0 -0
  67. data/app/assets/stylesheets/dataTables/jquery.dataTables.bootstrap.css.scss +201 -0
  68. data/{vendor → app}/assets/stylesheets/dataTables/jquery.dataTables.bootstrap3.css.scss +4 -0
  69. data/{vendor → app}/assets/stylesheets/dataTables/jquery.dataTables.css.scss +0 -0
  70. data/{vendor → app}/assets/stylesheets/dataTables/jquery.dataTables.foundation.css.scss +0 -0
  71. data/{vendor → app}/assets/stylesheets/dataTables/jquery.dataTables.responsive.css.scss +0 -0
  72. data/{vendor → app}/assets/stylesheets/dataTables/src/demo_page.css +0 -0
  73. data/{vendor → app}/assets/stylesheets/dataTables/src/demo_table.css +0 -0
  74. data/{vendor → app}/assets/stylesheets/dataTables/src/demo_table_jui.css +0 -0
  75. data/{vendor → app}/assets/stylesheets/dataTables/src/jquery.dataTables_themeroller.css +0 -0
  76. data/lib/jquery/datatables/rails/version.rb +1 -1
  77. metadata +75 -75
  78. data/vendor/assets/stylesheets/dataTables/jquery.dataTables.bootstrap.css.scss +0 -51
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 037dfdbef8b4ecec1f3529c3748a8265e48d6569
4
- data.tar.gz: 7cf9eb12d937c254ce8a49e2362af6d88f8094a1
3
+ metadata.gz: 6d64a5a2fda0a91e2ba0ec9621335d60a6208ddc
4
+ data.tar.gz: 7bdfdd3e6b7f358fe15e1559030250a2a79b9301
5
5
  SHA512:
6
- metadata.gz: 93b9dfe61876537f5058e7f9905f3254aa80970a18624efd54e0ac0e0fdc909a8e14a9d00ad61ee23c45a74f7eae4dbf7cd2526707da7da057e1e3d7ca953a33
7
- data.tar.gz: ec194243411f26c77e9c3bb929815248db9f1de06cc0ffc178f1873febc8b32991e70d91c35c4da7b03e2b22043ad0baa162881177b2b4290b92c7e8f6d9003b
6
+ metadata.gz: dbd4d831a8b66f179294fc392d592143bb97c873852bb21aff9537c08cc8b3bffa19b2942b986c8222b4b6445b6bb826a9e7f3d788afdee04678a0cd7f3a4cab
7
+ data.tar.gz: b6019df8db59ebf1902fc02f3be68e858f3ec6bf46f0da1e9cdf9d4d0d458f16d583073a32ab113d6f55aff9854c28ed5de76cc5c2953399dd211e7373865e01
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * @summary FixedColumns
3
3
  * @description Freeze columns in place on a scrolling DataTable
4
- * @file FixedColumns.js
5
- * @version 2.0.4.dev
4
+ * @file dataTables.fixedColumns.js
5
+ * @version 2.5.0.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
9
9
  *
10
- * @copyright Copyright 2010-2011 Allan Jardine, all rights reserved.
10
+ * @copyright Copyright 2010-2013 Allan Jardine, all rights reserved.
11
11
  *
12
12
  * This source file is free software, under either the GPL v2 license or a
13
13
  * BSD style license, available at:
@@ -16,103 +16,103 @@
16
16
  */
17
17
 
18
18
 
19
- /* Global scope for FixedColumns */
19
+ /* Global scope for FixedColumns - legacy and undocumented. Please use
20
+ * $.fn.dataTable.FixedColumns
21
+ */
20
22
  var FixedColumns;
21
23
 
22
- (function($, window, document) {
24
+ (function(window, document, $, undefined) {
23
25
 
24
26
 
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
27
+ /**
28
+ * When making use of DataTables' x-axis scrolling feature, you may wish to
29
+ * fix the left most column in place. This plug-in for DataTables provides
30
+ * exactly this option (note for non-scrolling tables, please use the
31
+ * FixedHeader plug-in, which can fix headers, footers and columns). Key
30
32
  * features include:
31
- * <ul class="limit_length">
32
- * <li>Freezes the left or right most columns to the side of the table</li>
33
- * <li>Option to freeze two or more columns</li>
34
- * <li>Full integration with DataTables' scrolling options</li>
35
- * <li>Speed - FixedColumns is fast in its operation</li>
36
- * </ul>
33
+ *
34
+ * * Freezes the left or right most columns to the side of the table
35
+ * * Option to freeze two or more columns
36
+ * * Full integration with DataTables' scrolling options
37
+ * * Speed - FixedColumns is fast in its operation
37
38
  *
38
39
  * @class
39
40
  * @constructor
40
- * @param {object} oDT DataTables instance
41
- * @param {object} [oInit={}] Configuration object for FixedColumns. Options are defined by {@link FixedColumns.defaults}
42
- *
43
- * @requires jQuery 1.3+
41
+ * @param {object} dt DataTables instance
42
+ * @param {object} [init={}] Configuration object for FixedColumns. Options are defined by {@link FixedColumns.defaults}
43
+ *
44
+ * @requires jQuery 1.7+
44
45
  * @requires DataTables 1.8.0+
45
- *
46
+ *
46
47
  * @example
47
- * var oTable = $('#example').dataTable( {
48
- * "sScrollX": "100%"
49
- * } );
50
- * new FixedColumns( oTable );
48
+ * var table = $('#example').dataTable( {
49
+ * "scrollX": "100%"
50
+ * } );
51
+ * new $.fn.dataTable.fixedColumns( table );
51
52
  */
52
- FixedColumns = function ( oDT, oInit ) {
53
+ FixedColumns = function ( dt, init ) {
54
+ var that = this;
55
+
53
56
  /* Sanity check - you just know it will happen */
54
57
  if ( ! this instanceof FixedColumns )
55
58
  {
56
59
  alert( "FixedColumns warning: FixedColumns must be initialised with the 'new' keyword." );
57
60
  return;
58
61
  }
59
-
60
- if ( typeof oInit == 'undefined' )
62
+
63
+ if ( typeof init == 'undefined' )
61
64
  {
62
- oInit = {};
65
+ init = {};
66
+ }
67
+
68
+ // Use the DataTables Hungarian notation mapping method, if it exists to
69
+ // provide forwards compatibility for camel case variables
70
+ if ( dt.oApi._fnCamelToHungarian ) {
71
+ dt.oApi._fnCamelToHungarian( FixedColumns.defaults, init );
63
72
  }
64
-
73
+
65
74
  /**
66
75
  * Settings object which contains customisable information for FixedColumns instance
67
76
  * @namespace
68
77
  * @extends FixedColumns.defaults
69
78
  */
70
79
  this.s = {
71
- /**
80
+ /**
72
81
  * DataTables settings objects
73
82
  * @type object
74
83
  * @default Obtained from DataTables instance
75
84
  */
76
- "dt": oDT.fnSettings(),
77
-
78
- /**
85
+ "dt": dt.fnSettings(),
86
+
87
+ /**
79
88
  * Number of columns in the DataTable - stored for quick access
80
89
  * @type int
81
90
  * @default Obtained from DataTables instance
82
91
  */
83
- "iTableColumns": oDT.fnSettings().aoColumns.length,
84
-
85
- /**
92
+ "iTableColumns": dt.fnSettings().aoColumns.length,
93
+
94
+ /**
86
95
  * Original outer widths of the columns as rendered by DataTables - used to calculate
87
96
  * the FixedColumns grid bounding box
88
97
  * @type array.<int>
89
98
  * @default []
90
99
  */
91
100
  "aiOuterWidths": [],
92
-
93
- /**
101
+
102
+ /**
94
103
  * Original inner widths of the columns as rendered by DataTables - used to apply widths
95
104
  * to the columns
96
105
  * @type array.<int>
97
106
  * @default []
98
107
  */
99
- "aiInnerWidths": [],
100
-
101
- /**
102
- * Flag to indicate if we are dealing with IE6/7 as these browsers need a little hack
103
- * in the odd place
104
- * @type boolean
105
- * @default Automatically calculated
106
- * @readonly
107
- */
108
- "bOldIE": ($.browser.msie && ($.browser.version == "6.0" || $.browser.version == "7.0"))
108
+ "aiInnerWidths": []
109
109
  };
110
-
111
-
110
+
111
+
112
112
  /**
113
113
  * DOM elements used by the class instance
114
114
  * @namespace
115
- *
115
+ *
116
116
  */
117
117
  this.dom = {
118
118
  /**
@@ -121,21 +121,21 @@ FixedColumns = function ( oDT, oInit ) {
121
121
  * @default null
122
122
  */
123
123
  "scroller": null,
124
-
124
+
125
125
  /**
126
126
  * DataTables header table
127
127
  * @type node
128
128
  * @default null
129
129
  */
130
130
  "header": null,
131
-
131
+
132
132
  /**
133
133
  * DataTables body table
134
134
  * @type node
135
135
  * @default null
136
136
  */
137
137
  "body": null,
138
-
138
+
139
139
  /**
140
140
  * DataTables footer table
141
141
  * @type node
@@ -186,7 +186,7 @@ FixedColumns = function ( oDT, oInit ) {
186
186
  "foot": null
187
187
  }
188
188
  },
189
-
189
+
190
190
  /**
191
191
  * Cloned table nodes
192
192
  * @namespace
@@ -203,14 +203,14 @@ FixedColumns = function ( oDT, oInit ) {
203
203
  * @default null
204
204
  */
205
205
  "header": null,
206
-
206
+
207
207
  /**
208
208
  * Cloned body table
209
209
  * @type node
210
210
  * @default null
211
211
  */
212
212
  "body": null,
213
-
213
+
214
214
  /**
215
215
  * Cloned footer table
216
216
  * @type node
@@ -218,7 +218,7 @@ FixedColumns = function ( oDT, oInit ) {
218
218
  */
219
219
  "footer": null
220
220
  },
221
-
221
+
222
222
  /**
223
223
  * Right column cloned table nodes
224
224
  * @namespace
@@ -230,14 +230,14 @@ FixedColumns = function ( oDT, oInit ) {
230
230
  * @default null
231
231
  */
232
232
  "header": null,
233
-
233
+
234
234
  /**
235
235
  * Cloned body table
236
236
  * @type node
237
237
  * @default null
238
238
  */
239
239
  "body": null,
240
-
240
+
241
241
  /**
242
242
  * Cloned footer table
243
243
  * @type node
@@ -250,9 +250,18 @@ FixedColumns = function ( oDT, oInit ) {
250
250
 
251
251
  /* Attach the instance to the DataTables instance so it can be accessed easily */
252
252
  this.s.dt.oFixedColumns = this;
253
-
253
+
254
254
  /* Let's do it */
255
- this._fnConstruct( oInit );
255
+ if ( ! this.s.dt._bInitComplete )
256
+ {
257
+ this.s.dt.oApi._fnCallbackReg( this.s.dt, 'aoInitComplete', function () {
258
+ that._fnConstruct( init );
259
+ }, 'FixedColumns' );
260
+ }
261
+ else
262
+ {
263
+ this._fnConstruct( init );
264
+ }
256
265
  };
257
266
 
258
267
 
@@ -261,47 +270,49 @@ FixedColumns.prototype = {
261
270
  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
262
271
  * Public methods
263
272
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
264
-
273
+
265
274
  /**
266
275
  * Update the fixed columns - including headers and footers. Note that FixedColumns will
267
276
  * automatically update the display whenever the host DataTable redraws.
268
277
  * @returns {void}
269
278
  * @example
270
- * var oTable = $('#example').dataTable( {
271
- * "sScrollX": "100%"
272
- * } );
273
- * var oFC = new FixedColumns( oTable );
274
- *
275
- * // at some later point when the table has been manipulated....
276
- * oFC.fnUpdate();
279
+ * var table = $('#example').dataTable( {
280
+ * "scrollX": "100%"
281
+ * } );
282
+ * var fc = new $.fn.dataTable.fixedColumns( table );
283
+ *
284
+ * // at some later point when the table has been manipulated....
285
+ * fc.fnUpdate();
277
286
  */
278
287
  "fnUpdate": function ()
279
288
  {
280
289
  this._fnDraw( true );
281
290
  },
282
-
283
-
291
+
292
+
284
293
  /**
285
294
  * Recalculate the resizes of the 3x3 grid that FixedColumns uses for display of the table.
286
295
  * This is useful if you update the width of the table container. Note that FixedColumns will
287
296
  * perform this function automatically when the window.resize event is fired.
288
297
  * @returns {void}
289
298
  * @example
290
- * var oTable = $('#example').dataTable( {
291
- * "sScrollX": "100%"
292
- * } );
293
- * var oFC = new FixedColumns( oTable );
294
- *
295
- * // Resize the table container and then have FixedColumns adjust its layout....
299
+ * var table = $('#example').dataTable( {
300
+ * "scrollX": "100%"
301
+ * } );
302
+ * var fc = new $.fn.dataTable.fixedColumns( table );
303
+ *
304
+ * // Resize the table container and then have FixedColumns adjust its layout....
296
305
  * $('#content').width( 1200 );
297
- * oFC.fnRedrawLayout();
306
+ * fc.fnRedrawLayout();
298
307
  */
299
308
  "fnRedrawLayout": function ()
300
309
  {
310
+ this._fnColCalc();
301
311
  this._fnGridLayout();
312
+ this.fnUpdate();
302
313
  },
303
-
304
-
314
+
315
+
305
316
  /**
306
317
  * Mark a row such that it's height should be recalculated when using 'semiauto' row
307
318
  * height matching. This function will have no effect when 'none' or 'auto' row height
@@ -309,60 +320,95 @@ FixedColumns.prototype = {
309
320
  * @param {Node} nTr TR element that should have it's height recalculated
310
321
  * @returns {void}
311
322
  * @example
312
- * var oTable = $('#example').dataTable( {
313
- * "sScrollX": "100%"
314
- * } );
315
- * var oFC = new FixedColumns( oTable );
316
- *
317
- * // manipulate the table - mark the row as needing an update then update the table
318
- * // this allows the redraw performed by DataTables fnUpdate to recalculate the row
319
- * // height
320
- * oFC.fnRecalculateHeight();
321
- * oTable.fnUpdate( $('#example tbody tr:eq(0)')[0], ["insert date", 1, 2, 3 ... ]);
323
+ * var table = $('#example').dataTable( {
324
+ * "scrollX": "100%"
325
+ * } );
326
+ * var fc = new $.fn.dataTable.fixedColumns( table );
327
+ *
328
+ * // manipulate the table - mark the row as needing an update then update the table
329
+ * // this allows the redraw performed by DataTables fnUpdate to recalculate the row
330
+ * // height
331
+ * fc.fnRecalculateHeight();
332
+ * table.fnUpdate( $('#example tbody tr:eq(0)')[0], ["insert date", 1, 2, 3 ... ]);
322
333
  */
323
334
  "fnRecalculateHeight": function ( nTr )
324
335
  {
325
- nTr._DTTC_iHeight = null;
336
+ delete nTr._DTTC_iHeight;
326
337
  nTr.style.height = 'auto';
327
338
  },
328
-
329
-
339
+
340
+
330
341
  /**
331
342
  * Set the height of a given row - provides cross browser compatibility
332
343
  * @param {Node} nTarget TR element that should have it's height recalculated
333
344
  * @param {int} iHeight Height in pixels to set
334
345
  * @returns {void}
335
346
  * @example
336
- * var oTable = $('#example').dataTable( {
337
- * "sScrollX": "100%"
338
- * } );
339
- * var oFC = new FixedColumns( oTable );
340
- *
341
- * // You may want to do this after manipulating a row in the fixed column
342
- * oFC.fnSetRowHeight( $('#example tbody tr:eq(0)')[0], 50 );
347
+ * var table = $('#example').dataTable( {
348
+ * "scrollX": "100%"
349
+ * } );
350
+ * var fc = new $.fn.dataTable.fixedColumns( table );
351
+ *
352
+ * // You may want to do this after manipulating a row in the fixed column
353
+ * fc.fnSetRowHeight( $('#example tbody tr:eq(0)')[0], 50 );
343
354
  */
344
355
  "fnSetRowHeight": function ( nTarget, iHeight )
345
356
  {
346
- var jqBoxHack = $(nTarget).children(':first');
347
- var iBoxHack = jqBoxHack.outerHeight() - jqBoxHack.height();
357
+ nTarget.style.height = iHeight+"px";
358
+ },
359
+
360
+
361
+ /**
362
+ * Get data index information about a row or cell in the table body.
363
+ * This function is functionally identical to fnGetPosition in DataTables,
364
+ * taking the same parameter (TH, TD or TR node) and returning exactly the
365
+ * the same information (data index information). THe difference between
366
+ * the two is that this method takes into account the fixed columns in the
367
+ * table, so you can pass in nodes from the master table, or the cloned
368
+ * tables and get the index position for the data in the main table.
369
+ * @param {node} node TR, TH or TD element to get the information about
370
+ * @returns {int} If nNode is given as a TR, then a single index is
371
+ * returned, or if given as a cell, an array of [row index, column index
372
+ * (visible), column index (all)] is given.
373
+ */
374
+ "fnGetPosition": function ( node )
375
+ {
376
+ var idx;
377
+ var inst = this.s.dt.oInstance;
348
378
 
349
- /* Can we use some kind of object detection here?! This is very nasty - damn browsers */
350
- if ( $.browser.mozilla || $.browser.opera )
379
+ if ( ! $(node).parents('.DTFC_Cloned').length )
351
380
  {
352
- nTarget.style.height = iHeight+"px";
381
+ // Not in a cloned table
382
+ return inst.fnGetPosition( node );
353
383
  }
354
384
  else
355
385
  {
356
- $(nTarget).children().height( iHeight-iBoxHack );
386
+ // Its in the cloned table, so need to look up position
387
+ if ( node.nodeName.toLowerCase() === 'tr' ) {
388
+ idx = $(node).index();
389
+ return inst.fnGetPosition( $('tr', this.s.dt.nTBody)[ idx ] );;
390
+ }
391
+ else
392
+ {
393
+ var colIdx = $(node).index();
394
+ var idx = $(node.parentNode).index();
395
+ var row = inst.fnGetPosition( $('tr', this.s.dt.nTBody)[ idx ] );
396
+
397
+ return [
398
+ row,
399
+ colIdx,
400
+ inst.oApi._fnVisibleToColumnIndex( this.s.dt, colIdx )
401
+ ];
402
+ }
357
403
  }
358
404
  },
359
-
360
-
361
-
405
+
406
+
407
+
362
408
  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
363
409
  * Private methods (they are of course public in JS, but recommended as private)
364
410
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
365
-
411
+
366
412
  /**
367
413
  * Initialisation for FixedColumns
368
414
  * @param {Object} oInit User settings for initialisation
@@ -373,7 +419,7 @@ FixedColumns.prototype = {
373
419
  {
374
420
  var i, iLen, iWidth,
375
421
  that = this;
376
-
422
+
377
423
  /* Sanity checking */
378
424
  if ( typeof this.s.dt.oInstance.fnVersionCheck != 'function' ||
379
425
  this.s.dt.oInstance.fnVersionCheck( '1.8.0' ) !== true )
@@ -382,7 +428,7 @@ FixedColumns.prototype = {
382
428
  "Please upgrade your DataTables installation" );
383
429
  return;
384
430
  }
385
-
431
+
386
432
  if ( this.s.dt.oScroll.sX === "" )
387
433
  {
388
434
  this.s.dt.oInstance.oApi._fnLog( this.s.dt, 1, "FixedColumns is not needed (no "+
@@ -390,7 +436,7 @@ FixedColumns.prototype = {
390
436
  "column fixing when scrolling is not enabled" );
391
437
  return;
392
438
  }
393
-
439
+
394
440
  /* Apply the settings from the user / defaults */
395
441
  this.s = $.extend( true, this.s, FixedColumns.defaults, oInit );
396
442
 
@@ -398,85 +444,142 @@ FixedColumns.prototype = {
398
444
  this.dom.grid.dt = $(this.s.dt.nTable).parents('div.dataTables_scroll')[0];
399
445
  this.dom.scroller = $('div.dataTables_scrollBody', this.dom.grid.dt )[0];
400
446
 
401
- var iScrollWidth = $(this.dom.grid.dt).width();
402
- var iLeftWidth = 0;
403
- var iRightWidth = 0;
447
+ /* Set up the DOM that we want for the fixed column layout grid */
448
+ this._fnColCalc();
449
+ this._fnGridSetup();
404
450
 
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
410
- iWidth = $(this).outerWidth();
411
- that.s.aiOuterWidths.push( iWidth );
451
+ /* Event handlers */
412
452
 
413
- if ( i < that.s.iLeftColumns )
453
+ // When the body is scrolled - scroll the left and right columns
454
+ $(this.dom.scroller).on( 'scroll.DTFC', function () {
455
+ if ( that.s.iLeftColumns > 0 )
414
456
  {
415
- iLeftWidth += iWidth;
457
+ that.dom.grid.left.liner.scrollTop = that.dom.scroller.scrollTop;
416
458
  }
417
- if ( that.s.iTableColumns-that.s.iRightColumns <= i )
459
+ if ( that.s.iRightColumns > 0 )
418
460
  {
419
- iRightWidth += iWidth;
461
+ that.dom.grid.right.liner.scrollTop = that.dom.scroller.scrollTop;
420
462
  }
421
463
  } );
422
464
 
423
- if ( this.s.iLeftWidth === null )
465
+ if ( that.s.iLeftColumns > 0 )
424
466
  {
425
- this.s.iLeftWidth = this.s.sLeftWidth == 'fixed' ?
426
- iLeftWidth : (iLeftWidth/iScrollWidth) * 100;
427
- }
467
+ // When scrolling the left column, scroll the body and right column
468
+ $(that.dom.grid.left.liner).on( 'scroll.DTFC', function () {
469
+ that.dom.scroller.scrollTop = that.dom.grid.left.liner.scrollTop;
470
+ if ( that.s.iRightColumns > 0 )
471
+ {
472
+ that.dom.grid.right.liner.scrollTop = that.dom.grid.left.liner.scrollTop;
473
+ }
474
+ } );
428
475
 
429
- if ( this.s.iRightWidth === null )
430
- {
431
- this.s.iRightWidth = this.s.sRightWidth == 'fixed' ?
432
- iRightWidth : (iRightWidth/iScrollWidth) * 100;
476
+ // When x-scrolling in the fixed column(s) we need to pass that information on
477
+ // to the table's body, since otherwise we just swallow that information
478
+ // TODO - This is far from perfect - how can be be improved?
479
+ $(that.dom.grid.left.liner).on( "mousewheel.DTFC", function(e) {
480
+ var xDelta = e.originalEvent.wheelDeltaX / 3;
481
+ that.dom.scroller.scrollLeft -= xDelta;
482
+ } );
433
483
  }
434
-
435
- /* Set up the DOM that we want for the fixed column layout grid */
436
- this._fnGridSetup();
437
484
 
438
- /* Use the DataTables API method fnSetColumnVis to hide the columns we are going to fix */
439
- for ( i=0 ; i<this.s.iLeftColumns ; i++ )
485
+ if ( that.s.iRightColumns > 0 )
440
486
  {
441
- this.s.dt.oInstance.fnSetColumnVis( i, false );
442
- }
443
- for ( i=this.s.iTableColumns - this.s.iRightColumns ; i<this.s.iTableColumns ; i++ )
444
- {
445
- this.s.dt.oInstance.fnSetColumnVis( i, false );
446
- }
487
+ // When scrolling the right column, scroll the body and the left column
488
+ $(that.dom.grid.right.liner).on( 'scroll.DTFC', function () {
489
+ that.dom.scroller.scrollTop = that.dom.grid.right.liner.scrollTop;
490
+ if ( that.s.iLeftColumns > 0 )
491
+ {
492
+ that.dom.grid.left.liner.scrollTop = that.dom.grid.right.liner.scrollTop;
493
+ }
494
+ } );
447
495
 
448
- /* Event handlers */
449
- $(this.dom.scroller).scroll( function () {
450
- that.dom.grid.left.body.scrollTop = that.dom.scroller.scrollTop;
451
- if ( that.s.iRightColumns > 0 )
452
- {
453
- that.dom.grid.right.body.scrollTop = that.dom.scroller.scrollTop;
454
- }
455
- } );
496
+ // Adjust the body for x-scrolling
497
+ $(that.dom.grid.right.liner).on( "mousewheel.DTFC", function(e) {
498
+ var xDelta = e.originalEvent.wheelDeltaX / 3;
499
+ that.dom.scroller.scrollLeft -= xDelta;
500
+ } );
501
+ }
456
502
 
457
503
  $(window).resize( function () {
458
504
  that._fnGridLayout.call( that );
459
505
  } );
460
-
506
+
461
507
  var bFirstDraw = true;
462
508
  this.s.dt.aoDrawCallback = [ {
463
509
  "fn": function () {
464
510
  that._fnDraw.call( that, bFirstDraw );
465
- that._fnGridHeight( that );
466
511
  bFirstDraw = false;
467
512
  },
468
513
  "sName": "FixedColumns"
469
514
  } ].concat( this.s.dt.aoDrawCallback );
470
-
515
+
516
+ $(this.s.dt.nTable).on( 'column-sizing', function () {
517
+ that._fnColCalc();
518
+ that._fnGridLayout( that );
519
+ } );
520
+
471
521
  /* Get things right to start with - note that due to adjusting the columns, there must be
472
522
  * another redraw of the main table. It doesn't need to be a full redraw however.
473
523
  */
474
524
  this._fnGridLayout();
475
- this._fnGridHeight();
476
525
  this.s.dt.oInstance.fnDraw(false);
477
526
  },
478
-
479
-
527
+
528
+
529
+ /**
530
+ * Calculate the column widths for the grid layout
531
+ * @returns {void}
532
+ * @private
533
+ */
534
+ "_fnColCalc": function ()
535
+ {
536
+ var that = this;
537
+ var iLeftWidth = 0;
538
+ var iRightWidth = 0;
539
+
540
+ this.s.aiInnerWidths = [];
541
+ this.s.aiOuterWidths = [];
542
+
543
+ $.each( this.s.dt.aoColumns, function (i, col) {
544
+ var th = $(col.nTh);
545
+
546
+ if ( ! th.filter(':visible').length ) {
547
+ that.s.aiInnerWidths.push( 0 );
548
+ that.s.aiOuterWidths.push( 0 );
549
+ }
550
+ else
551
+ {
552
+ // Inner width is used to assign widths to cells
553
+ // Outer width is used to calculate the container
554
+ var iWidth = th.outerWidth();
555
+
556
+ // When working with the left most-cell, need to add on the
557
+ // table's border to the outerWidth, since we need to take
558
+ // account of it, but it isn't in any cell
559
+ if ( that.s.aiOuterWidths.length === 0 ) {
560
+ iWidth += parseInt( $(that.s.dt.nTable).css('border-left-width'), 10 );
561
+ }
562
+
563
+ that.s.aiOuterWidths.push( iWidth );
564
+ that.s.aiInnerWidths.push( th.width() );
565
+
566
+ if ( i < that.s.iLeftColumns )
567
+ {
568
+ iLeftWidth += iWidth;
569
+ }
570
+
571
+ if ( that.s.iTableColumns-that.s.iRightColumns <= i )
572
+ {
573
+ iRightWidth += iWidth;
574
+ }
575
+ }
576
+ } );
577
+
578
+ this.s.iLeftWidth = iLeftWidth;
579
+ this.s.iRightWidth = iRightWidth;
580
+ },
581
+
582
+
480
583
  /**
481
584
  * Set up the DOM for the fixed column. The way the layout works is to create a 1x3 grid
482
585
  * for the left column, the DataTable (for which we just reuse the scrolling element DataTable
@@ -489,128 +592,181 @@ FixedColumns.prototype = {
489
592
  "_fnGridSetup": function ()
490
593
  {
491
594
  var that = this;
595
+ var oOverflow = this._fnDTOverflow();
596
+ var block;
492
597
 
493
598
  this.dom.body = this.s.dt.nTable;
494
599
  this.dom.header = this.s.dt.nTHead.parentNode;
495
600
  this.dom.header.parentNode.parentNode.style.position = "relative";
496
-
497
- var nSWrapper =
601
+
602
+ var nSWrapper =
498
603
  $('<div class="DTFC_ScrollWrapper" style="position:relative; clear:both;">'+
499
604
  '<div class="DTFC_LeftWrapper" style="position:absolute; top:0; left:0;">'+
500
605
  '<div class="DTFC_LeftHeadWrapper" style="position:relative; top:0; left:0; overflow:hidden;"></div>'+
501
- '<div class="DTFC_LeftBodyWrapper" style="position:relative; top:0; left:0; overflow:hidden;"></div>'+
606
+ '<div class="DTFC_LeftBodyWrapper" style="position:relative; top:0; left:0; overflow:hidden;">'+
607
+ '<div class="DTFC_LeftBodyLiner" style="position:relative; top:0; left:0; overflow-y:scroll;"></div>'+
608
+ '</div>'+
502
609
  '<div class="DTFC_LeftFootWrapper" style="position:relative; top:0; left:0; overflow:hidden;"></div>'+
503
- '</div>'+
610
+ '</div>'+
504
611
  '<div class="DTFC_RightWrapper" style="position:absolute; top:0; left:0;">'+
505
- '<div class="DTFC_RightHeadWrapper" style="position:relative; top:0; left:0; overflow:hidden;"></div>'+
506
- '<div class="DTFC_RightBodyWrapper" style="position:relative; top:0; left:0; overflow:hidden;"></div>'+
507
- '<div class="DTFC_RightFootWrapper" style="position:relative; top:0; left:0; overflow:hidden;"></div>'+
508
- '</div>'+
509
- '</div>')[0];
510
- nLeft = nSWrapper.childNodes[0];
511
- nRight = nSWrapper.childNodes[1];
612
+ '<div class="DTFC_RightHeadWrapper" style="position:relative; top:0; left:0;">'+
613
+ '<div class="DTFC_RightHeadBlocker DTFC_Blocker" style="position:absolute; top:0; bottom:0;"></div>'+
614
+ '</div>'+
615
+ '<div class="DTFC_RightBodyWrapper" style="position:relative; top:0; left:0; overflow:hidden;">'+
616
+ '<div class="DTFC_RightBodyLiner" style="position:relative; top:0; left:0; overflow-y:scroll;"></div>'+
617
+ '</div>'+
618
+ '<div class="DTFC_RightFootWrapper" style="position:relative; top:0; left:0;">'+
619
+ '<div class="DTFC_RightFootBlocker DTFC_Blocker" style="position:absolute; top:0; bottom:0;"></div>'+
620
+ '</div>'+
621
+ '</div>'+
622
+ '</div>')[0];
623
+ var nLeft = nSWrapper.childNodes[0];
624
+ var nRight = nSWrapper.childNodes[1];
625
+
626
+ this.dom.grid.dt.parentNode.insertBefore( nSWrapper, this.dom.grid.dt );
627
+ nSWrapper.appendChild( this.dom.grid.dt );
512
628
 
513
629
  this.dom.grid.wrapper = nSWrapper;
514
- this.dom.grid.left.wrapper = nLeft;
515
- this.dom.grid.left.head = nLeft.childNodes[0];
516
- this.dom.grid.left.body = nLeft.childNodes[1];
630
+
631
+ if ( this.s.iLeftColumns > 0 )
632
+ {
633
+ this.dom.grid.left.wrapper = nLeft;
634
+ this.dom.grid.left.head = nLeft.childNodes[0];
635
+ this.dom.grid.left.body = nLeft.childNodes[1];
636
+ this.dom.grid.left.liner = $('div.DTFC_LeftBodyLiner', nSWrapper)[0];
637
+
638
+ nSWrapper.appendChild( nLeft );
639
+ }
517
640
 
518
641
  if ( this.s.iRightColumns > 0 )
519
642
  {
520
643
  this.dom.grid.right.wrapper = nRight;
521
644
  this.dom.grid.right.head = nRight.childNodes[0];
522
645
  this.dom.grid.right.body = nRight.childNodes[1];
646
+ this.dom.grid.right.liner = $('div.DTFC_RightBodyLiner', nSWrapper)[0];
647
+
648
+ block = $('div.DTFC_RightHeadBlocker', nSWrapper)[0];
649
+ block.style.width = oOverflow.bar+"px";
650
+ block.style.right = -oOverflow.bar+"px";
651
+ this.dom.grid.right.headBlock = block;
652
+
653
+ block = $('div.DTFC_RightFootBlocker', nSWrapper)[0];
654
+ block.style.width = oOverflow.bar+"px";
655
+ block.style.right = -oOverflow.bar+"px";
656
+ this.dom.grid.right.footBlock = block;
657
+
658
+ nSWrapper.appendChild( nRight );
523
659
  }
524
-
660
+
525
661
  if ( this.s.dt.nTFoot )
526
662
  {
527
663
  this.dom.footer = this.s.dt.nTFoot.parentNode;
528
- this.dom.grid.left.foot = nLeft.childNodes[2];
664
+ if ( this.s.iLeftColumns > 0 )
665
+ {
666
+ this.dom.grid.left.foot = nLeft.childNodes[2];
667
+ }
529
668
  if ( this.s.iRightColumns > 0 )
530
669
  {
531
670
  this.dom.grid.right.foot = nRight.childNodes[2];
532
671
  }
533
672
  }
673
+ },
534
674
 
535
- nSWrapper.appendChild( nLeft );
536
- this.dom.grid.dt.parentNode.insertBefore( nSWrapper, this.dom.grid.dt );
537
- nSWrapper.appendChild( this.dom.grid.dt );
538
675
 
539
- this.dom.grid.dt.style.position = "absolute";
540
- this.dom.grid.dt.style.top = "0px";
541
- this.dom.grid.dt.style.left = this.s.iLeftWidth+"px";
542
- this.dom.grid.dt.style.width = ($(this.dom.grid.dt).width()-this.s.iLeftWidth-this.s.iRightWidth)+"px";
543
- },
544
-
545
-
546
676
  /**
547
- * Style and position the grid used for the FixedColumns layout based on the instance settings.
548
- * Specifically sLeftWidth ('fixed' or 'absolute'), iLeftWidth (px if fixed, % if absolute) and
549
- * there 'right' counterparts.
677
+ * Style and position the grid used for the FixedColumns layout
550
678
  * @returns {void}
551
679
  * @private
552
680
  */
553
681
  "_fnGridLayout": function ()
554
682
  {
555
683
  var oGrid = this.dom.grid;
556
- var iTotal = $(oGrid.wrapper).width();
557
- var iLeft = 0, iRight = 0, iRemainder = 0;
558
-
559
- if ( this.s.sLeftWidth == 'fixed' )
560
- {
561
- iLeft = this.s.iLeftWidth;
562
- }
563
- else
684
+ var iWidth = $(oGrid.wrapper).width();
685
+ var iBodyHeight = $(this.s.dt.nTable.parentNode).height();
686
+ var iFullHeight = $(this.s.dt.nTable.parentNode.parentNode).height();
687
+ var oOverflow = this._fnDTOverflow();
688
+ var
689
+ iLeftWidth = this.s.iLeftWidth,
690
+ iRightWidth = this.s.iRightWidth,
691
+ iRight;
692
+
693
+ // When x scrolling - don't paint the fixed columns over the x scrollbar
694
+ if ( oOverflow.x )
564
695
  {
565
- iLeft = ( this.s.iLeftWidth / 100 ) * iTotal;
696
+ iBodyHeight -= oOverflow.bar;
566
697
  }
567
698
 
568
- if ( this.s.sRightWidth == 'fixed' )
699
+ oGrid.wrapper.style.height = iFullHeight+"px";
700
+
701
+ if ( this.s.iLeftColumns > 0 )
569
702
  {
570
- iRight = this.s.iRightWidth;
703
+ oGrid.left.wrapper.style.width = iLeftWidth+"px";
704
+ oGrid.left.wrapper.style.height = "1px";
705
+ oGrid.left.body.style.height = iBodyHeight+"px";
706
+ if ( oGrid.left.foot ) {
707
+ oGrid.left.foot.style.top = (oOverflow.x ? oOverflow.bar : 0)+"px"; // shift footer for scrollbar
708
+ }
709
+
710
+ oGrid.left.liner.style.width = (iLeftWidth+oOverflow.bar)+"px";
711
+ oGrid.left.liner.style.height = iBodyHeight+"px";
571
712
  }
572
- else
713
+
714
+ if ( this.s.iRightColumns > 0 )
573
715
  {
574
- iRight = ( this.s.iRightWidth / 100 ) * iTotal;
575
- }
716
+ iRight = iWidth - iRightWidth;
717
+ if ( oOverflow.y )
718
+ {
719
+ iRight -= oOverflow.bar;
720
+ }
576
721
 
577
- iRemainder = iTotal - iLeft - iRight;
722
+ oGrid.right.wrapper.style.width = iRightWidth+"px";
723
+ oGrid.right.wrapper.style.left = iRight+"px";
724
+ oGrid.right.wrapper.style.height = "1px";
725
+ oGrid.right.body.style.height = iBodyHeight+"px";
726
+ if ( oGrid.right.foot ) {
727
+ oGrid.right.foot.style.top = (oOverflow.x ? oOverflow.bar : 0)+"px";
728
+ }
578
729
 
579
- oGrid.left.wrapper.style.width = iLeft+"px";
580
- oGrid.dt.style.width = iRemainder+"px";
581
- oGrid.dt.style.left = iLeft+"px";
730
+ oGrid.right.liner.style.width = (iRightWidth+oOverflow.bar)+"px";
731
+ oGrid.right.liner.style.height = iBodyHeight+"px";
582
732
 
583
- if ( this.s.iRightColumns > 0 )
584
- {
585
- oGrid.right.wrapper.style.width = iRight+"px";
586
- oGrid.right.wrapper.style.left = (iTotal-iRight)+"px";
733
+ oGrid.right.headBlock.style.display = oOverflow.y ? 'block' : 'none';
734
+ oGrid.right.footBlock.style.display = oOverflow.y ? 'block' : 'none';
587
735
  }
588
736
  },
589
-
590
-
737
+
738
+
591
739
  /**
592
- * Recalculate and set the height of the grid components used for positioning of the
593
- * FixedColumn display grid.
594
- * @returns {void}
740
+ * Get information about the DataTable's scrolling state - specifically if the table is scrolling
741
+ * on either the x or y axis, and also the scrollbar width.
742
+ * @returns {object} Information about the DataTables scrolling state with the properties:
743
+ * 'x', 'y' and 'bar'
595
744
  * @private
596
745
  */
597
- "_fnGridHeight": function ()
746
+ "_fnDTOverflow": function ()
598
747
  {
599
- var oGrid = this.dom.grid;
600
- var iHeight = $(this.dom.grid.dt).height();
748
+ var nTable = this.s.dt.nTable;
749
+ var nTableScrollBody = nTable.parentNode;
750
+ var out = {
751
+ "x": false,
752
+ "y": false,
753
+ "bar": this.s.dt.oScroll.iBarWidth
754
+ };
755
+
756
+ if ( nTable.offsetWidth > nTableScrollBody.clientWidth )
757
+ {
758
+ out.x = true;
759
+ }
601
760
 
602
- oGrid.wrapper.style.height = iHeight+"px";
603
- oGrid.left.body.style.height = $(this.dom.scroller).height()+"px";
604
- oGrid.left.wrapper.style.height = iHeight+"px";
605
-
606
- if ( this.s.iRightColumns > 0 )
761
+ if ( nTable.offsetHeight > nTableScrollBody.clientHeight )
607
762
  {
608
- oGrid.right.wrapper.style.height = iHeight+"px";
609
- oGrid.right.body.style.height = $(this.dom.scroller).height()+"px";
763
+ out.y = true;
610
764
  }
765
+
766
+ return out;
611
767
  },
612
-
613
-
768
+
769
+
614
770
  /**
615
771
  * Clone and position the fixed columns
616
772
  * @returns {void}
@@ -629,13 +785,13 @@ FixedColumns.prototype = {
629
785
  }
630
786
 
631
787
  /* Event triggering */
632
- $(this).trigger( 'draw', {
788
+ $(this).trigger( 'draw', {
633
789
  "leftClone": this.dom.clone.left,
634
790
  "rightClone": this.dom.clone.right
635
791
  } );
636
792
  },
637
-
638
-
793
+
794
+
639
795
  /**
640
796
  * Clone the right columns
641
797
  * @returns {void}
@@ -648,7 +804,7 @@ FixedColumns.prototype = {
648
804
  {
649
805
  return;
650
806
  }
651
-
807
+
652
808
  var that = this,
653
809
  i, jq,
654
810
  aiColumns = [];
@@ -660,8 +816,8 @@ FixedColumns.prototype = {
660
816
 
661
817
  this._fnClone( this.dom.clone.right, this.dom.grid.right, aiColumns, bAll );
662
818
  },
663
-
664
-
819
+
820
+
665
821
  /**
666
822
  * Clone the left columns
667
823
  * @returns {void}
@@ -674,11 +830,11 @@ FixedColumns.prototype = {
674
830
  {
675
831
  return;
676
832
  }
677
-
833
+
678
834
  var that = this,
679
835
  i, jq,
680
836
  aiColumns = [];
681
-
837
+
682
838
  for ( i=0 ; i<this.s.iLeftColumns ; i++ )
683
839
  {
684
840
  aiColumns.push( i );
@@ -686,8 +842,8 @@ FixedColumns.prototype = {
686
842
 
687
843
  this._fnClone( this.dom.clone.left, this.dom.grid.left, aiColumns, bAll );
688
844
  },
689
-
690
-
845
+
846
+
691
847
  /**
692
848
  * Make a copy of the layout object for a header or footer element from DataTables. Note that
693
849
  * this method will clone the nodes in the layout object.
@@ -734,19 +890,19 @@ FixedColumns.prototype = {
734
890
  } );
735
891
  }
736
892
  }
737
-
893
+
738
894
  aReturn.push( aRow );
739
895
  }
740
896
 
741
897
  return aReturn;
742
898
  },
743
-
744
-
899
+
900
+
745
901
  /**
746
902
  * Clone the DataTable nodes and place them in the DOM (sized correctly)
747
903
  * @returns {void}
748
904
  * @param {Object} oClone Object containing the header, footer and body cloned DOM elements
749
- * @param {Object} oGrid Grid object containing the display grid elements for the cloned
905
+ * @param {Object} oGrid Grid object containing the display grid elements for the cloned
750
906
  * column (left or right)
751
907
  * @param {Array} aiColumns Column indexes which should be operated on from the DataTable
752
908
  * @param {Boolean} bAll Indicate if the header and footer should be updated as well (true)
@@ -755,9 +911,10 @@ FixedColumns.prototype = {
755
911
  "_fnClone": function ( oClone, oGrid, aiColumns, bAll )
756
912
  {
757
913
  var that = this,
758
- i, iLen, j, jLen, jq, nTarget, iColumn, nClone, iIndex;
914
+ i, iLen, j, jLen, jq, nTarget, iColumn, nClone, iIndex, aoCloneLayout,
915
+ jqCloneThead, aoFixedHeader;
759
916
 
760
- /*
917
+ /*
761
918
  * Header
762
919
  */
763
920
  if ( bAll )
@@ -770,10 +927,10 @@ FixedColumns.prototype = {
770
927
  oClone.header.className += " DTFC_Cloned";
771
928
  oClone.header.style.width = "100%";
772
929
  oGrid.head.appendChild( oClone.header );
773
-
930
+
774
931
  /* Copy the DataTables layout cache for the header for our floating column */
775
- var aoCloneLayout = this._fnCopyLayout( this.s.dt.aoHeader, aiColumns );
776
- var jqCloneThead = $('>thead', oClone.header);
932
+ aoCloneLayout = this._fnCopyLayout( this.s.dt.aoHeader, aiColumns );
933
+ jqCloneThead = $('>thead', oClone.header);
777
934
  jqCloneThead.empty();
778
935
 
779
936
  /* Add the created cloned TR elements to the table */
@@ -790,12 +947,12 @@ FixedColumns.prototype = {
790
947
  else
791
948
  {
792
949
  /* To ensure that we copy cell classes exactly, regardless of colspan, multiple rows
793
- * etc, we make a copy of the header from the DataTable again, but don't insert the
950
+ * etc, we make a copy of the header from the DataTable again, but don't insert the
794
951
  * cloned cells, just copy the classes across. To get the matching layout for the
795
952
  * fixed component, we use the DataTables _fnDetectHeader method, allowing 1:1 mapping
796
953
  */
797
- var aoCloneLayout = this._fnCopyLayout( this.s.dt.aoHeader, aiColumns );
798
- var aoFixedHeader=[];
954
+ aoCloneLayout = this._fnCopyLayout( this.s.dt.aoHeader, aiColumns );
955
+ aoFixedHeader=[];
799
956
 
800
957
  this.s.dt.oApi._fnDetectHeader( aoFixedHeader, $('>thead', oClone.header)[0] );
801
958
 
@@ -813,8 +970,8 @@ FixedColumns.prototype = {
813
970
  }
814
971
  }
815
972
  this._fnEqualiseHeights( 'thead', this.dom.header, oClone.header );
816
-
817
- /*
973
+
974
+ /*
818
975
  * Body
819
976
  */
820
977
  if ( this.s.sHeightMatch == 'auto' )
@@ -822,13 +979,13 @@ FixedColumns.prototype = {
822
979
  /* Remove any heights which have been applied already and let the browser figure it out */
823
980
  $('>tbody>tr', that.dom.body).css('height', 'auto');
824
981
  }
825
-
982
+
826
983
  if ( oClone.body !== null )
827
984
  {
828
985
  oClone.body.parentNode.removeChild( oClone.body );
829
986
  oClone.body = null;
830
987
  }
831
-
988
+
832
989
  oClone.body = $(this.dom.body).clone(true)[0];
833
990
  oClone.body.className += " DTFC_Cloned";
834
991
  oClone.body.style.paddingBottom = this.s.dt.oScroll.iBarWidth+"px";
@@ -837,10 +994,10 @@ FixedColumns.prototype = {
837
994
  {
838
995
  oClone.body.removeAttribute('id');
839
996
  }
840
-
997
+
841
998
  $('>thead>tr', oClone.body).empty();
842
999
  $('>tfoot', oClone.body).remove();
843
-
1000
+
844
1001
  var nBody = $('tbody', oClone.body)[0];
845
1002
  $(nBody).empty();
846
1003
  if ( this.s.dt.aiDisplay.length > 0 )
@@ -857,7 +1014,7 @@ FixedColumns.prototype = {
857
1014
  nClone = $(this.s.dt.aoColumns[iColumn].nTh).clone(true)[0];
858
1015
  nClone.innerHTML = "";
859
1016
 
860
- oStyle = nClone.style;
1017
+ var oStyle = nClone.style;
861
1018
  oStyle.paddingTop = "0";
862
1019
  oStyle.paddingBottom = "0";
863
1020
  oStyle.borderTopWidth = "0";
@@ -875,10 +1032,12 @@ FixedColumns.prototype = {
875
1032
  that.s.dt.aiDisplay[ that.s.dt._iDisplayStart+z ] : z;
876
1033
  for ( iIndex=0 ; iIndex<aiColumns.length ; iIndex++ )
877
1034
  {
1035
+ var aTds = that.s.dt.aoData[i].anCells || that.s.dt.oApi._fnGetTdNodes( that.s.dt, i );
878
1036
  iColumn = aiColumns[iIndex];
879
- if ( typeof that.s.dt.aoData[i]._anHidden[iColumn] != 'undefined' )
1037
+
1038
+ if ( aTds.length > 0 )
880
1039
  {
881
- nClone = $(that.s.dt.aoData[i]._anHidden[iColumn]).clone(true)[0];
1040
+ nClone = $( aTds[iColumn] ).clone(true)[0];
882
1041
  n.appendChild( nClone );
883
1042
  }
884
1043
  }
@@ -894,12 +1053,22 @@ FixedColumns.prototype = {
894
1053
  nBody.appendChild( nClone );
895
1054
  } );
896
1055
  }
897
-
1056
+
898
1057
  oClone.body.style.width = "100%";
899
- oGrid.body.appendChild( oClone.body );
1058
+ oClone.body.style.margin = "0";
1059
+ oClone.body.style.padding = "0";
1060
+
1061
+ if ( bAll )
1062
+ {
1063
+ if ( typeof this.s.dt.oScroller != 'undefined' )
1064
+ {
1065
+ oGrid.liner.appendChild( this.s.dt.oScroller.dom.force.cloneNode(true) );
1066
+ }
1067
+ }
1068
+ oGrid.liner.appendChild( oClone.body );
900
1069
 
901
1070
  this._fnEqualiseHeights( 'tbody', that.dom.body, oClone.body );
902
-
1071
+
903
1072
  /*
904
1073
  * Footer
905
1074
  */
@@ -917,10 +1086,10 @@ FixedColumns.prototype = {
917
1086
  oGrid.foot.appendChild( oClone.footer );
918
1087
 
919
1088
  /* Copy the footer just like we do for the header */
920
- var aoCloneLayout = this._fnCopyLayout( this.s.dt.aoFooter, aiColumns );
1089
+ aoCloneLayout = this._fnCopyLayout( this.s.dt.aoFooter, aiColumns );
921
1090
  var jqCloneTfoot = $('>tfoot', oClone.footer);
922
1091
  jqCloneTfoot.empty();
923
-
1092
+
924
1093
  for ( i=0, iLen=aoCloneLayout.length ; i<iLen ; i++ )
925
1094
  {
926
1095
  jqCloneTfoot[0].appendChild( aoCloneLayout[i].nTr );
@@ -929,7 +1098,7 @@ FixedColumns.prototype = {
929
1098
  }
930
1099
  else
931
1100
  {
932
- var aoCloneLayout = this._fnCopyLayout( this.s.dt.aoFooter, aiColumns );
1101
+ aoCloneLayout = this._fnCopyLayout( this.s.dt.aoFooter, aiColumns );
933
1102
  var aoCurrFooter=[];
934
1103
 
935
1104
  this.s.dt.oApi._fnDetectHeader( aoCurrFooter, $('>tfoot', oClone.footer)[0] );
@@ -961,8 +1130,8 @@ FixedColumns.prototype = {
961
1130
  } );
962
1131
  }
963
1132
  },
964
-
965
-
1133
+
1134
+
966
1135
  /**
967
1136
  * From a given table node (THEAD etc), get a list of TR direct child elements
968
1137
  * @param {Node} nIn Table element to search for TR elements (THEAD, TBODY or TFOOT element)
@@ -982,7 +1151,7 @@ FixedColumns.prototype = {
982
1151
  return aOut;
983
1152
  },
984
1153
 
985
-
1154
+
986
1155
  /**
987
1156
  * Equalise the heights of the rows in a given table node in a cross browser way
988
1157
  * @returns {void}
@@ -997,7 +1166,7 @@ FixedColumns.prototype = {
997
1166
  {
998
1167
  return;
999
1168
  }
1000
-
1169
+
1001
1170
  var that = this,
1002
1171
  i, iLen, iHeight, iHeight2, iHeightOriginal, iHeightClone,
1003
1172
  rootOriginal = original.getElementsByTagName(nodeName)[0],
@@ -1005,41 +1174,27 @@ FixedColumns.prototype = {
1005
1174
  jqBoxHack = $('>'+nodeName+'>tr:eq(0)', original).children(':first'),
1006
1175
  iBoxHack = jqBoxHack.outerHeight() - jqBoxHack.height(),
1007
1176
  anOriginal = this._fnGetTrNodes( rootOriginal ),
1008
- anClone = this._fnGetTrNodes( rootClone );
1009
-
1177
+ anClone = this._fnGetTrNodes( rootClone ),
1178
+ heights = [];
1179
+
1010
1180
  for ( i=0, iLen=anClone.length ; i<iLen ; i++ )
1011
1181
  {
1012
- if ( this.s.sHeightMatch == 'semiauto' && typeof anOriginal[i]._DTTC_iHeight != 'undefined' &&
1013
- anOriginal[i]._DTTC_iHeight !== null )
1014
- {
1015
- /* Oddly enough, IE / Chrome seem not to copy the style height - Mozilla and Opera keep it */
1016
- if ( $.browser.msie )
1017
- {
1018
- $(anClone[i]).children().height( anOriginal[i]._DTTC_iHeight-iBoxHack );
1019
- }
1020
- continue;
1021
- }
1022
-
1023
1182
  iHeightOriginal = anOriginal[i].offsetHeight;
1024
1183
  iHeightClone = anClone[i].offsetHeight;
1025
1184
  iHeight = iHeightClone > iHeightOriginal ? iHeightClone : iHeightOriginal;
1026
-
1185
+
1027
1186
  if ( this.s.sHeightMatch == 'semiauto' )
1028
1187
  {
1029
1188
  anOriginal[i]._DTTC_iHeight = iHeight;
1030
1189
  }
1031
-
1032
- /* Can we use some kind of object detection here?! This is very nasty - damn browsers */
1033
- if ( $.browser.msie && $.browser.version < 8 )
1034
- {
1035
- $(anClone[i]).children().height( iHeight-iBoxHack );
1036
- $(anOriginal[i]).children().height( iHeight-iBoxHack );
1037
- }
1038
- else
1039
- {
1040
- anClone[i].style.height = iHeight+"px";
1041
- anOriginal[i].style.height = iHeight+"px";
1042
- }
1190
+
1191
+ heights.push( iHeight );
1192
+ }
1193
+
1194
+ for ( i=0, iLen=anClone.length ; i<iLen ; i++ )
1195
+ {
1196
+ anClone[i].style.height = heights[i]+"px";
1197
+ anOriginal[i].style.height = heights[i]+"px";
1043
1198
  }
1044
1199
  }
1045
1200
  };
@@ -1057,124 +1212,54 @@ FixedColumns.prototype = {
1057
1212
  * @static
1058
1213
  */
1059
1214
  FixedColumns.defaults = {
1060
- /**
1215
+ /**
1061
1216
  * Number of left hand columns to fix in position
1062
1217
  * @type int
1063
1218
  * @default 1
1064
1219
  * @static
1065
1220
  * @example
1066
- * var oTable = $('#example').dataTable( {
1067
- * "sScrollX": "100%"
1068
- * } );
1069
- * new FixedColumns( oTable, {
1070
- * "iLeftColumns": 2
1071
- * } );
1221
+ * var = $('#example').dataTable( {
1222
+ * "scrollX": "100%"
1223
+ * } );
1224
+ * new $.fn.dataTable.fixedColumns( table, {
1225
+ * "leftColumns": 2
1226
+ * } );
1072
1227
  */
1073
1228
  "iLeftColumns": 1,
1074
-
1075
- /**
1229
+
1230
+ /**
1076
1231
  * Number of right hand columns to fix in position
1077
1232
  * @type int
1078
1233
  * @default 0
1079
1234
  * @static
1080
1235
  * @example
1081
- * var oTable = $('#example').dataTable( {
1082
- * "sScrollX": "100%"
1083
- * } );
1084
- * new FixedColumns( oTable, {
1085
- * "iRightColumns": 1
1086
- * } );
1236
+ * var table = $('#example').dataTable( {
1237
+ * "scrollX": "100%"
1238
+ * } );
1239
+ * new $.fn.dataTable.fixedColumns( table, {
1240
+ * "rightColumns": 1
1241
+ * } );
1087
1242
  */
1088
1243
  "iRightColumns": 0,
1089
-
1090
- /**
1244
+
1245
+ /**
1091
1246
  * Draw callback function which is called when FixedColumns has redrawn the fixed assets
1092
1247
  * @type function(object, object):void
1093
1248
  * @default null
1094
1249
  * @static
1095
1250
  * @example
1096
- * var oTable = $('#example').dataTable( {
1097
- * "sScrollX": "100%"
1098
- * } );
1099
- * new FixedColumns( oTable, {
1100
- * "fnDrawCallback": function () {
1101
- * alert( "FixedColumns redraw" );
1102
- * }
1103
- * } );
1251
+ * var table = $('#example').dataTable( {
1252
+ * "scrollX": "100%"
1253
+ * } );
1254
+ * new $.fn.dataTable.fixedColumns( table, {
1255
+ * "drawCallback": function () {
1256
+ * alert( "FixedColumns redraw" );
1257
+ * }
1258
+ * } );
1104
1259
  */
1105
1260
  "fnDrawCallback": null,
1106
-
1107
- /**
1108
- * Type of left column size calculation. Can take the values of "fixed", whereby the iLeftWidth
1109
- * value will be treated as a pixel value, or "relative" for which case iLeftWidth will be
1110
- * treated as a percentage value.
1111
- * @type string
1112
- * @default fixed
1113
- * @static
1114
- * @example
1115
- * var oTable = $('#example').dataTable( {
1116
- * "sScrollX": "100%"
1117
- * } );
1118
- * new FixedColumns( oTable, {
1119
- * "sLeftWidth": "relative",
1120
- * "iLeftWidth": 10 // percentage
1121
- * } );
1122
- */
1123
- "sLeftWidth": "fixed",
1124
-
1125
- /**
1126
- * Width to set for the width of the left fixed column(s) - note that the behaviour of this
1127
- * property is directly effected by the sLeftWidth property. If not defined then this property
1128
- * is calculated automatically from what has been assigned by DataTables.
1129
- * @type int
1130
- * @default null
1131
- * @static
1132
- * @example
1133
- * var oTable = $('#example').dataTable( {
1134
- * "sScrollX": "100%"
1135
- * } );
1136
- * new FixedColumns( oTable, {
1137
- * "iLeftWidth": 100 // pixels
1138
- * } );
1139
- */
1140
- "iLeftWidth": null,
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
1145
- * iRightWidth will be treated as a percentage value.
1146
- * @type string
1147
- * @default fixed
1148
- * @static
1149
- * @example
1150
- * var oTable = $('#example').dataTable( {
1151
- * "sScrollX": "100%"
1152
- * } );
1153
- * new FixedColumns( oTable, {
1154
- * "sRightWidth": "relative",
1155
- * "iRightWidth": 10 // percentage
1156
- * } );
1157
- */
1158
- "sRightWidth": "fixed",
1159
-
1261
+
1160
1262
  /**
1161
- * Width to set for the width of the right fixed column(s) - note that the behaviour of this
1162
- * property is directly effected by the sRightWidth property. If not defined then this property
1163
- * is calculated automatically from what has been assigned by DataTables.
1164
- * @type int
1165
- * @default null
1166
- * @static
1167
- * @example
1168
- * var oTable = $('#example').dataTable( {
1169
- * "sScrollX": "100%"
1170
- * } );
1171
- * new FixedColumns( oTable, {
1172
- * "iRightWidth": 200 // pixels
1173
- * } );
1174
- */
1175
- "iRightWidth": null,
1176
-
1177
- /**
1178
1263
  * Height matching algorthim to use. This can be "none" which will result in no height
1179
1264
  * matching being applied by FixedColumns (height matching could be forced by CSS in this
1180
1265
  * case), "semiauto" whereby the height calculation will be performed once, and the result
@@ -1184,12 +1269,12 @@ FixedColumns.defaults = {
1184
1269
  * @default semiauto
1185
1270
  * @static
1186
1271
  * @example
1187
- * var oTable = $('#example').dataTable( {
1188
- * "sScrollX": "100%"
1189
- * } );
1190
- * new FixedColumns( oTable, {
1191
- * "sHeightMatch": "auto"
1192
- * } );
1272
+ * var table = $('#example').dataTable( {
1273
+ * "scrollX": "100%"
1274
+ * } );
1275
+ * new $.fn.dataTable.fixedColumns( table, {
1276
+ * "heightMatch": "auto"
1277
+ * } );
1193
1278
  */
1194
1279
  "sHeightMatch": "semiauto"
1195
1280
  };
@@ -1218,7 +1303,7 @@ FixedColumns.prototype.CLASS = "FixedColumns";
1218
1303
  * @default See code
1219
1304
  * @static
1220
1305
  */
1221
- FixedColumns.VERSION = "2.0.4.dev";
1306
+ FixedColumns.VERSION = "2.5.0.dev";
1222
1307
 
1223
1308
 
1224
1309
 
@@ -1237,4 +1322,9 @@ FixedColumns.VERSION = "2.0.4.dev";
1237
1322
  * @param {object} o.rightClone Instance's object dom.clone.right for easy reference. This object contains references to the right fixed clumn column's nodes
1238
1323
  */
1239
1324
 
1240
- })(jQuery, window, document);
1325
+
1326
+ // Make FixedColumns accessible from the DataTables instance
1327
+ $.fn.dataTable.FixedColumns = FixedColumns;
1328
+
1329
+
1330
+ })(window, document, jQuery);