jquery-datatables-rails 1.11.0 → 1.11.1
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.
- data/lib/jquery-datatables-rails.rb +0 -0
- data/lib/jquery/datatables/rails/engine.rb +0 -0
- data/lib/jquery/datatables/rails/version.rb +1 -1
- data/vendor/assets/images/dataTables/back_disabled.png +0 -0
- data/vendor/assets/images/dataTables/back_enabled.png +0 -0
- data/vendor/assets/images/dataTables/back_enabled_hover.png +0 -0
- data/vendor/assets/images/dataTables/extras/background.png +0 -0
- data/vendor/assets/images/dataTables/extras/collection.png +0 -0
- data/vendor/assets/images/dataTables/extras/collection_hover.png +0 -0
- data/vendor/assets/images/dataTables/extras/copy.png +0 -0
- data/vendor/assets/images/dataTables/extras/copy_hover.png +0 -0
- data/vendor/assets/images/dataTables/extras/csv.png +0 -0
- data/vendor/assets/images/dataTables/extras/csv_hover.png +0 -0
- data/vendor/assets/images/dataTables/extras/pdf.png +0 -0
- data/vendor/assets/images/dataTables/extras/pdf_hover.png +0 -0
- data/vendor/assets/images/dataTables/extras/print.png +0 -0
- data/vendor/assets/images/dataTables/extras/print_hover.png +0 -0
- data/vendor/assets/images/dataTables/extras/xls.png +0 -0
- data/vendor/assets/images/dataTables/extras/xls_hover.png +0 -0
- data/vendor/assets/images/dataTables/favicon.ico +0 -0
- data/vendor/assets/images/dataTables/forward_disabled.png +0 -0
- data/vendor/assets/images/dataTables/forward_enabled.png +0 -0
- data/vendor/assets/images/dataTables/forward_enabled_hover.png +0 -0
- data/vendor/assets/images/dataTables/sort_asc.png +0 -0
- data/vendor/assets/images/dataTables/sort_asc_disabled.png +0 -0
- data/vendor/assets/images/dataTables/sort_both.png +0 -0
- data/vendor/assets/images/dataTables/sort_desc.png +0 -0
- data/vendor/assets/images/dataTables/sort_desc_disabled.png +0 -0
- data/vendor/assets/javascripts/dataTables/extras/AutoFill.js +0 -0
- data/vendor/assets/javascripts/dataTables/extras/ColReorder.js +0 -0
- data/vendor/assets/javascripts/dataTables/extras/ColVis.js +0 -0
- data/vendor/assets/javascripts/dataTables/extras/FixedColumns.js +0 -0
- data/vendor/assets/javascripts/dataTables/extras/FixedHeader.js +0 -0
- data/vendor/assets/javascripts/dataTables/extras/KeyTable.js +0 -0
- data/vendor/assets/javascripts/dataTables/extras/Scroller.js +0 -0
- data/vendor/assets/javascripts/dataTables/extras/TableTools.js +320 -302
- data/vendor/assets/javascripts/dataTables/extras/TableTools.min.js +76 -0
- data/vendor/assets/javascripts/dataTables/extras/ZeroClipboard.js +2 -2
- data/vendor/assets/javascripts/dataTables/jquery.dataTables.api.fnFilterOnReturn.js +1 -1
- data/vendor/assets/javascripts/dataTables/jquery.dataTables.api.fnGetColumnData.js +0 -0
- data/vendor/assets/javascripts/dataTables/jquery.dataTables.api.fnReloadAjax.js +0 -0
- data/vendor/assets/javascripts/dataTables/jquery.dataTables.api.fnSetFilteringDelay.js +32 -0
- data/vendor/assets/javascripts/dataTables/jquery.dataTables.bootstrap.js +0 -0
- data/vendor/assets/javascripts/dataTables/jquery.dataTables.js +0 -0
- data/vendor/assets/javascripts/dataTables/jquery.dataTables.sorting.numbersHtml.js +0 -0
- data/vendor/assets/javascripts/dataTables/jquery.dataTables.typeDetection.numbersHtml.js +0 -0
- data/vendor/assets/media/dataTables/extras/as3/ZeroClipboard.as +221 -0
- data/vendor/assets/media/dataTables/extras/as3/ZeroClipboardPdf.as +310 -0
- data/vendor/assets/media/dataTables/extras/as3/lib/AlivePDF.swc +0 -0
- data/vendor/assets/media/dataTables/extras/swf/copy_csv_xls.swf +0 -0
- data/vendor/assets/media/dataTables/extras/swf/copy_csv_xls_pdf.swf +0 -0
- data/vendor/assets/stylesheets/dataTables/extras/TableTools.css +314 -0
- data/vendor/assets/stylesheets/dataTables/extras/TableTools_JUI.css +185 -0
- data/vendor/assets/stylesheets/dataTables/jquery.dataTables.bootstrap.css.scss +0 -0
- data/vendor/assets/stylesheets/dataTables/jquery.dataTables.css.scss +11 -11
- data/vendor/assets/stylesheets/dataTables/src/demo_page.css +0 -0
- data/vendor/assets/stylesheets/dataTables/src/demo_table.css +11 -11
- data/vendor/assets/stylesheets/dataTables/src/demo_table_jui.css +17 -9
- data/vendor/assets/stylesheets/dataTables/src/jquery.dataTables_themeroller.css +6 -6
- metadata +25 -10
- data/.gitignore +0 -7
- data/Gemfile +0 -4
- data/LICENSE +0 -20
- data/Rakefile +0 -1
- data/Readme.md +0 -88
- data/jquery-datatables-rails.gemspec +0 -20
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* File: TableTools.js
|
|
3
|
-
* Version: 2.1.
|
|
3
|
+
* Version: 2.1.3
|
|
4
4
|
* Description: Tools and buttons for DataTables
|
|
5
5
|
* Author: Allan Jardine (www.sprymedia.co.uk)
|
|
6
6
|
* Language: Javascript
|
|
7
7
|
* License: GPL v2 or BSD 3 point style
|
|
8
8
|
* Project: DataTables
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
* Copyright 2009-2012 Allan Jardine, all rights reserved.
|
|
11
11
|
*
|
|
12
12
|
* This source file is free software, under either the GPL v2 license or a
|
|
@@ -20,7 +20,7 @@ var TableTools;
|
|
|
20
20
|
|
|
21
21
|
(function($, window, document) {
|
|
22
22
|
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
24
|
* TableTools provides flexible buttons and other tools for a DataTables enhanced table
|
|
25
25
|
* @class TableTools
|
|
26
26
|
* @constructor
|
|
@@ -40,61 +40,61 @@ TableTools = function( oDT, oOpts )
|
|
|
40
40
|
{
|
|
41
41
|
alert( "Warning: TableTools must be initialised with the keyword 'new'" );
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
|
|
44
|
+
|
|
45
45
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
46
46
|
* Public class variables
|
|
47
47
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
/**
|
|
50
50
|
* @namespace Settings object which contains customisable information for TableTools instance
|
|
51
51
|
*/
|
|
52
52
|
this.s = {
|
|
53
53
|
/**
|
|
54
|
-
* Store 'this' so the instance can be
|
|
54
|
+
* Store 'this' so the instance can be retrieved from the settings object
|
|
55
55
|
* @property that
|
|
56
56
|
* @type object
|
|
57
57
|
* @default this
|
|
58
58
|
*/
|
|
59
59
|
"that": this,
|
|
60
|
-
|
|
61
|
-
/**
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
62
|
* DataTables settings objects
|
|
63
63
|
* @property dt
|
|
64
64
|
* @type object
|
|
65
65
|
* @default <i>From the oDT init option</i>
|
|
66
66
|
*/
|
|
67
67
|
"dt": oDT.fnSettings(),
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
/**
|
|
70
70
|
* @namespace Print specific information
|
|
71
71
|
*/
|
|
72
72
|
"print": {
|
|
73
|
-
/**
|
|
73
|
+
/**
|
|
74
74
|
* DataTables draw 'start' point before the printing display was shown
|
|
75
75
|
* @property saveStart
|
|
76
76
|
* @type int
|
|
77
77
|
* @default -1
|
|
78
78
|
*/
|
|
79
79
|
"saveStart": -1,
|
|
80
|
-
|
|
81
|
-
/**
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
82
|
* DataTables draw 'length' point before the printing display was shown
|
|
83
83
|
* @property saveLength
|
|
84
84
|
* @type int
|
|
85
85
|
* @default -1
|
|
86
86
|
*/
|
|
87
87
|
"saveLength": -1,
|
|
88
|
-
|
|
89
|
-
/**
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
90
|
* Page scrolling point before the printing display was shown so it can be restored
|
|
91
91
|
* @property saveScroll
|
|
92
92
|
* @type int
|
|
93
93
|
* @default -1
|
|
94
94
|
*/
|
|
95
95
|
"saveScroll": -1,
|
|
96
|
-
|
|
97
|
-
/**
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
98
|
* Wrapped function to end the print display (to maintain scope)
|
|
99
99
|
* @property funcEnd
|
|
100
100
|
* @type Function
|
|
@@ -102,7 +102,7 @@ TableTools = function( oDT, oOpts )
|
|
|
102
102
|
*/
|
|
103
103
|
"funcEnd": function () {}
|
|
104
104
|
},
|
|
105
|
-
|
|
105
|
+
|
|
106
106
|
/**
|
|
107
107
|
* A unique ID is assigned to each button in each instance
|
|
108
108
|
* @property buttonCounter
|
|
@@ -110,7 +110,7 @@ TableTools = function( oDT, oOpts )
|
|
|
110
110
|
* @default 0
|
|
111
111
|
*/
|
|
112
112
|
"buttonCounter": 0,
|
|
113
|
-
|
|
113
|
+
|
|
114
114
|
/**
|
|
115
115
|
* @namespace Select rows specific information
|
|
116
116
|
*/
|
|
@@ -122,7 +122,7 @@ TableTools = function( oDT, oOpts )
|
|
|
122
122
|
* @default ""
|
|
123
123
|
*/
|
|
124
124
|
"type": "",
|
|
125
|
-
|
|
125
|
+
|
|
126
126
|
/**
|
|
127
127
|
* Array of nodes which are currently selected
|
|
128
128
|
* @property selected
|
|
@@ -130,7 +130,7 @@ TableTools = function( oDT, oOpts )
|
|
|
130
130
|
* @default []
|
|
131
131
|
*/
|
|
132
132
|
"selected": [],
|
|
133
|
-
|
|
133
|
+
|
|
134
134
|
/**
|
|
135
135
|
* Function to run before the selection can take place. Will cancel the select if the
|
|
136
136
|
* function returns false
|
|
@@ -139,7 +139,7 @@ TableTools = function( oDT, oOpts )
|
|
|
139
139
|
* @default null
|
|
140
140
|
*/
|
|
141
141
|
"preRowSelect": null,
|
|
142
|
-
|
|
142
|
+
|
|
143
143
|
/**
|
|
144
144
|
* Function to run when a row is selected
|
|
145
145
|
* @property postSelected
|
|
@@ -147,7 +147,7 @@ TableTools = function( oDT, oOpts )
|
|
|
147
147
|
* @default null
|
|
148
148
|
*/
|
|
149
149
|
"postSelected": null,
|
|
150
|
-
|
|
150
|
+
|
|
151
151
|
/**
|
|
152
152
|
* Function to run when a row is deselected
|
|
153
153
|
* @property postDeselected
|
|
@@ -155,7 +155,7 @@ TableTools = function( oDT, oOpts )
|
|
|
155
155
|
* @default null
|
|
156
156
|
*/
|
|
157
157
|
"postDeselected": null,
|
|
158
|
-
|
|
158
|
+
|
|
159
159
|
/**
|
|
160
160
|
* Indicate if all rows are selected (needed for server-side processing)
|
|
161
161
|
* @property all
|
|
@@ -163,7 +163,7 @@ TableTools = function( oDT, oOpts )
|
|
|
163
163
|
* @default false
|
|
164
164
|
*/
|
|
165
165
|
"all": false,
|
|
166
|
-
|
|
166
|
+
|
|
167
167
|
/**
|
|
168
168
|
* Class name to add to selected TR nodes
|
|
169
169
|
* @property selectedClass
|
|
@@ -172,7 +172,7 @@ TableTools = function( oDT, oOpts )
|
|
|
172
172
|
*/
|
|
173
173
|
"selectedClass": ""
|
|
174
174
|
},
|
|
175
|
-
|
|
175
|
+
|
|
176
176
|
/**
|
|
177
177
|
* Store of the user input customisation object
|
|
178
178
|
* @property custom
|
|
@@ -180,7 +180,7 @@ TableTools = function( oDT, oOpts )
|
|
|
180
180
|
* @default {}
|
|
181
181
|
*/
|
|
182
182
|
"custom": {},
|
|
183
|
-
|
|
183
|
+
|
|
184
184
|
/**
|
|
185
185
|
* SWF movie path
|
|
186
186
|
* @property swfPath
|
|
@@ -188,7 +188,7 @@ TableTools = function( oDT, oOpts )
|
|
|
188
188
|
* @default ""
|
|
189
189
|
*/
|
|
190
190
|
"swfPath": "",
|
|
191
|
-
|
|
191
|
+
|
|
192
192
|
/**
|
|
193
193
|
* Default button set
|
|
194
194
|
* @property buttonSet
|
|
@@ -196,24 +196,24 @@ TableTools = function( oDT, oOpts )
|
|
|
196
196
|
* @default []
|
|
197
197
|
*/
|
|
198
198
|
"buttonSet": [],
|
|
199
|
-
|
|
199
|
+
|
|
200
200
|
/**
|
|
201
|
-
* When there is more than one TableTools instance for a DataTable, there must be a
|
|
201
|
+
* When there is more than one TableTools instance for a DataTable, there must be a
|
|
202
202
|
* master which controls events (row selection etc)
|
|
203
203
|
* @property master
|
|
204
204
|
* @type boolean
|
|
205
205
|
* @default false
|
|
206
206
|
*/
|
|
207
207
|
"master": false,
|
|
208
|
-
|
|
208
|
+
|
|
209
209
|
/**
|
|
210
210
|
* Tag names that are used for creating collections and buttons
|
|
211
211
|
* @namesapce
|
|
212
212
|
*/
|
|
213
213
|
"tags": {}
|
|
214
214
|
};
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
|
|
216
|
+
|
|
217
217
|
/**
|
|
218
218
|
* @namespace Common and useful DOM elements for the class instance
|
|
219
219
|
*/
|
|
@@ -225,7 +225,7 @@ TableTools = function( oDT, oOpts )
|
|
|
225
225
|
* @default null
|
|
226
226
|
*/
|
|
227
227
|
"container": null,
|
|
228
|
-
|
|
228
|
+
|
|
229
229
|
/**
|
|
230
230
|
* The table node to which TableTools will be applied
|
|
231
231
|
* @property table
|
|
@@ -233,7 +233,7 @@ TableTools = function( oDT, oOpts )
|
|
|
233
233
|
* @default null
|
|
234
234
|
*/
|
|
235
235
|
"table": null,
|
|
236
|
-
|
|
236
|
+
|
|
237
237
|
/**
|
|
238
238
|
* @namespace Nodes used for the print display
|
|
239
239
|
*/
|
|
@@ -245,16 +245,16 @@ TableTools = function( oDT, oOpts )
|
|
|
245
245
|
* @default []
|
|
246
246
|
*/
|
|
247
247
|
"hidden": [],
|
|
248
|
-
|
|
248
|
+
|
|
249
249
|
/**
|
|
250
|
-
* The information display saying
|
|
250
|
+
* The information display saying telling the user about the print display
|
|
251
251
|
* @property message
|
|
252
252
|
* @type node
|
|
253
253
|
* @default null
|
|
254
254
|
*/
|
|
255
255
|
"message": null
|
|
256
256
|
},
|
|
257
|
-
|
|
257
|
+
|
|
258
258
|
/**
|
|
259
259
|
* @namespace Nodes used for a collection display. This contains the currently used collection
|
|
260
260
|
*/
|
|
@@ -266,7 +266,7 @@ TableTools = function( oDT, oOpts )
|
|
|
266
266
|
* @default null
|
|
267
267
|
*/
|
|
268
268
|
"collection": null,
|
|
269
|
-
|
|
269
|
+
|
|
270
270
|
/**
|
|
271
271
|
* Background display to provide focus and capture events
|
|
272
272
|
* @property background
|
|
@@ -286,12 +286,12 @@ TableTools = function( oDT, oOpts )
|
|
|
286
286
|
{
|
|
287
287
|
$.extend( true, this.classes, TableTools.classes_themeroller );
|
|
288
288
|
}
|
|
289
|
-
|
|
290
|
-
|
|
289
|
+
|
|
290
|
+
|
|
291
291
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
292
292
|
* Public class methods
|
|
293
293
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
294
|
-
|
|
294
|
+
|
|
295
295
|
/**
|
|
296
296
|
* Retreieve the settings object from an instance
|
|
297
297
|
* @method fnSettings
|
|
@@ -300,16 +300,16 @@ TableTools = function( oDT, oOpts )
|
|
|
300
300
|
this.fnSettings = function () {
|
|
301
301
|
return this.s;
|
|
302
302
|
};
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
|
|
304
|
+
|
|
305
305
|
/* Constructor logic */
|
|
306
306
|
if ( typeof oOpts == 'undefined' )
|
|
307
307
|
{
|
|
308
308
|
oOpts = {};
|
|
309
309
|
}
|
|
310
|
-
|
|
310
|
+
|
|
311
311
|
this._fnConstruct( oOpts );
|
|
312
|
-
|
|
312
|
+
|
|
313
313
|
return this;
|
|
314
314
|
};
|
|
315
315
|
|
|
@@ -319,7 +319,7 @@ TableTools.prototype = {
|
|
|
319
319
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
320
320
|
* Public methods
|
|
321
321
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
322
|
-
|
|
322
|
+
|
|
323
323
|
/**
|
|
324
324
|
* Retreieve the settings object from an instance
|
|
325
325
|
* @returns {array} List of TR nodes which are currently selected
|
|
@@ -363,8 +363,8 @@ TableTools.prototype = {
|
|
|
363
363
|
|
|
364
364
|
return out;
|
|
365
365
|
},
|
|
366
|
-
|
|
367
|
-
|
|
366
|
+
|
|
367
|
+
|
|
368
368
|
/**
|
|
369
369
|
* Check to see if a current row is selected or not
|
|
370
370
|
* @param {Node} n TR node to check if it is currently selected or not
|
|
@@ -376,27 +376,41 @@ TableTools.prototype = {
|
|
|
376
376
|
return (this.s.dt.aoData[pos]._DTTT_selected===true) ? true : false;
|
|
377
377
|
},
|
|
378
378
|
|
|
379
|
-
|
|
379
|
+
|
|
380
380
|
/**
|
|
381
381
|
* Select all rows in the table
|
|
382
|
+
* @param {boolean} [filtered=false] Select only rows which are available
|
|
383
|
+
* given the filtering applied to the table. By default this is false -
|
|
384
|
+
* i.e. all rows, regardless of filtering are selected.
|
|
382
385
|
*/
|
|
383
|
-
"fnSelectAll": function ()
|
|
386
|
+
"fnSelectAll": function ( filtered )
|
|
384
387
|
{
|
|
385
388
|
var s = this._fnGetMasterSettings();
|
|
386
|
-
|
|
389
|
+
|
|
390
|
+
this._fnRowSelect( (filtered === true) ?
|
|
391
|
+
s.dt.aiDisplay :
|
|
392
|
+
s.dt.aoData
|
|
393
|
+
);
|
|
387
394
|
},
|
|
388
395
|
|
|
389
|
-
|
|
396
|
+
|
|
390
397
|
/**
|
|
391
398
|
* Deselect all rows in the table
|
|
399
|
+
* @param {boolean} [filtered=false] Deselect only rows which are available
|
|
400
|
+
* given the filtering applied to the table. By default this is false -
|
|
401
|
+
* i.e. all rows, regardless of filtering are deselected.
|
|
392
402
|
*/
|
|
393
|
-
"fnSelectNone": function ()
|
|
403
|
+
"fnSelectNone": function ( filtered )
|
|
394
404
|
{
|
|
395
405
|
var s = this._fnGetMasterSettings();
|
|
396
|
-
this._fnRowDeselect( s.dt.aoData );
|
|
397
|
-
},
|
|
398
406
|
|
|
407
|
+
this._fnRowDeselect( (filtered === true) ?
|
|
408
|
+
s.dt.aiDisplay :
|
|
409
|
+
s.dt.aoData
|
|
410
|
+
);
|
|
411
|
+
},
|
|
399
412
|
|
|
413
|
+
|
|
400
414
|
/**
|
|
401
415
|
* Select row(s)
|
|
402
416
|
* @param {node|object|array} n The row(s) to select. Can be a single DOM
|
|
@@ -415,7 +429,7 @@ TableTools.prototype = {
|
|
|
415
429
|
}
|
|
416
430
|
},
|
|
417
431
|
|
|
418
|
-
|
|
432
|
+
|
|
419
433
|
/**
|
|
420
434
|
* Deselect row(s)
|
|
421
435
|
* @param {node|object|array} n The row(s) to deselect. Can be a single DOM
|
|
@@ -425,8 +439,8 @@ TableTools.prototype = {
|
|
|
425
439
|
{
|
|
426
440
|
this._fnRowDeselect( n );
|
|
427
441
|
},
|
|
428
|
-
|
|
429
|
-
|
|
442
|
+
|
|
443
|
+
|
|
430
444
|
/**
|
|
431
445
|
* Get the title of the document - useful for file names. The title is retrieved from either
|
|
432
446
|
* the configuration object's 'title' parameter, or the HTML document title
|
|
@@ -445,7 +459,7 @@ TableTools.prototype = {
|
|
|
445
459
|
sTitle = anTitle[0].innerHTML;
|
|
446
460
|
}
|
|
447
461
|
}
|
|
448
|
-
|
|
462
|
+
|
|
449
463
|
/* Strip characters which the OS will object to - checking for UTF8 support in the scripting
|
|
450
464
|
* engine
|
|
451
465
|
*/
|
|
@@ -455,8 +469,8 @@ TableTools.prototype = {
|
|
|
455
469
|
return sTitle.replace(/[^a-zA-Z0-9_\.,\-_ !\(\)]/g, "");
|
|
456
470
|
}
|
|
457
471
|
},
|
|
458
|
-
|
|
459
|
-
|
|
472
|
+
|
|
473
|
+
|
|
460
474
|
/**
|
|
461
475
|
* Calculate a unity array with the column width by proportion for a set of columns to be
|
|
462
476
|
* included for a button. This is particularly useful for PDF creation, where we can use the
|
|
@@ -471,7 +485,7 @@ TableTools.prototype = {
|
|
|
471
485
|
aColumnsInc = this._fnColumnTargets( oConfig.mColumns ),
|
|
472
486
|
aColWidths = [],
|
|
473
487
|
iWidth = 0, iTotal = 0, i, iLen;
|
|
474
|
-
|
|
488
|
+
|
|
475
489
|
for ( i=0, iLen=aColumnsInc.length ; i<iLen ; i++ )
|
|
476
490
|
{
|
|
477
491
|
if ( aColumnsInc[i] )
|
|
@@ -481,16 +495,16 @@ TableTools.prototype = {
|
|
|
481
495
|
aColWidths.push( iWidth );
|
|
482
496
|
}
|
|
483
497
|
}
|
|
484
|
-
|
|
498
|
+
|
|
485
499
|
for ( i=0, iLen=aColWidths.length ; i<iLen ; i++ )
|
|
486
500
|
{
|
|
487
501
|
aColWidths[i] = aColWidths[i] / iTotal;
|
|
488
502
|
}
|
|
489
|
-
|
|
503
|
+
|
|
490
504
|
return aColWidths.join('\t');
|
|
491
505
|
},
|
|
492
|
-
|
|
493
|
-
|
|
506
|
+
|
|
507
|
+
|
|
494
508
|
/**
|
|
495
509
|
* Get the information contained in a table as a string
|
|
496
510
|
* @param {Object} oConfig Button configuration object
|
|
@@ -504,8 +518,8 @@ TableTools.prototype = {
|
|
|
504
518
|
return this._fnGetDataTablesData( oConfig );
|
|
505
519
|
}
|
|
506
520
|
},
|
|
507
|
-
|
|
508
|
-
|
|
521
|
+
|
|
522
|
+
|
|
509
523
|
/**
|
|
510
524
|
* Pass text to a flash button instance, which will be used on the button's click handler
|
|
511
525
|
* @param {Object} clip Flash button object
|
|
@@ -515,8 +529,8 @@ TableTools.prototype = {
|
|
|
515
529
|
{
|
|
516
530
|
this._fnFlashSetText( clip, text );
|
|
517
531
|
},
|
|
518
|
-
|
|
519
|
-
|
|
532
|
+
|
|
533
|
+
|
|
520
534
|
/**
|
|
521
535
|
* Resize the flash elements of the buttons attached to this TableTools instance - this is
|
|
522
536
|
* useful for when initialising TableTools when it is hidden (display:none) since sizes can't
|
|
@@ -537,8 +551,8 @@ TableTools.prototype = {
|
|
|
537
551
|
}
|
|
538
552
|
}
|
|
539
553
|
},
|
|
540
|
-
|
|
541
|
-
|
|
554
|
+
|
|
555
|
+
|
|
542
556
|
/**
|
|
543
557
|
* Check to see if any of the ZeroClipboard client's attached need to be resized
|
|
544
558
|
*/
|
|
@@ -559,8 +573,8 @@ TableTools.prototype = {
|
|
|
559
573
|
}
|
|
560
574
|
return false;
|
|
561
575
|
},
|
|
562
|
-
|
|
563
|
-
|
|
576
|
+
|
|
577
|
+
|
|
564
578
|
/**
|
|
565
579
|
* Programmatically enable or disable the print view
|
|
566
580
|
* @param {boolean} [bView=true] Show the print view if true or not given. If false, then
|
|
@@ -588,8 +602,8 @@ TableTools.prototype = {
|
|
|
588
602
|
this._fnPrintEnd();
|
|
589
603
|
}
|
|
590
604
|
},
|
|
591
|
-
|
|
592
|
-
|
|
605
|
+
|
|
606
|
+
|
|
593
607
|
/**
|
|
594
608
|
* Show a message to the end user which is nicely styled
|
|
595
609
|
* @param {string} message The HTML string to show to the user
|
|
@@ -601,46 +615,46 @@ TableTools.prototype = {
|
|
|
601
615
|
nInfo.innerHTML = message;
|
|
602
616
|
|
|
603
617
|
document.body.appendChild( nInfo );
|
|
604
|
-
|
|
618
|
+
|
|
605
619
|
setTimeout( function() {
|
|
606
620
|
$(nInfo).fadeOut( "normal", function() {
|
|
607
621
|
document.body.removeChild( nInfo );
|
|
608
622
|
} );
|
|
609
623
|
}, time );
|
|
610
624
|
},
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
|
|
614
628
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
615
629
|
* Private methods (they are of course public in JS, but recommended as private)
|
|
616
630
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
617
|
-
|
|
631
|
+
|
|
618
632
|
/**
|
|
619
633
|
* Constructor logic
|
|
620
634
|
* @method _fnConstruct
|
|
621
635
|
* @param {Object} oOpts Same as TableTools constructor
|
|
622
636
|
* @returns void
|
|
623
|
-
* @private
|
|
637
|
+
* @private
|
|
624
638
|
*/
|
|
625
639
|
"_fnConstruct": function ( oOpts )
|
|
626
640
|
{
|
|
627
641
|
var that = this;
|
|
628
|
-
|
|
642
|
+
|
|
629
643
|
this._fnCustomiseSettings( oOpts );
|
|
630
|
-
|
|
644
|
+
|
|
631
645
|
/* Container element */
|
|
632
646
|
this.dom.container = document.createElement( this.s.tags.container );
|
|
633
647
|
this.dom.container.className = this.classes.container;
|
|
634
|
-
|
|
648
|
+
|
|
635
649
|
/* Row selection config */
|
|
636
650
|
if ( this.s.select.type != 'none' )
|
|
637
651
|
{
|
|
638
652
|
this._fnRowSelectConfig();
|
|
639
653
|
}
|
|
640
|
-
|
|
654
|
+
|
|
641
655
|
/* Buttons */
|
|
642
656
|
this._fnButtonDefinations( this.s.buttonSet, this.dom.container );
|
|
643
|
-
|
|
657
|
+
|
|
644
658
|
/* Destructor - need to wipe the DOM for IE's garbage collector */
|
|
645
659
|
this.s.dt.aoDestroyCallback.push( {
|
|
646
660
|
"sName": "TableTools",
|
|
@@ -649,14 +663,14 @@ TableTools.prototype = {
|
|
|
649
663
|
}
|
|
650
664
|
} );
|
|
651
665
|
},
|
|
652
|
-
|
|
653
|
-
|
|
666
|
+
|
|
667
|
+
|
|
654
668
|
/**
|
|
655
669
|
* Take the user defined settings and the default settings and combine them.
|
|
656
670
|
* @method _fnCustomiseSettings
|
|
657
671
|
* @param {Object} oOpts Same as TableTools constructor
|
|
658
672
|
* @returns void
|
|
659
|
-
* @private
|
|
673
|
+
* @private
|
|
660
674
|
*/
|
|
661
675
|
"_fnCustomiseSettings": function ( oOpts )
|
|
662
676
|
{
|
|
@@ -666,20 +680,20 @@ TableTools.prototype = {
|
|
|
666
680
|
this.s.master = true;
|
|
667
681
|
this.s.dt._TableToolsInit = true;
|
|
668
682
|
}
|
|
669
|
-
|
|
683
|
+
|
|
670
684
|
/* We can use the table node from comparisons to group controls */
|
|
671
685
|
this.dom.table = this.s.dt.nTable;
|
|
672
|
-
|
|
686
|
+
|
|
673
687
|
/* Clone the defaults and then the user options */
|
|
674
688
|
this.s.custom = $.extend( {}, TableTools.DEFAULTS, oOpts );
|
|
675
|
-
|
|
689
|
+
|
|
676
690
|
/* Flash file location */
|
|
677
691
|
this.s.swfPath = this.s.custom.sSwfPath;
|
|
678
692
|
if ( typeof ZeroClipboard_TableTools != 'undefined' )
|
|
679
693
|
{
|
|
680
694
|
ZeroClipboard_TableTools.moviePath = this.s.swfPath;
|
|
681
695
|
}
|
|
682
|
-
|
|
696
|
+
|
|
683
697
|
/* Table row selecting */
|
|
684
698
|
this.s.select.type = this.s.custom.sRowSelect;
|
|
685
699
|
this.s.select.preRowSelect = this.s.custom.fnPreRowSelect;
|
|
@@ -697,8 +711,8 @@ TableTools.prototype = {
|
|
|
697
711
|
/* Button set */
|
|
698
712
|
this.s.buttonSet = this.s.custom.aButtons;
|
|
699
713
|
},
|
|
700
|
-
|
|
701
|
-
|
|
714
|
+
|
|
715
|
+
|
|
702
716
|
/**
|
|
703
717
|
* Take the user input arrays and expand them to be fully defined, and then add them to a given
|
|
704
718
|
* DOM element
|
|
@@ -706,12 +720,12 @@ TableTools.prototype = {
|
|
|
706
720
|
* @param {array} buttonSet Set of user defined buttons
|
|
707
721
|
* @param {node} wrapper Node to add the created buttons to
|
|
708
722
|
* @returns void
|
|
709
|
-
* @private
|
|
723
|
+
* @private
|
|
710
724
|
*/
|
|
711
725
|
"_fnButtonDefinations": function ( buttonSet, wrapper )
|
|
712
726
|
{
|
|
713
727
|
var buttonDef;
|
|
714
|
-
|
|
728
|
+
|
|
715
729
|
for ( var i=0, iLen=buttonSet.length ; i<iLen ; i++ )
|
|
716
730
|
{
|
|
717
731
|
if ( typeof buttonSet[i] == "string" )
|
|
@@ -733,26 +747,26 @@ TableTools.prototype = {
|
|
|
733
747
|
var o = $.extend( {}, TableTools.BUTTONS[ buttonSet[i].sExtends ], true );
|
|
734
748
|
buttonDef = $.extend( o, buttonSet[i], true );
|
|
735
749
|
}
|
|
736
|
-
|
|
737
|
-
wrapper.appendChild( this._fnCreateButton(
|
|
738
|
-
buttonDef,
|
|
750
|
+
|
|
751
|
+
wrapper.appendChild( this._fnCreateButton(
|
|
752
|
+
buttonDef,
|
|
739
753
|
$(wrapper).hasClass(this.classes.collection.container)
|
|
740
754
|
) );
|
|
741
755
|
}
|
|
742
756
|
},
|
|
743
|
-
|
|
744
|
-
|
|
757
|
+
|
|
758
|
+
|
|
745
759
|
/**
|
|
746
760
|
* Create and configure a TableTools button
|
|
747
761
|
* @method _fnCreateButton
|
|
748
762
|
* @param {Object} oConfig Button configuration object
|
|
749
763
|
* @returns {Node} Button element
|
|
750
|
-
* @private
|
|
764
|
+
* @private
|
|
751
765
|
*/
|
|
752
766
|
"_fnCreateButton": function ( oConfig, bCollectionButton )
|
|
753
767
|
{
|
|
754
768
|
var nButton = this._fnButtonBase( oConfig, bCollectionButton );
|
|
755
|
-
|
|
769
|
+
|
|
756
770
|
if ( oConfig.sAction.match(/flash/) )
|
|
757
771
|
{
|
|
758
772
|
this._fnFlashConfig( nButton, oConfig );
|
|
@@ -770,17 +784,17 @@ TableTools.prototype = {
|
|
|
770
784
|
this._fnTextConfig( nButton, oConfig );
|
|
771
785
|
this._fnCollectionConfig( nButton, oConfig );
|
|
772
786
|
}
|
|
773
|
-
|
|
787
|
+
|
|
774
788
|
return nButton;
|
|
775
789
|
},
|
|
776
|
-
|
|
777
|
-
|
|
790
|
+
|
|
791
|
+
|
|
778
792
|
/**
|
|
779
793
|
* Create the DOM needed for the button and apply some base properties. All buttons start here
|
|
780
794
|
* @method _fnButtonBase
|
|
781
795
|
* @param {o} oConfig Button configuration object
|
|
782
796
|
* @returns {Node} DIV element for the button
|
|
783
|
-
* @private
|
|
797
|
+
* @private
|
|
784
798
|
*/
|
|
785
799
|
"_fnButtonBase": function ( o, bCollectionButton )
|
|
786
800
|
{
|
|
@@ -803,25 +817,25 @@ TableTools.prototype = {
|
|
|
803
817
|
nButton = document.createElement( sTag ),
|
|
804
818
|
nSpan = document.createElement( sLiner ),
|
|
805
819
|
masterS = this._fnGetMasterSettings();
|
|
806
|
-
|
|
820
|
+
|
|
807
821
|
nButton.className = sClass+" "+o.sButtonClass;
|
|
808
822
|
nButton.setAttribute('id', "ToolTables_"+this.s.dt.sInstance+"_"+masterS.buttonCounter );
|
|
809
823
|
nButton.appendChild( nSpan );
|
|
810
824
|
nSpan.innerHTML = o.sButtonText;
|
|
811
|
-
|
|
825
|
+
|
|
812
826
|
masterS.buttonCounter++;
|
|
813
|
-
|
|
827
|
+
|
|
814
828
|
return nButton;
|
|
815
829
|
},
|
|
816
|
-
|
|
817
|
-
|
|
830
|
+
|
|
831
|
+
|
|
818
832
|
/**
|
|
819
833
|
* Get the settings object for the master instance. When more than one TableTools instance is
|
|
820
834
|
* assigned to a DataTable, only one of them can be the 'master' (for the select rows). As such,
|
|
821
835
|
* we will typically want to interact with that master for global properties.
|
|
822
836
|
* @method _fnGetMasterSettings
|
|
823
837
|
* @returns {Object} TableTools settings object
|
|
824
|
-
* @private
|
|
838
|
+
* @private
|
|
825
839
|
*/
|
|
826
840
|
"_fnGetMasterSettings": function ()
|
|
827
841
|
{
|
|
@@ -842,15 +856,15 @@ TableTools.prototype = {
|
|
|
842
856
|
}
|
|
843
857
|
}
|
|
844
858
|
},
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
|
|
848
862
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
849
863
|
* Button collection functions
|
|
850
864
|
*/
|
|
851
|
-
|
|
865
|
+
|
|
852
866
|
/**
|
|
853
|
-
* Create a collection button, when activated will present a drop
|
|
867
|
+
* Create a collection button, when activated will present a drop down list of other buttons
|
|
854
868
|
* @param {Node} nButton Button to use for the collection activation
|
|
855
869
|
* @param {Object} oConfig Button configuration object
|
|
856
870
|
* @returns void
|
|
@@ -863,11 +877,11 @@ TableTools.prototype = {
|
|
|
863
877
|
nHidden.className = this.classes.collection.container;
|
|
864
878
|
oConfig._collection = nHidden;
|
|
865
879
|
document.body.appendChild( nHidden );
|
|
866
|
-
|
|
880
|
+
|
|
867
881
|
this._fnButtonDefinations( oConfig.aButtons, nHidden );
|
|
868
882
|
},
|
|
869
|
-
|
|
870
|
-
|
|
883
|
+
|
|
884
|
+
|
|
871
885
|
/**
|
|
872
886
|
* Show a button collection
|
|
873
887
|
* @param {Node} nButton Button to use for the collection
|
|
@@ -885,13 +899,13 @@ TableTools.prototype = {
|
|
|
885
899
|
iDivY = oPos.top + $(nButton).outerHeight(),
|
|
886
900
|
iWinHeight = $(window).height(), iDocHeight = $(document).height(),
|
|
887
901
|
iWinWidth = $(window).width(), iDocWidth = $(document).width();
|
|
888
|
-
|
|
902
|
+
|
|
889
903
|
nHidden.style.position = "absolute";
|
|
890
904
|
nHidden.style.left = iDivX+"px";
|
|
891
905
|
nHidden.style.top = iDivY+"px";
|
|
892
906
|
nHidden.style.display = "block";
|
|
893
907
|
$(nHidden).css('opacity',0);
|
|
894
|
-
|
|
908
|
+
|
|
895
909
|
var nBackground = document.createElement('div');
|
|
896
910
|
nBackground.style.position = "absolute";
|
|
897
911
|
nBackground.style.left = "0px";
|
|
@@ -900,27 +914,27 @@ TableTools.prototype = {
|
|
|
900
914
|
nBackground.style.width = ((iWinWidth>iDocWidth)? iWinWidth : iDocWidth) +"px";
|
|
901
915
|
nBackground.className = this.classes.collection.background;
|
|
902
916
|
$(nBackground).css('opacity',0);
|
|
903
|
-
|
|
917
|
+
|
|
904
918
|
document.body.appendChild( nBackground );
|
|
905
919
|
document.body.appendChild( nHidden );
|
|
906
|
-
|
|
920
|
+
|
|
907
921
|
/* Visual corrections to try and keep the collection visible */
|
|
908
922
|
var iDivWidth = $(nHidden).outerWidth();
|
|
909
923
|
var iDivHeight = $(nHidden).outerHeight();
|
|
910
|
-
|
|
924
|
+
|
|
911
925
|
if ( iDivX + iDivWidth > iDocWidth )
|
|
912
926
|
{
|
|
913
927
|
nHidden.style.left = (iDocWidth-iDivWidth)+"px";
|
|
914
928
|
}
|
|
915
|
-
|
|
929
|
+
|
|
916
930
|
if ( iDivY + iDivHeight > iDocHeight )
|
|
917
931
|
{
|
|
918
932
|
nHidden.style.top = (iDivY-iDivHeight-$(nButton).outerHeight())+"px";
|
|
919
933
|
}
|
|
920
|
-
|
|
934
|
+
|
|
921
935
|
this.dom.collection.collection = nHidden;
|
|
922
936
|
this.dom.collection.background = nBackground;
|
|
923
|
-
|
|
937
|
+
|
|
924
938
|
/* This results in a very small delay for the end user but it allows the animation to be
|
|
925
939
|
* much smoother. If you don't want the animation, then the setTimeout can be removed
|
|
926
940
|
*/
|
|
@@ -931,14 +945,14 @@ TableTools.prototype = {
|
|
|
931
945
|
|
|
932
946
|
/* Resize the buttons to the Flash contents fit */
|
|
933
947
|
this.fnResizeButtons();
|
|
934
|
-
|
|
948
|
+
|
|
935
949
|
/* Event handler to remove the collection display */
|
|
936
950
|
$(nBackground).click( function () {
|
|
937
951
|
that._fnCollectionHide.call( that, null, null );
|
|
938
952
|
} );
|
|
939
953
|
},
|
|
940
|
-
|
|
941
|
-
|
|
954
|
+
|
|
955
|
+
|
|
942
956
|
/**
|
|
943
957
|
* Hide a button collection
|
|
944
958
|
* @param {Node} nButton Button to use for the collection
|
|
@@ -952,59 +966,59 @@ TableTools.prototype = {
|
|
|
952
966
|
{
|
|
953
967
|
return;
|
|
954
968
|
}
|
|
955
|
-
|
|
969
|
+
|
|
956
970
|
if ( this.dom.collection.collection !== null )
|
|
957
971
|
{
|
|
958
972
|
$(this.dom.collection.collection).animate({"opacity": 0}, 500, function (e) {
|
|
959
973
|
this.style.display = "none";
|
|
960
974
|
} );
|
|
961
|
-
|
|
975
|
+
|
|
962
976
|
$(this.dom.collection.background).animate({"opacity": 0}, 500, function (e) {
|
|
963
977
|
this.parentNode.removeChild( this );
|
|
964
978
|
} );
|
|
965
|
-
|
|
979
|
+
|
|
966
980
|
this.dom.collection.collection = null;
|
|
967
981
|
this.dom.collection.background = null;
|
|
968
982
|
}
|
|
969
983
|
},
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
|
|
973
987
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
974
988
|
* Row selection functions
|
|
975
989
|
*/
|
|
976
|
-
|
|
990
|
+
|
|
977
991
|
/**
|
|
978
992
|
* Add event handlers to a table to allow for row selection
|
|
979
993
|
* @method _fnRowSelectConfig
|
|
980
994
|
* @returns void
|
|
981
|
-
* @private
|
|
995
|
+
* @private
|
|
982
996
|
*/
|
|
983
997
|
"_fnRowSelectConfig": function ()
|
|
984
998
|
{
|
|
985
999
|
if ( this.s.master )
|
|
986
1000
|
{
|
|
987
1001
|
var
|
|
988
|
-
that = this,
|
|
989
|
-
i, iLen,
|
|
1002
|
+
that = this,
|
|
1003
|
+
i, iLen,
|
|
990
1004
|
dt = this.s.dt,
|
|
991
1005
|
aoOpenRows = this.s.dt.aoOpenRows;
|
|
992
|
-
|
|
1006
|
+
|
|
993
1007
|
$(dt.nTable).addClass( this.classes.select.table );
|
|
994
|
-
|
|
1008
|
+
|
|
995
1009
|
$('tr', dt.nTBody).live( 'click', function(e) {
|
|
996
1010
|
/* Sub-table must be ignored (odd that the selector won't do this with >) */
|
|
997
1011
|
if ( this.parentNode != dt.nTBody )
|
|
998
1012
|
{
|
|
999
1013
|
return;
|
|
1000
1014
|
}
|
|
1001
|
-
|
|
1015
|
+
|
|
1002
1016
|
/* Check that we are actually working with a DataTables controlled row */
|
|
1003
1017
|
if ( dt.oInstance.fnGetData(this) === null )
|
|
1004
1018
|
{
|
|
1005
1019
|
return;
|
|
1006
1020
|
}
|
|
1007
|
-
|
|
1021
|
+
|
|
1008
1022
|
/* User defined selection function */
|
|
1009
1023
|
if ( that.s.select.preRowSelect !== null && !that.s.select.preRowSelect.call(that, e) )
|
|
1010
1024
|
{
|
|
@@ -1040,7 +1054,7 @@ TableTools.prototype = {
|
|
|
1040
1054
|
/**
|
|
1041
1055
|
* Select rows
|
|
1042
1056
|
* @param {*} src Rows to select - see _fnSelectData for a description of valid inputs
|
|
1043
|
-
* @private
|
|
1057
|
+
* @private
|
|
1044
1058
|
*/
|
|
1045
1059
|
"_fnRowSelect": function ( src )
|
|
1046
1060
|
{
|
|
@@ -1068,7 +1082,7 @@ TableTools.prototype = {
|
|
|
1068
1082
|
/**
|
|
1069
1083
|
* Deselect rows
|
|
1070
1084
|
* @param {*} src Rows to deselect - see _fnSelectData for a description of valid inputs
|
|
1071
|
-
* @private
|
|
1085
|
+
* @private
|
|
1072
1086
|
*/
|
|
1073
1087
|
"_fnRowDeselect": function ( src )
|
|
1074
1088
|
{
|
|
@@ -1092,12 +1106,12 @@ TableTools.prototype = {
|
|
|
1092
1106
|
|
|
1093
1107
|
TableTools._fnEventDispatch( this, 'select', firstTr );
|
|
1094
1108
|
},
|
|
1095
|
-
|
|
1109
|
+
|
|
1096
1110
|
/**
|
|
1097
1111
|
* Take a data source for row selection and convert it into aoData points for the DT
|
|
1098
1112
|
* @param {*} src Can be a single DOM TR node, an array of TR nodes (including a
|
|
1099
|
-
* a jQuery object), a single aoData point from DataTables
|
|
1100
|
-
* points
|
|
1113
|
+
* a jQuery object), a single aoData point from DataTables, an array of aoData
|
|
1114
|
+
* points or an array of aoData indexes
|
|
1101
1115
|
* @returns {array} An array of aoData points
|
|
1102
1116
|
*/
|
|
1103
1117
|
"_fnSelectData": function ( src )
|
|
@@ -1112,7 +1126,7 @@ TableTools.prototype = {
|
|
|
1112
1126
|
}
|
|
1113
1127
|
else if ( typeof src.length !== 'undefined' )
|
|
1114
1128
|
{
|
|
1115
|
-
// jQuery
|
|
1129
|
+
// jQuery object or an array of nodes, or aoData points
|
|
1116
1130
|
for ( i=0, iLen=src.length ; i<iLen ; i++ )
|
|
1117
1131
|
{
|
|
1118
1132
|
if ( src[i].nodeName )
|
|
@@ -1120,6 +1134,10 @@ TableTools.prototype = {
|
|
|
1120
1134
|
pos = this.s.dt.oInstance.fnGetPosition( src[i] );
|
|
1121
1135
|
out.push( this.s.dt.aoData[pos] );
|
|
1122
1136
|
}
|
|
1137
|
+
else if ( typeof src[i] === 'number' )
|
|
1138
|
+
{
|
|
1139
|
+
out.push( this.s.dt.aoData[ src[i] ] );
|
|
1140
|
+
}
|
|
1123
1141
|
else
|
|
1124
1142
|
{
|
|
1125
1143
|
out.push( src[i] );
|
|
@@ -1136,34 +1154,34 @@ TableTools.prototype = {
|
|
|
1136
1154
|
|
|
1137
1155
|
return out;
|
|
1138
1156
|
},
|
|
1139
|
-
|
|
1140
|
-
|
|
1157
|
+
|
|
1158
|
+
|
|
1141
1159
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
1142
1160
|
* Text button functions
|
|
1143
1161
|
*/
|
|
1144
|
-
|
|
1162
|
+
|
|
1145
1163
|
/**
|
|
1146
1164
|
* Configure a text based button for interaction events
|
|
1147
1165
|
* @method _fnTextConfig
|
|
1148
1166
|
* @param {Node} nButton Button element which is being considered
|
|
1149
1167
|
* @param {Object} oConfig Button configuration object
|
|
1150
1168
|
* @returns void
|
|
1151
|
-
* @private
|
|
1169
|
+
* @private
|
|
1152
1170
|
*/
|
|
1153
1171
|
"_fnTextConfig": function ( nButton, oConfig )
|
|
1154
1172
|
{
|
|
1155
1173
|
var that = this;
|
|
1156
|
-
|
|
1174
|
+
|
|
1157
1175
|
if ( oConfig.fnInit !== null )
|
|
1158
1176
|
{
|
|
1159
1177
|
oConfig.fnInit.call( this, nButton, oConfig );
|
|
1160
1178
|
}
|
|
1161
|
-
|
|
1179
|
+
|
|
1162
1180
|
if ( oConfig.sToolTip !== "" )
|
|
1163
1181
|
{
|
|
1164
1182
|
nButton.title = oConfig.sToolTip;
|
|
1165
1183
|
}
|
|
1166
|
-
|
|
1184
|
+
|
|
1167
1185
|
$(nButton).hover( function () {
|
|
1168
1186
|
if ( oConfig.fnMouseover !== null )
|
|
1169
1187
|
{
|
|
@@ -1175,58 +1193,58 @@ TableTools.prototype = {
|
|
|
1175
1193
|
oConfig.fnMouseout.call( this, nButton, oConfig, null );
|
|
1176
1194
|
}
|
|
1177
1195
|
} );
|
|
1178
|
-
|
|
1196
|
+
|
|
1179
1197
|
if ( oConfig.fnSelect !== null )
|
|
1180
1198
|
{
|
|
1181
1199
|
TableTools._fnEventListen( this, 'select', function (n) {
|
|
1182
1200
|
oConfig.fnSelect.call( that, nButton, oConfig, n );
|
|
1183
1201
|
} );
|
|
1184
1202
|
}
|
|
1185
|
-
|
|
1203
|
+
|
|
1186
1204
|
$(nButton).click( function (e) {
|
|
1187
1205
|
//e.preventDefault();
|
|
1188
|
-
|
|
1206
|
+
|
|
1189
1207
|
if ( oConfig.fnClick !== null )
|
|
1190
1208
|
{
|
|
1191
1209
|
oConfig.fnClick.call( that, nButton, oConfig, null );
|
|
1192
1210
|
}
|
|
1193
|
-
|
|
1211
|
+
|
|
1194
1212
|
/* Provide a complete function to match the behaviour of the flash elements */
|
|
1195
1213
|
if ( oConfig.fnComplete !== null )
|
|
1196
1214
|
{
|
|
1197
1215
|
oConfig.fnComplete.call( that, nButton, oConfig, null, null );
|
|
1198
1216
|
}
|
|
1199
|
-
|
|
1217
|
+
|
|
1200
1218
|
that._fnCollectionHide( nButton, oConfig );
|
|
1201
1219
|
} );
|
|
1202
1220
|
},
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1221
|
+
|
|
1222
|
+
|
|
1223
|
+
|
|
1206
1224
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
1207
1225
|
* Flash button functions
|
|
1208
1226
|
*/
|
|
1209
|
-
|
|
1227
|
+
|
|
1210
1228
|
/**
|
|
1211
1229
|
* Configure a flash based button for interaction events
|
|
1212
1230
|
* @method _fnFlashConfig
|
|
1213
1231
|
* @param {Node} nButton Button element which is being considered
|
|
1214
1232
|
* @param {o} oConfig Button configuration object
|
|
1215
1233
|
* @returns void
|
|
1216
|
-
* @private
|
|
1234
|
+
* @private
|
|
1217
1235
|
*/
|
|
1218
1236
|
"_fnFlashConfig": function ( nButton, oConfig )
|
|
1219
1237
|
{
|
|
1220
1238
|
var that = this;
|
|
1221
1239
|
var flash = new ZeroClipboard_TableTools.Client();
|
|
1222
|
-
|
|
1240
|
+
|
|
1223
1241
|
if ( oConfig.fnInit !== null )
|
|
1224
1242
|
{
|
|
1225
1243
|
oConfig.fnInit.call( this, nButton, oConfig );
|
|
1226
1244
|
}
|
|
1227
|
-
|
|
1245
|
+
|
|
1228
1246
|
flash.setHandCursor( true );
|
|
1229
|
-
|
|
1247
|
+
|
|
1230
1248
|
if ( oConfig.sAction == "flash_save" )
|
|
1231
1249
|
{
|
|
1232
1250
|
flash.setAction( 'save' );
|
|
@@ -1243,28 +1261,28 @@ TableTools.prototype = {
|
|
|
1243
1261
|
{
|
|
1244
1262
|
flash.setAction( 'copy' );
|
|
1245
1263
|
}
|
|
1246
|
-
|
|
1264
|
+
|
|
1247
1265
|
flash.addEventListener('mouseOver', function(client) {
|
|
1248
1266
|
if ( oConfig.fnMouseover !== null )
|
|
1249
1267
|
{
|
|
1250
1268
|
oConfig.fnMouseover.call( that, nButton, oConfig, flash );
|
|
1251
1269
|
}
|
|
1252
1270
|
} );
|
|
1253
|
-
|
|
1271
|
+
|
|
1254
1272
|
flash.addEventListener('mouseOut', function(client) {
|
|
1255
1273
|
if ( oConfig.fnMouseout !== null )
|
|
1256
1274
|
{
|
|
1257
1275
|
oConfig.fnMouseout.call( that, nButton, oConfig, flash );
|
|
1258
1276
|
}
|
|
1259
1277
|
} );
|
|
1260
|
-
|
|
1278
|
+
|
|
1261
1279
|
flash.addEventListener('mouseDown', function(client) {
|
|
1262
1280
|
if ( oConfig.fnClick !== null )
|
|
1263
1281
|
{
|
|
1264
1282
|
oConfig.fnClick.call( that, nButton, oConfig, flash );
|
|
1265
1283
|
}
|
|
1266
1284
|
} );
|
|
1267
|
-
|
|
1285
|
+
|
|
1268
1286
|
flash.addEventListener('complete', function (client, text) {
|
|
1269
1287
|
if ( oConfig.fnComplete !== null )
|
|
1270
1288
|
{
|
|
@@ -1272,11 +1290,11 @@ TableTools.prototype = {
|
|
|
1272
1290
|
}
|
|
1273
1291
|
that._fnCollectionHide( nButton, oConfig );
|
|
1274
1292
|
} );
|
|
1275
|
-
|
|
1293
|
+
|
|
1276
1294
|
this._fnFlashGlue( flash, nButton, oConfig.sToolTip );
|
|
1277
1295
|
},
|
|
1278
|
-
|
|
1279
|
-
|
|
1296
|
+
|
|
1297
|
+
|
|
1280
1298
|
/**
|
|
1281
1299
|
* Wait until the id is in the DOM before we "glue" the swf. Note that this function will call
|
|
1282
1300
|
* itself (using setTimeout) until it completes successfully
|
|
@@ -1285,13 +1303,13 @@ TableTools.prototype = {
|
|
|
1285
1303
|
* @param {Node} node node to glue swf to
|
|
1286
1304
|
* @param {String} text title of the flash movie
|
|
1287
1305
|
* @returns void
|
|
1288
|
-
* @private
|
|
1306
|
+
* @private
|
|
1289
1307
|
*/
|
|
1290
1308
|
"_fnFlashGlue": function ( flash, node, text )
|
|
1291
1309
|
{
|
|
1292
1310
|
var that = this;
|
|
1293
1311
|
var id = node.getAttribute('id');
|
|
1294
|
-
|
|
1312
|
+
|
|
1295
1313
|
if ( document.getElementById(id) )
|
|
1296
1314
|
{
|
|
1297
1315
|
flash.glue( node, text );
|
|
@@ -1303,62 +1321,62 @@ TableTools.prototype = {
|
|
|
1303
1321
|
}, 100 );
|
|
1304
1322
|
}
|
|
1305
1323
|
},
|
|
1306
|
-
|
|
1307
|
-
|
|
1324
|
+
|
|
1325
|
+
|
|
1308
1326
|
/**
|
|
1309
1327
|
* Set the text for the flash clip to deal with
|
|
1310
|
-
*
|
|
1311
|
-
* This function is required for large information sets. There is a limit on the
|
|
1312
|
-
* amount of data that can be
|
|
1328
|
+
*
|
|
1329
|
+
* This function is required for large information sets. There is a limit on the
|
|
1330
|
+
* amount of data that can be transferred between Javascript and Flash in a single call, so
|
|
1313
1331
|
* we use this method to build up the text in Flash by sending over chunks. It is estimated
|
|
1314
|
-
* that the data limit is around 64k, although it is
|
|
1332
|
+
* that the data limit is around 64k, although it is undocumented, and appears to be different
|
|
1315
1333
|
* between different flash versions. We chunk at 8KiB.
|
|
1316
1334
|
* @method _fnFlashSetText
|
|
1317
1335
|
* @param {Object} clip the ZeroClipboard object
|
|
1318
1336
|
* @param {String} sData the data to be set
|
|
1319
1337
|
* @returns void
|
|
1320
|
-
* @private
|
|
1338
|
+
* @private
|
|
1321
1339
|
*/
|
|
1322
1340
|
"_fnFlashSetText": function ( clip, sData )
|
|
1323
1341
|
{
|
|
1324
1342
|
var asData = this._fnChunkData( sData, 8192 );
|
|
1325
|
-
|
|
1343
|
+
|
|
1326
1344
|
clip.clearText();
|
|
1327
1345
|
for ( var i=0, iLen=asData.length ; i<iLen ; i++ )
|
|
1328
1346
|
{
|
|
1329
1347
|
clip.appendText( asData[i] );
|
|
1330
1348
|
}
|
|
1331
1349
|
},
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1350
|
+
|
|
1351
|
+
|
|
1352
|
+
|
|
1335
1353
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
1336
1354
|
* Data retrieval functions
|
|
1337
1355
|
*/
|
|
1338
|
-
|
|
1356
|
+
|
|
1339
1357
|
/**
|
|
1340
1358
|
* Convert the mixed columns variable into a boolean array the same size as the columns, which
|
|
1341
1359
|
* indicates which columns we want to include
|
|
1342
1360
|
* @method _fnColumnTargets
|
|
1343
|
-
* @param {String|Array} mColumns The columns to be included in data
|
|
1361
|
+
* @param {String|Array} mColumns The columns to be included in data retrieval. If a string
|
|
1344
1362
|
* then it can take the value of "visible" or "hidden" (to include all visible or
|
|
1345
1363
|
* hidden columns respectively). Or an array of column indexes
|
|
1346
1364
|
* @returns {Array} A boolean array the length of the columns of the table, which each value
|
|
1347
1365
|
* indicating if the column is to be included or not
|
|
1348
|
-
* @private
|
|
1366
|
+
* @private
|
|
1349
1367
|
*/
|
|
1350
1368
|
"_fnColumnTargets": function ( mColumns )
|
|
1351
1369
|
{
|
|
1352
1370
|
var aColumns = [];
|
|
1353
1371
|
var dt = this.s.dt;
|
|
1354
|
-
|
|
1372
|
+
|
|
1355
1373
|
if ( typeof mColumns == "object" )
|
|
1356
1374
|
{
|
|
1357
1375
|
for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ )
|
|
1358
1376
|
{
|
|
1359
1377
|
aColumns.push( false );
|
|
1360
1378
|
}
|
|
1361
|
-
|
|
1379
|
+
|
|
1362
1380
|
for ( i=0, iLen=mColumns.length ; i<iLen ; i++ )
|
|
1363
1381
|
{
|
|
1364
1382
|
aColumns[ mColumns[i] ] = true;
|
|
@@ -1392,11 +1410,11 @@ TableTools.prototype = {
|
|
|
1392
1410
|
aColumns.push( true );
|
|
1393
1411
|
}
|
|
1394
1412
|
}
|
|
1395
|
-
|
|
1413
|
+
|
|
1396
1414
|
return aColumns;
|
|
1397
1415
|
},
|
|
1398
|
-
|
|
1399
|
-
|
|
1416
|
+
|
|
1417
|
+
|
|
1400
1418
|
/**
|
|
1401
1419
|
* New line character(s) depend on the platforms
|
|
1402
1420
|
* @method method
|
|
@@ -1414,21 +1432,21 @@ TableTools.prototype = {
|
|
|
1414
1432
|
return oConfig.sNewLine;
|
|
1415
1433
|
}
|
|
1416
1434
|
},
|
|
1417
|
-
|
|
1418
|
-
|
|
1435
|
+
|
|
1436
|
+
|
|
1419
1437
|
/**
|
|
1420
1438
|
* Get data from DataTables' internals and format it for output
|
|
1421
1439
|
* @method _fnGetDataTablesData
|
|
1422
1440
|
* @param {Object} oConfig Button configuration object
|
|
1423
1441
|
* @param {String} oConfig.sFieldBoundary Field boundary for the data cells in the string
|
|
1424
|
-
* @param {String} oConfig.sFieldSeperator Field
|
|
1442
|
+
* @param {String} oConfig.sFieldSeperator Field separator for the data cells
|
|
1425
1443
|
* @param {String} oConfig.sNewline New line options
|
|
1426
1444
|
* @param {Mixed} oConfig.mColumns Which columns should be included in the output
|
|
1427
1445
|
* @param {Boolean} oConfig.bHeader Include the header
|
|
1428
1446
|
* @param {Boolean} oConfig.bFooter Include the footer
|
|
1429
1447
|
* @param {Boolean} oConfig.bSelectedOnly Include only the selected rows in the output
|
|
1430
|
-
* @returns {String}
|
|
1431
|
-
* @private
|
|
1448
|
+
* @returns {String} Concatenated string of data
|
|
1449
|
+
* @private
|
|
1432
1450
|
*/
|
|
1433
1451
|
"_fnGetDataTablesData": function ( oConfig )
|
|
1434
1452
|
{
|
|
@@ -1438,28 +1456,28 @@ TableTools.prototype = {
|
|
|
1438
1456
|
var regex = new RegExp(oConfig.sFieldBoundary, "g"); /* Do it here for speed */
|
|
1439
1457
|
var aColumnsInc = this._fnColumnTargets( oConfig.mColumns );
|
|
1440
1458
|
var bSelectedOnly = (typeof oConfig.bSelectedOnly != 'undefined') ? oConfig.bSelectedOnly : false;
|
|
1441
|
-
|
|
1459
|
+
|
|
1442
1460
|
/*
|
|
1443
1461
|
* Header
|
|
1444
1462
|
*/
|
|
1445
1463
|
if ( oConfig.bHeader )
|
|
1446
1464
|
{
|
|
1447
1465
|
aRow = [];
|
|
1448
|
-
|
|
1466
|
+
|
|
1449
1467
|
for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ )
|
|
1450
1468
|
{
|
|
1451
1469
|
if ( aColumnsInc[i] )
|
|
1452
1470
|
{
|
|
1453
1471
|
sLoopData = dt.aoColumns[i].sTitle.replace(/\n/g," ").replace( /<.*?>/g, "" ).replace(/^\s+|\s+$/g,"");
|
|
1454
1472
|
sLoopData = this._fnHtmlDecode( sLoopData );
|
|
1455
|
-
|
|
1473
|
+
|
|
1456
1474
|
aRow.push( this._fnBoundData( sLoopData, oConfig.sFieldBoundary, regex ) );
|
|
1457
1475
|
}
|
|
1458
1476
|
}
|
|
1459
1477
|
|
|
1460
1478
|
aData.push( aRow.join(oConfig.sFieldSeperator) );
|
|
1461
1479
|
}
|
|
1462
|
-
|
|
1480
|
+
|
|
1463
1481
|
/*
|
|
1464
1482
|
* Body
|
|
1465
1483
|
*/
|
|
@@ -1473,12 +1491,12 @@ TableTools.prototype = {
|
|
|
1473
1491
|
aDataIndex.push( dt.oInstance.fnGetPosition( aSelected[i] ) );
|
|
1474
1492
|
}
|
|
1475
1493
|
}
|
|
1476
|
-
|
|
1494
|
+
|
|
1477
1495
|
for ( j=0, jLen=aDataIndex.length ; j<jLen ; j++ )
|
|
1478
1496
|
{
|
|
1479
1497
|
tr = dt.aoData[ aDataIndex[j] ].nTr;
|
|
1480
1498
|
aRow = [];
|
|
1481
|
-
|
|
1499
|
+
|
|
1482
1500
|
/* Columns */
|
|
1483
1501
|
for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ )
|
|
1484
1502
|
{
|
|
@@ -1503,23 +1521,23 @@ TableTools.prototype = {
|
|
|
1503
1521
|
{
|
|
1504
1522
|
sLoopData = mTypeData+"";
|
|
1505
1523
|
}
|
|
1506
|
-
|
|
1524
|
+
|
|
1507
1525
|
/* Trim and clean the data */
|
|
1508
1526
|
sLoopData = sLoopData.replace(/^\s+/, '').replace(/\s+$/, '');
|
|
1509
1527
|
sLoopData = this._fnHtmlDecode( sLoopData );
|
|
1510
|
-
|
|
1528
|
+
|
|
1511
1529
|
/* Bound it and add it to the total data */
|
|
1512
1530
|
aRow.push( this._fnBoundData( sLoopData, oConfig.sFieldBoundary, regex ) );
|
|
1513
1531
|
}
|
|
1514
1532
|
}
|
|
1515
|
-
|
|
1533
|
+
|
|
1516
1534
|
aData.push( aRow.join(oConfig.sFieldSeperator) );
|
|
1517
|
-
|
|
1535
|
+
|
|
1518
1536
|
/* Details rows from fnOpen */
|
|
1519
1537
|
if ( oConfig.bOpenRows )
|
|
1520
1538
|
{
|
|
1521
1539
|
arr = $.grep(dt.aoOpenRows, function(o) { return o.nParent === tr; });
|
|
1522
|
-
|
|
1540
|
+
|
|
1523
1541
|
if ( arr.length === 1 )
|
|
1524
1542
|
{
|
|
1525
1543
|
sLoopData = this._fnBoundData( $('td', arr[0].nTr).html(), oConfig.sFieldBoundary, regex );
|
|
@@ -1527,42 +1545,42 @@ TableTools.prototype = {
|
|
|
1527
1545
|
}
|
|
1528
1546
|
}
|
|
1529
1547
|
}
|
|
1530
|
-
|
|
1548
|
+
|
|
1531
1549
|
/*
|
|
1532
1550
|
* Footer
|
|
1533
1551
|
*/
|
|
1534
1552
|
if ( oConfig.bFooter && dt.nTFoot !== null )
|
|
1535
1553
|
{
|
|
1536
1554
|
aRow = [];
|
|
1537
|
-
|
|
1555
|
+
|
|
1538
1556
|
for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ )
|
|
1539
1557
|
{
|
|
1540
1558
|
if ( aColumnsInc[i] && dt.aoColumns[i].nTf !== null )
|
|
1541
1559
|
{
|
|
1542
1560
|
sLoopData = dt.aoColumns[i].nTf.innerHTML.replace(/\n/g," ").replace( /<.*?>/g, "" );
|
|
1543
1561
|
sLoopData = this._fnHtmlDecode( sLoopData );
|
|
1544
|
-
|
|
1562
|
+
|
|
1545
1563
|
aRow.push( this._fnBoundData( sLoopData, oConfig.sFieldBoundary, regex ) );
|
|
1546
1564
|
}
|
|
1547
1565
|
}
|
|
1548
|
-
|
|
1566
|
+
|
|
1549
1567
|
aData.push( aRow.join(oConfig.sFieldSeperator) );
|
|
1550
1568
|
}
|
|
1551
|
-
|
|
1569
|
+
|
|
1552
1570
|
_sLastData = aData.join( this._fnNewline(oConfig) );
|
|
1553
1571
|
return _sLastData;
|
|
1554
1572
|
},
|
|
1555
|
-
|
|
1556
|
-
|
|
1573
|
+
|
|
1574
|
+
|
|
1557
1575
|
/**
|
|
1558
1576
|
* Wrap data up with a boundary string
|
|
1559
1577
|
* @method _fnBoundData
|
|
1560
1578
|
* @param {String} sData data to bound
|
|
1561
1579
|
* @param {String} sBoundary bounding char(s)
|
|
1562
|
-
* @param {RegExp} regex search for the bounding chars - constructed outside for
|
|
1580
|
+
* @param {RegExp} regex search for the bounding chars - constructed outside for efficiency
|
|
1563
1581
|
* in the loop
|
|
1564
1582
|
* @returns {String} bound data
|
|
1565
|
-
* @private
|
|
1583
|
+
* @private
|
|
1566
1584
|
*/
|
|
1567
1585
|
"_fnBoundData": function ( sData, sBoundary, regex )
|
|
1568
1586
|
{
|
|
@@ -1575,21 +1593,21 @@ TableTools.prototype = {
|
|
|
1575
1593
|
return sBoundary + sData.replace(regex, sBoundary+sBoundary) + sBoundary;
|
|
1576
1594
|
}
|
|
1577
1595
|
},
|
|
1578
|
-
|
|
1579
|
-
|
|
1596
|
+
|
|
1597
|
+
|
|
1580
1598
|
/**
|
|
1581
1599
|
* Break a string up into an array of smaller strings
|
|
1582
1600
|
* @method _fnChunkData
|
|
1583
1601
|
* @param {String} sData data to be broken up
|
|
1584
1602
|
* @param {Int} iSize chunk size
|
|
1585
1603
|
* @returns {Array} String array of broken up text
|
|
1586
|
-
* @private
|
|
1604
|
+
* @private
|
|
1587
1605
|
*/
|
|
1588
1606
|
"_fnChunkData": function ( sData, iSize )
|
|
1589
1607
|
{
|
|
1590
1608
|
var asReturn = [];
|
|
1591
1609
|
var iStrlen = sData.length;
|
|
1592
|
-
|
|
1610
|
+
|
|
1593
1611
|
for ( var i=0 ; i<iStrlen ; i+=iSize )
|
|
1594
1612
|
{
|
|
1595
1613
|
if ( i+iSize < iStrlen )
|
|
@@ -1601,17 +1619,17 @@ TableTools.prototype = {
|
|
|
1601
1619
|
asReturn.push( sData.substring( i, iStrlen ) );
|
|
1602
1620
|
}
|
|
1603
1621
|
}
|
|
1604
|
-
|
|
1622
|
+
|
|
1605
1623
|
return asReturn;
|
|
1606
1624
|
},
|
|
1607
|
-
|
|
1608
|
-
|
|
1625
|
+
|
|
1626
|
+
|
|
1609
1627
|
/**
|
|
1610
1628
|
* Decode HTML entities
|
|
1611
1629
|
* @method _fnHtmlDecode
|
|
1612
1630
|
* @param {String} sData encoded string
|
|
1613
1631
|
* @returns {String} decoded string
|
|
1614
|
-
* @private
|
|
1632
|
+
* @private
|
|
1615
1633
|
*/
|
|
1616
1634
|
"_fnHtmlDecode": function ( sData )
|
|
1617
1635
|
{
|
|
@@ -1619,13 +1637,13 @@ TableTools.prototype = {
|
|
|
1619
1637
|
{
|
|
1620
1638
|
return sData;
|
|
1621
1639
|
}
|
|
1622
|
-
|
|
1623
|
-
var
|
|
1640
|
+
|
|
1641
|
+
var
|
|
1624
1642
|
aData = this._fnChunkData( sData, 2048 ),
|
|
1625
1643
|
n = document.createElement('div'),
|
|
1626
1644
|
i, iLen, iIndex,
|
|
1627
1645
|
sReturn = "", sInner;
|
|
1628
|
-
|
|
1646
|
+
|
|
1629
1647
|
/* nodeValue has a limit in browsers - so we chunk the data into smaller segments to build
|
|
1630
1648
|
* up the string. Note that the 'trick' here is to remember than we might have split over
|
|
1631
1649
|
* an HTML entity, so we backtrack a little to make sure this doesn't happen
|
|
@@ -1639,36 +1657,36 @@ TableTools.prototype = {
|
|
|
1639
1657
|
sInner = aData[i].substr( iIndex );
|
|
1640
1658
|
aData[i] = aData[i].substr( 0, iIndex );
|
|
1641
1659
|
}
|
|
1642
|
-
|
|
1660
|
+
|
|
1643
1661
|
n.innerHTML = aData[i];
|
|
1644
1662
|
sReturn += n.childNodes[0].nodeValue;
|
|
1645
1663
|
}
|
|
1646
|
-
|
|
1664
|
+
|
|
1647
1665
|
return sReturn;
|
|
1648
1666
|
},
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1667
|
+
|
|
1668
|
+
|
|
1669
|
+
|
|
1652
1670
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
1653
1671
|
* Printing functions
|
|
1654
1672
|
*/
|
|
1655
|
-
|
|
1673
|
+
|
|
1656
1674
|
/**
|
|
1657
1675
|
* Show print display
|
|
1658
1676
|
* @method _fnPrintStart
|
|
1659
1677
|
* @param {Event} e Event object
|
|
1660
1678
|
* @param {Object} oConfig Button configuration object
|
|
1661
1679
|
* @returns void
|
|
1662
|
-
* @private
|
|
1680
|
+
* @private
|
|
1663
1681
|
*/
|
|
1664
1682
|
"_fnPrintStart": function ( oConfig )
|
|
1665
1683
|
{
|
|
1666
1684
|
var that = this;
|
|
1667
1685
|
var oSetDT = this.s.dt;
|
|
1668
|
-
|
|
1686
|
+
|
|
1669
1687
|
/* Parse through the DOM hiding everything that isn't needed for the table */
|
|
1670
1688
|
this._fnPrintHideNodes( oSetDT.nTable );
|
|
1671
|
-
|
|
1689
|
+
|
|
1672
1690
|
/* Show the whole table */
|
|
1673
1691
|
this.s.print.saveStart = oSetDT._iDisplayStart;
|
|
1674
1692
|
this.s.print.saveLength = oSetDT._iDisplayLength;
|
|
@@ -1680,13 +1698,13 @@ TableTools.prototype = {
|
|
|
1680
1698
|
oSetDT.oApi._fnCalculateEnd( oSetDT );
|
|
1681
1699
|
oSetDT.oApi._fnDraw( oSetDT );
|
|
1682
1700
|
}
|
|
1683
|
-
|
|
1701
|
+
|
|
1684
1702
|
/* Adjust the display for scrolling which might be done by DataTables */
|
|
1685
1703
|
if ( oSetDT.oScroll.sX !== "" || oSetDT.oScroll.sY !== "" )
|
|
1686
1704
|
{
|
|
1687
1705
|
this._fnPrintScrollStart( oSetDT );
|
|
1688
1706
|
}
|
|
1689
|
-
|
|
1707
|
+
|
|
1690
1708
|
/* Remove the other DataTables feature nodes - but leave the table! and info div */
|
|
1691
1709
|
var anFeature = oSetDT.aanFeatures;
|
|
1692
1710
|
for ( var cFeature in anFeature )
|
|
@@ -1703,7 +1721,7 @@ TableTools.prototype = {
|
|
|
1703
1721
|
}
|
|
1704
1722
|
}
|
|
1705
1723
|
}
|
|
1706
|
-
|
|
1724
|
+
|
|
1707
1725
|
/* Print class can be used for styling */
|
|
1708
1726
|
$(document.body).addClass( this.classes.print.body );
|
|
1709
1727
|
|
|
@@ -1721,8 +1739,8 @@ TableTools.prototype = {
|
|
|
1721
1739
|
this.dom.print.message.innerHTML = oConfig.sMessage;
|
|
1722
1740
|
document.body.insertBefore( this.dom.print.message, document.body.childNodes[0] );
|
|
1723
1741
|
}
|
|
1724
|
-
|
|
1725
|
-
/* Cache the scrolling and the jump to the top of the
|
|
1742
|
+
|
|
1743
|
+
/* Cache the scrolling and the jump to the top of the page */
|
|
1726
1744
|
this.s.print.saveScroll = $(window).scrollTop();
|
|
1727
1745
|
window.scrollTo( 0, 0 );
|
|
1728
1746
|
|
|
@@ -1738,14 +1756,14 @@ TableTools.prototype = {
|
|
|
1738
1756
|
}
|
|
1739
1757
|
} );
|
|
1740
1758
|
},
|
|
1741
|
-
|
|
1742
|
-
|
|
1759
|
+
|
|
1760
|
+
|
|
1743
1761
|
/**
|
|
1744
1762
|
* Printing is finished, resume normal display
|
|
1745
1763
|
* @method _fnPrintEnd
|
|
1746
1764
|
* @param {Event} e Event object
|
|
1747
1765
|
* @returns void
|
|
1748
|
-
* @private
|
|
1766
|
+
* @private
|
|
1749
1767
|
*/
|
|
1750
1768
|
"_fnPrintEnd": function ( e )
|
|
1751
1769
|
{
|
|
@@ -1753,47 +1771,47 @@ TableTools.prototype = {
|
|
|
1753
1771
|
var oSetDT = this.s.dt;
|
|
1754
1772
|
var oSetPrint = this.s.print;
|
|
1755
1773
|
var oDomPrint = this.dom.print;
|
|
1756
|
-
|
|
1774
|
+
|
|
1757
1775
|
/* Show all hidden nodes */
|
|
1758
1776
|
this._fnPrintShowNodes();
|
|
1759
|
-
|
|
1777
|
+
|
|
1760
1778
|
/* Restore DataTables' scrolling */
|
|
1761
1779
|
if ( oSetDT.oScroll.sX !== "" || oSetDT.oScroll.sY !== "" )
|
|
1762
1780
|
{
|
|
1763
1781
|
this._fnPrintScrollEnd();
|
|
1764
1782
|
}
|
|
1765
|
-
|
|
1783
|
+
|
|
1766
1784
|
/* Restore the scroll */
|
|
1767
1785
|
window.scrollTo( 0, oSetPrint.saveScroll );
|
|
1768
|
-
|
|
1786
|
+
|
|
1769
1787
|
/* Drop the print message */
|
|
1770
1788
|
if ( oDomPrint.message !== null )
|
|
1771
1789
|
{
|
|
1772
1790
|
document.body.removeChild( oDomPrint.message );
|
|
1773
1791
|
oDomPrint.message = null;
|
|
1774
1792
|
}
|
|
1775
|
-
|
|
1793
|
+
|
|
1776
1794
|
/* Styling class */
|
|
1777
1795
|
$(document.body).removeClass( 'DTTT_Print' );
|
|
1778
|
-
|
|
1796
|
+
|
|
1779
1797
|
/* Restore the table length */
|
|
1780
1798
|
oSetDT._iDisplayStart = oSetPrint.saveStart;
|
|
1781
1799
|
oSetDT._iDisplayLength = oSetPrint.saveLength;
|
|
1782
1800
|
oSetDT.oApi._fnCalculateEnd( oSetDT );
|
|
1783
1801
|
oSetDT.oApi._fnDraw( oSetDT );
|
|
1784
|
-
|
|
1802
|
+
|
|
1785
1803
|
$(document).unbind( "keydown.DTTT" );
|
|
1786
1804
|
},
|
|
1787
|
-
|
|
1788
|
-
|
|
1805
|
+
|
|
1806
|
+
|
|
1789
1807
|
/**
|
|
1790
1808
|
* Take account of scrolling in DataTables by showing the full table
|
|
1791
1809
|
* @returns void
|
|
1792
|
-
* @private
|
|
1810
|
+
* @private
|
|
1793
1811
|
*/
|
|
1794
1812
|
"_fnPrintScrollStart": function ()
|
|
1795
1813
|
{
|
|
1796
|
-
var
|
|
1814
|
+
var
|
|
1797
1815
|
oSetDT = this.s.dt,
|
|
1798
1816
|
nScrollHeadInner = oSetDT.nScrollHead.getElementsByTagName('div')[0],
|
|
1799
1817
|
nScrollHeadTable = nScrollHeadInner.getElementsByTagName('table')[0],
|
|
@@ -1807,7 +1825,7 @@ TableTools.prototype = {
|
|
|
1807
1825
|
{
|
|
1808
1826
|
oSetDT.nTable.removeChild( nTheadSize[0] );
|
|
1809
1827
|
}
|
|
1810
|
-
|
|
1828
|
+
|
|
1811
1829
|
if ( oSetDT.nTFoot !== null )
|
|
1812
1830
|
{
|
|
1813
1831
|
var nTfootSize = oSetDT.nTable.getElementsByTagName('tfoot');
|
|
@@ -1816,16 +1834,16 @@ TableTools.prototype = {
|
|
|
1816
1834
|
oSetDT.nTable.removeChild( nTfootSize[0] );
|
|
1817
1835
|
}
|
|
1818
1836
|
}
|
|
1819
|
-
|
|
1837
|
+
|
|
1820
1838
|
nTheadSize = oSetDT.nTHead.cloneNode(true);
|
|
1821
1839
|
oSetDT.nTable.insertBefore( nTheadSize, oSetDT.nTable.childNodes[0] );
|
|
1822
|
-
|
|
1840
|
+
|
|
1823
1841
|
if ( oSetDT.nTFoot !== null )
|
|
1824
1842
|
{
|
|
1825
1843
|
nTfootSize = oSetDT.nTFoot.cloneNode(true);
|
|
1826
1844
|
oSetDT.nTable.insertBefore( nTfootSize, oSetDT.nTable.childNodes[1] );
|
|
1827
1845
|
}
|
|
1828
|
-
|
|
1846
|
+
|
|
1829
1847
|
/* Now adjust the table's viewport so we can actually see it */
|
|
1830
1848
|
if ( oSetDT.oScroll.sX !== "" )
|
|
1831
1849
|
{
|
|
@@ -1833,71 +1851,71 @@ TableTools.prototype = {
|
|
|
1833
1851
|
nScrollBody.style.width = $(oSetDT.nTable).outerWidth()+"px";
|
|
1834
1852
|
nScrollBody.style.overflow = "visible";
|
|
1835
1853
|
}
|
|
1836
|
-
|
|
1854
|
+
|
|
1837
1855
|
if ( oSetDT.oScroll.sY !== "" )
|
|
1838
1856
|
{
|
|
1839
1857
|
nScrollBody.style.height = $(oSetDT.nTable).outerHeight()+"px";
|
|
1840
1858
|
nScrollBody.style.overflow = "visible";
|
|
1841
1859
|
}
|
|
1842
1860
|
},
|
|
1843
|
-
|
|
1844
|
-
|
|
1861
|
+
|
|
1862
|
+
|
|
1845
1863
|
/**
|
|
1846
1864
|
* Take account of scrolling in DataTables by showing the full table. Note that the redraw of
|
|
1847
|
-
* the DataTable that we do will actually deal with the majority of the
|
|
1865
|
+
* the DataTable that we do will actually deal with the majority of the hard work here
|
|
1848
1866
|
* @returns void
|
|
1849
|
-
* @private
|
|
1867
|
+
* @private
|
|
1850
1868
|
*/
|
|
1851
1869
|
"_fnPrintScrollEnd": function ()
|
|
1852
1870
|
{
|
|
1853
|
-
var
|
|
1871
|
+
var
|
|
1854
1872
|
oSetDT = this.s.dt,
|
|
1855
1873
|
nScrollBody = oSetDT.nTable.parentNode;
|
|
1856
|
-
|
|
1874
|
+
|
|
1857
1875
|
if ( oSetDT.oScroll.sX !== "" )
|
|
1858
1876
|
{
|
|
1859
1877
|
nScrollBody.style.width = oSetDT.oApi._fnStringToCss( oSetDT.oScroll.sX );
|
|
1860
1878
|
nScrollBody.style.overflow = "auto";
|
|
1861
1879
|
}
|
|
1862
|
-
|
|
1880
|
+
|
|
1863
1881
|
if ( oSetDT.oScroll.sY !== "" )
|
|
1864
1882
|
{
|
|
1865
1883
|
nScrollBody.style.height = oSetDT.oApi._fnStringToCss( oSetDT.oScroll.sY );
|
|
1866
1884
|
nScrollBody.style.overflow = "auto";
|
|
1867
1885
|
}
|
|
1868
1886
|
},
|
|
1869
|
-
|
|
1870
|
-
|
|
1887
|
+
|
|
1888
|
+
|
|
1871
1889
|
/**
|
|
1872
1890
|
* Resume the display of all TableTools hidden nodes
|
|
1873
1891
|
* @method _fnPrintShowNodes
|
|
1874
1892
|
* @returns void
|
|
1875
|
-
* @private
|
|
1893
|
+
* @private
|
|
1876
1894
|
*/
|
|
1877
1895
|
"_fnPrintShowNodes": function ( )
|
|
1878
1896
|
{
|
|
1879
1897
|
var anHidden = this.dom.print.hidden;
|
|
1880
|
-
|
|
1898
|
+
|
|
1881
1899
|
for ( var i=0, iLen=anHidden.length ; i<iLen ; i++ )
|
|
1882
1900
|
{
|
|
1883
1901
|
anHidden[i].node.style.display = anHidden[i].display;
|
|
1884
1902
|
}
|
|
1885
1903
|
anHidden.splice( 0, anHidden.length );
|
|
1886
1904
|
},
|
|
1887
|
-
|
|
1888
|
-
|
|
1905
|
+
|
|
1906
|
+
|
|
1889
1907
|
/**
|
|
1890
1908
|
* Hide nodes which are not needed in order to display the table. Note that this function is
|
|
1891
1909
|
* recursive
|
|
1892
1910
|
* @method _fnPrintHideNodes
|
|
1893
1911
|
* @param {Node} nNode Element which should be showing in a 'print' display
|
|
1894
1912
|
* @returns void
|
|
1895
|
-
* @private
|
|
1913
|
+
* @private
|
|
1896
1914
|
*/
|
|
1897
1915
|
"_fnPrintHideNodes": function ( nNode )
|
|
1898
1916
|
{
|
|
1899
1917
|
var anHidden = this.dom.print.hidden;
|
|
1900
|
-
|
|
1918
|
+
|
|
1901
1919
|
var nParent = nNode.parentNode;
|
|
1902
1920
|
var nChildren = nParent.childNodes;
|
|
1903
1921
|
for ( var i=0, iLen=nChildren.length ; i<iLen ; i++ )
|
|
@@ -1917,7 +1935,7 @@ TableTools.prototype = {
|
|
|
1917
1935
|
}
|
|
1918
1936
|
}
|
|
1919
1937
|
}
|
|
1920
|
-
|
|
1938
|
+
|
|
1921
1939
|
if ( nParent.nodeName != "BODY" )
|
|
1922
1940
|
{
|
|
1923
1941
|
this._fnPrintHideNodes( nParent );
|
|
@@ -1987,7 +2005,7 @@ TableTools.fnGetInstance = function ( node )
|
|
|
1987
2005
|
{
|
|
1988
2006
|
node = document.getElementById(node);
|
|
1989
2007
|
}
|
|
1990
|
-
|
|
2008
|
+
|
|
1991
2009
|
for ( var i=0, iLen=TableTools._aInstances.length ; i<iLen ; i++ )
|
|
1992
2010
|
{
|
|
1993
2011
|
if ( TableTools._aInstances[i].s.master && TableTools._aInstances[i].dom.table == node )
|
|
@@ -2017,15 +2035,15 @@ TableTools._fnEventListen = function ( that, type, fn )
|
|
|
2017
2035
|
"fn": fn
|
|
2018
2036
|
} );
|
|
2019
2037
|
};
|
|
2020
|
-
|
|
2038
|
+
|
|
2021
2039
|
|
|
2022
2040
|
/**
|
|
2023
|
-
* An event has
|
|
2041
|
+
* An event has occurred - look up every listener and fire it off. We check that the event we are
|
|
2024
2042
|
* going to fire is attached to the same table (using the table node as reference) before firing
|
|
2025
2043
|
* @method _fnEventDispatch
|
|
2026
2044
|
* @param {Object} that Scope of the listening function (i.e. 'this' in the caller)
|
|
2027
2045
|
* @param {String} type Event type
|
|
2028
|
-
* @param {Node} node Element that the event
|
|
2046
|
+
* @param {Node} node Element that the event occurred on (may be null)
|
|
2029
2047
|
* @returns void
|
|
2030
2048
|
* @private
|
|
2031
2049
|
* @static
|
|
@@ -2142,7 +2160,7 @@ TableTools.BUTTONS = {
|
|
|
2142
2160
|
"sPdfSize": "A4",
|
|
2143
2161
|
"sPdfMessage": "",
|
|
2144
2162
|
"fnClick": function( nButton, oConfig, flash ) {
|
|
2145
|
-
this.fnSetText( flash,
|
|
2163
|
+
this.fnSetText( flash,
|
|
2146
2164
|
"title:"+ this.fnGetTitle(oConfig) +"\n"+
|
|
2147
2165
|
"message:"+ oConfig.sPdfMessage +"\n"+
|
|
2148
2166
|
"colWidth:"+ this.fnCalcColRatios(oConfig) +"\n"+
|
|
@@ -2241,7 +2259,7 @@ TableTools.BUTTONS = {
|
|
|
2241
2259
|
],
|
|
2242
2260
|
"success": oConfig.fnAjaxComplete,
|
|
2243
2261
|
"dataType": "json",
|
|
2244
|
-
"type": "POST",
|
|
2262
|
+
"type": "POST",
|
|
2245
2263
|
"cache": false,
|
|
2246
2264
|
"error": function () {
|
|
2247
2265
|
alert( "Error detected when sending table data to server" );
|
|
@@ -2280,7 +2298,7 @@ TableTools.BUTTONS = {
|
|
|
2280
2298
|
|
|
2281
2299
|
|
|
2282
2300
|
/**
|
|
2283
|
-
* @namespace Classes used by TableTools - allows the styles to be
|
|
2301
|
+
* @namespace Classes used by TableTools - allows the styles to be override easily.
|
|
2284
2302
|
* Note that when TableTools initialises it will take a copy of the classes object
|
|
2285
2303
|
* and will use its internal copy for the remainder of its run time.
|
|
2286
2304
|
*/
|
|
@@ -2311,7 +2329,7 @@ TableTools.classes = {
|
|
|
2311
2329
|
|
|
2312
2330
|
|
|
2313
2331
|
/**
|
|
2314
|
-
* @namespace ThemeRoller classes - built in for
|
|
2332
|
+
* @namespace ThemeRoller classes - built in for compatibility with DataTables'
|
|
2315
2333
|
* bJQueryUI option.
|
|
2316
2334
|
*/
|
|
2317
2335
|
TableTools.classes_themeroller = {
|
|
@@ -2329,7 +2347,7 @@ TableTools.classes_themeroller = {
|
|
|
2329
2347
|
* @namespace TableTools default settings for initialisation
|
|
2330
2348
|
*/
|
|
2331
2349
|
TableTools.DEFAULTS = {
|
|
2332
|
-
"sSwfPath": "
|
|
2350
|
+
"sSwfPath": "/assets/dataTables/extras/swf/copy_csv_xls_pdf.swf",
|
|
2333
2351
|
"sRowSelect": "none",
|
|
2334
2352
|
"sSelectedClass": null,
|
|
2335
2353
|
"fnPreRowSelect": null,
|
|
@@ -2365,7 +2383,7 @@ TableTools.prototype.CLASS = "TableTools";
|
|
|
2365
2383
|
* @type String
|
|
2366
2384
|
* @default See code
|
|
2367
2385
|
*/
|
|
2368
|
-
TableTools.VERSION = "2.1.
|
|
2386
|
+
TableTools.VERSION = "2.1.3";
|
|
2369
2387
|
TableTools.prototype.VERSION = TableTools.VERSION;
|
|
2370
2388
|
|
|
2371
2389
|
|
|
@@ -2384,12 +2402,12 @@ if ( typeof $.fn.dataTable == "function" &&
|
|
|
2384
2402
|
{
|
|
2385
2403
|
$.fn.dataTableExt.aoFeatures.push( {
|
|
2386
2404
|
"fnInit": function( oDTSettings ) {
|
|
2387
|
-
var oOpts = typeof oDTSettings.oInit.oTableTools != 'undefined' ?
|
|
2405
|
+
var oOpts = typeof oDTSettings.oInit.oTableTools != 'undefined' ?
|
|
2388
2406
|
oDTSettings.oInit.oTableTools : {};
|
|
2389
|
-
|
|
2407
|
+
|
|
2390
2408
|
var oTT = new TableTools( oDTSettings.oInstance, oOpts );
|
|
2391
2409
|
TableTools._aInstances.push( oTT );
|
|
2392
|
-
|
|
2410
|
+
|
|
2393
2411
|
return oTT.dom.container;
|
|
2394
2412
|
},
|
|
2395
2413
|
"cFeature": "T",
|
|
@@ -2403,4 +2421,4 @@ else
|
|
|
2403
2421
|
|
|
2404
2422
|
$.fn.DataTable.TableTools = TableTools;
|
|
2405
2423
|
|
|
2406
|
-
})(jQuery, window, document);
|
|
2424
|
+
})(jQuery, window, document);
|