Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Including TableTools media files and asset pipeline

Added the /media folder for the TableTools plugin, and corrected the
css, js and swf paths and references to allow to be used in the rails
pipeline.
  • Loading branch information...
commit 7c8c7d8ae6b1c3b60562b55298ddf6ec75189bac 1 parent 8bf2cc7
@superscott superscott authored
Showing with 1,486 additions and 351 deletions.
  1. 0  Gemfile
  2. 0  LICENSE
  3. 0  Rakefile
  4. 0  Readme.md
  5. +12 −9 jquery-datatables-rails.gemspec
  6. 0  lib/jquery-datatables-rails.rb
  7. 0  lib/jquery/datatables/rails/engine.rb
  8. +1 −1  lib/jquery/datatables/rails/version.rb
  9. 0  vendor/assets/images/dataTables/back_disabled.png
  10. 0  vendor/assets/images/dataTables/back_enabled.png
  11. 0  vendor/assets/images/dataTables/back_enabled_hover.png
  12. BIN  vendor/assets/images/dataTables/extras/background.png
  13. BIN  vendor/assets/images/dataTables/extras/collection.png
  14. BIN  vendor/assets/images/dataTables/extras/collection_hover.png
  15. BIN  vendor/assets/images/dataTables/extras/copy.png
  16. BIN  vendor/assets/images/dataTables/extras/copy_hover.png
  17. BIN  vendor/assets/images/dataTables/extras/csv.png
  18. BIN  vendor/assets/images/dataTables/extras/csv_hover.png
  19. BIN  vendor/assets/images/dataTables/extras/pdf.png
  20. BIN  vendor/assets/images/dataTables/extras/pdf_hover.png
  21. BIN  vendor/assets/images/dataTables/extras/print.png
  22. BIN  vendor/assets/images/dataTables/extras/print_hover.png
  23. BIN  vendor/assets/images/dataTables/extras/xls.png
  24. BIN  vendor/assets/images/dataTables/extras/xls_hover.png
  25. 0  vendor/assets/images/dataTables/favicon.ico
  26. 0  vendor/assets/images/dataTables/forward_disabled.png
  27. 0  vendor/assets/images/dataTables/forward_enabled.png
  28. 0  vendor/assets/images/dataTables/forward_enabled_hover.png
  29. 0  vendor/assets/images/dataTables/sort_asc.png
  30. 0  vendor/assets/images/dataTables/sort_asc_disabled.png
  31. 0  vendor/assets/images/dataTables/sort_both.png
  32. 0  vendor/assets/images/dataTables/sort_desc.png
  33. 0  vendor/assets/images/dataTables/sort_desc_disabled.png
  34. 0  vendor/assets/javascripts/dataTables/extras/AutoFill.js
  35. 0  vendor/assets/javascripts/dataTables/extras/ColReorder.js
  36. 0  vendor/assets/javascripts/dataTables/extras/ColVis.js
  37. 0  vendor/assets/javascripts/dataTables/extras/FixedColumns.js
  38. 0  vendor/assets/javascripts/dataTables/extras/FixedHeader.js
  39. 0  vendor/assets/javascripts/dataTables/extras/KeyTable.js
  40. 0  vendor/assets/javascripts/dataTables/extras/Scroller.js
  41. +320 −302 vendor/assets/javascripts/dataTables/extras/TableTools.js
  42. +76 −0 vendor/assets/javascripts/dataTables/extras/TableTools.min.js
  43. +2 −2 vendor/assets/javascripts/dataTables/extras/ZeroClipboard.js
  44. 0  vendor/assets/javascripts/dataTables/jquery.dataTables.api.fnGetColumnData.js
  45. 0  vendor/assets/javascripts/dataTables/jquery.dataTables.api.fnReloadAjax.js
  46. 0  vendor/assets/javascripts/dataTables/jquery.dataTables.bootstrap.js
  47. 0  vendor/assets/javascripts/dataTables/jquery.dataTables.js
  48. 0  vendor/assets/javascripts/dataTables/jquery.dataTables.sorting.numbersHtml.js
  49. 0  vendor/assets/javascripts/dataTables/jquery.dataTables.typeDetection.numbersHtml.js
  50. +221 −0 vendor/assets/media/dataTables/extras/as3/ZeroClipboard.as
  51. +310 −0 vendor/assets/media/dataTables/extras/as3/ZeroClipboardPdf.as
  52. BIN  vendor/assets/media/dataTables/extras/as3/lib/AlivePDF.swc
  53. BIN  vendor/assets/media/dataTables/extras/swf/copy_csv_xls.swf
  54. BIN  vendor/assets/media/dataTables/extras/swf/copy_csv_xls_pdf.swf
  55. +314 −0 vendor/assets/stylesheets/dataTables/extras/TableTools.css
  56. +185 −0 vendor/assets/stylesheets/dataTables/extras/TableTools_JUI.css
  57. 0  vendor/assets/stylesheets/dataTables/jquery.dataTables.bootstrap.css.scss
  58. +11 −11 vendor/assets/stylesheets/dataTables/jquery.dataTables.css.scss
  59. 0  vendor/assets/stylesheets/dataTables/src/demo_page.css
  60. +11 −11 vendor/assets/stylesheets/dataTables/src/demo_table.css
  61. +17 −9 vendor/assets/stylesheets/dataTables/src/demo_table_jui.css
  62. +6 −6 vendor/assets/stylesheets/dataTables/src/jquery.dataTables_themeroller.css
View
0  Gemfile 100644 → 100755
File mode changed
View
0  LICENSE 100644 → 100755
File mode changed
View
0  Rakefile 100644 → 100755
File mode changed
View
0  Readme.md 100644 → 100755
File mode changed
View
21 jquery-datatables-rails.gemspec 100644 → 100755
@@ -3,18 +3,21 @@ $:.push File.expand_path("../lib", __FILE__)
require "jquery/datatables/rails/version"
Gem::Specification.new do |s|
- s.name = "jquery-datatables-rails"
- s.version = Jquery::Datatables::Rails::VERSION
- s.authors = ["Robin Wenglewski"]
- s.email = ["robin@wenglewski.de"]
- s.homepage = "https://github.com/rweng/jquery-datatables-rails"
- s.summary = %q{jquery datatables for rails}
+ s.name = "jquery-datatables-rails"
+ s.version = Jquery::Datatables::Rails::VERSION
+ s.authors = ["Robin Wenglewski"]
+ s.email = ["robin@wenglewski.de"]
+ s.homepage = "https://github.com/rweng/jquery-datatables-rails"
+ s.summary = %q{jquery datatables for rails}
s.description = %q{}
- s.files = `git ls-files`.split("\n")
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.files = `git ls-files`.split("\n")
+ s.files = Dir["{lib,vendor}/**/*"]
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
s.add_dependency "jquery-rails"
end
+
+
View
0  lib/jquery-datatables-rails.rb 100644 → 100755
File mode changed
View
0  lib/jquery/datatables/rails/engine.rb 100644 → 100755
File mode changed
View
2  lib/jquery/datatables/rails/version.rb 100644 → 100755
@@ -1,7 +1,7 @@
module Jquery
module Datatables
module Rails
- VERSION = "1.11.0"
+ VERSION = "1.11.1"
end
end
end
View
0  vendor/assets/images/dataTables/back_disabled.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  vendor/assets/images/dataTables/back_enabled.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  vendor/assets/images/dataTables/back_enabled_hover.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/images/dataTables/extras/background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/images/dataTables/extras/collection.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/images/dataTables/extras/collection_hover.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/images/dataTables/extras/copy.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/images/dataTables/extras/copy_hover.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/images/dataTables/extras/csv.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/images/dataTables/extras/csv_hover.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/images/dataTables/extras/pdf.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/images/dataTables/extras/pdf_hover.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/images/dataTables/extras/print.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/images/dataTables/extras/print_hover.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/images/dataTables/extras/xls.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/images/dataTables/extras/xls_hover.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  vendor/assets/images/dataTables/favicon.ico 100644 → 100755
File mode changed
View
0  vendor/assets/images/dataTables/forward_disabled.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  vendor/assets/images/dataTables/forward_enabled.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  vendor/assets/images/dataTables/forward_enabled_hover.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  vendor/assets/images/dataTables/sort_asc.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  vendor/assets/images/dataTables/sort_asc_disabled.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  vendor/assets/images/dataTables/sort_both.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  vendor/assets/images/dataTables/sort_desc.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  vendor/assets/images/dataTables/sort_desc_disabled.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  vendor/assets/javascripts/dataTables/extras/AutoFill.js 100644 → 100755
File mode changed
View
0  vendor/assets/javascripts/dataTables/extras/ColReorder.js 100644 → 100755
File mode changed
View
0  vendor/assets/javascripts/dataTables/extras/ColVis.js 100644 → 100755
File mode changed
View
0  vendor/assets/javascripts/dataTables/extras/FixedColumns.js 100644 → 100755
File mode changed
View
0  vendor/assets/javascripts/dataTables/extras/FixedHeader.js 100644 → 100755
File mode changed
View
0  vendor/assets/javascripts/dataTables/extras/KeyTable.js 100644 → 100755
File mode changed
View
0  vendor/assets/javascripts/dataTables/extras/Scroller.js 100644 → 100755
File mode changed
View
622 vendor/assets/javascripts/dataTables/extras/TableTools.js 100644 → 100755
@@ -1,12 +1,12 @@
/*
* File: TableTools.js
- * Version: 2.1.2
+ * Version: 2.1.3
* Description: Tools and buttons for DataTables
* Author: Allan Jardine (www.sprymedia.co.uk)
* Language: Javascript
* License: GPL v2 or BSD 3 point style
* Project: DataTables
- *
+ *
* Copyright 2009-2012 Allan Jardine, all rights reserved.
*
* This source file is free software, under either the GPL v2 license or a
@@ -20,7 +20,7 @@ var TableTools;
(function($, window, document) {
-/**
+/**
* TableTools provides flexible buttons and other tools for a DataTables enhanced table
* @class TableTools
* @constructor
@@ -40,61 +40,61 @@ TableTools = function( oDT, oOpts )
{
alert( "Warning: TableTools must be initialised with the keyword 'new'" );
}
-
-
+
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public class variables
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
+
/**
* @namespace Settings object which contains customisable information for TableTools instance
*/
this.s = {
/**
- * Store 'this' so the instance can be retreieved from the settings object
+ * Store 'this' so the instance can be retrieved from the settings object
* @property that
* @type object
* @default this
*/
"that": this,
-
- /**
+
+ /**
* DataTables settings objects
* @property dt
* @type object
* @default <i>From the oDT init option</i>
*/
"dt": oDT.fnSettings(),
-
+
/**
* @namespace Print specific information
*/
"print": {
- /**
+ /**
* DataTables draw 'start' point before the printing display was shown
* @property saveStart
* @type int
* @default -1
*/
"saveStart": -1,
-
- /**
+
+ /**
* DataTables draw 'length' point before the printing display was shown
* @property saveLength
* @type int
* @default -1
*/
"saveLength": -1,
-
- /**
+
+ /**
* Page scrolling point before the printing display was shown so it can be restored
* @property saveScroll
* @type int
* @default -1
*/
"saveScroll": -1,
-
- /**
+
+ /**
* Wrapped function to end the print display (to maintain scope)
* @property funcEnd
* @type Function
@@ -102,7 +102,7 @@ TableTools = function( oDT, oOpts )
*/
"funcEnd": function () {}
},
-
+
/**
* A unique ID is assigned to each button in each instance
* @property buttonCounter
@@ -110,7 +110,7 @@ TableTools = function( oDT, oOpts )
* @default 0
*/
"buttonCounter": 0,
-
+
/**
* @namespace Select rows specific information
*/
@@ -122,7 +122,7 @@ TableTools = function( oDT, oOpts )
* @default ""
*/
"type": "",
-
+
/**
* Array of nodes which are currently selected
* @property selected
@@ -130,7 +130,7 @@ TableTools = function( oDT, oOpts )
* @default []
*/
"selected": [],
-
+
/**
* Function to run before the selection can take place. Will cancel the select if the
* function returns false
@@ -139,7 +139,7 @@ TableTools = function( oDT, oOpts )
* @default null
*/
"preRowSelect": null,
-
+
/**
* Function to run when a row is selected
* @property postSelected
@@ -147,7 +147,7 @@ TableTools = function( oDT, oOpts )
* @default null
*/
"postSelected": null,
-
+
/**
* Function to run when a row is deselected
* @property postDeselected
@@ -155,7 +155,7 @@ TableTools = function( oDT, oOpts )
* @default null
*/
"postDeselected": null,
-
+
/**
* Indicate if all rows are selected (needed for server-side processing)
* @property all
@@ -163,7 +163,7 @@ TableTools = function( oDT, oOpts )
* @default false
*/
"all": false,
-
+
/**
* Class name to add to selected TR nodes
* @property selectedClass
@@ -172,7 +172,7 @@ TableTools = function( oDT, oOpts )
*/
"selectedClass": ""
},
-
+
/**
* Store of the user input customisation object
* @property custom
@@ -180,7 +180,7 @@ TableTools = function( oDT, oOpts )
* @default {}
*/
"custom": {},
-
+
/**
* SWF movie path
* @property swfPath
@@ -188,7 +188,7 @@ TableTools = function( oDT, oOpts )
* @default ""
*/
"swfPath": "",
-
+
/**
* Default button set
* @property buttonSet
@@ -196,24 +196,24 @@ TableTools = function( oDT, oOpts )
* @default []
*/
"buttonSet": [],
-
+
/**
- * When there is more than one TableTools instance for a DataTable, there must be a
+ * When there is more than one TableTools instance for a DataTable, there must be a
* master which controls events (row selection etc)
* @property master
* @type boolean
* @default false
*/
"master": false,
-
+
/**
* Tag names that are used for creating collections and buttons
* @namesapce
*/
"tags": {}
};
-
-
+
+
/**
* @namespace Common and useful DOM elements for the class instance
*/
@@ -225,7 +225,7 @@ TableTools = function( oDT, oOpts )
* @default null
*/
"container": null,
-
+
/**
* The table node to which TableTools will be applied
* @property table
@@ -233,7 +233,7 @@ TableTools = function( oDT, oOpts )
* @default null
*/
"table": null,
-
+
/**
* @namespace Nodes used for the print display
*/
@@ -245,16 +245,16 @@ TableTools = function( oDT, oOpts )
* @default []
*/
"hidden": [],
-
+
/**
- * The information display saying tellng the user about the print display
+ * The information display saying telling the user about the print display
* @property message
* @type node
* @default null
*/
"message": null
},
-
+
/**
* @namespace Nodes used for a collection display. This contains the currently used collection
*/
@@ -266,7 +266,7 @@ TableTools = function( oDT, oOpts )
* @default null
*/
"collection": null,
-
+
/**
* Background display to provide focus and capture events
* @property background
@@ -286,12 +286,12 @@ TableTools = function( oDT, oOpts )
{
$.extend( true, this.classes, TableTools.classes_themeroller );
}
-
-
+
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public class methods
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
+
/**
* Retreieve the settings object from an instance
* @method fnSettings
@@ -300,16 +300,16 @@ TableTools = function( oDT, oOpts )
this.fnSettings = function () {
return this.s;
};
-
-
+
+
/* Constructor logic */
if ( typeof oOpts == 'undefined' )
{
oOpts = {};
}
-
+
this._fnConstruct( oOpts );
-
+
return this;
};
@@ -319,7 +319,7 @@ TableTools.prototype = {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
+
/**
* Retreieve the settings object from an instance
* @returns {array} List of TR nodes which are currently selected
@@ -363,8 +363,8 @@ TableTools.prototype = {
return out;
},
-
-
+
+
/**
* Check to see if a current row is selected or not
* @param {Node} n TR node to check if it is currently selected or not
@@ -376,27 +376,41 @@ TableTools.prototype = {
return (this.s.dt.aoData[pos]._DTTT_selected===true) ? true : false;
},
-
+
/**
* Select all rows in the table
+ * @param {boolean} [filtered=false] Select only rows which are available
+ * given the filtering applied to the table. By default this is false -
+ * i.e. all rows, regardless of filtering are selected.
*/
- "fnSelectAll": function ()
+ "fnSelectAll": function ( filtered )
{
var s = this._fnGetMasterSettings();
- this._fnRowSelect( s.dt.aoData );
+
+ this._fnRowSelect( (filtered === true) ?
+ s.dt.aiDisplay :
+ s.dt.aoData
+ );
},
-
+
/**
* Deselect all rows in the table
+ * @param {boolean} [filtered=false] Deselect only rows which are available
+ * given the filtering applied to the table. By default this is false -
+ * i.e. all rows, regardless of filtering are deselected.
*/
- "fnSelectNone": function ()
+ "fnSelectNone": function ( filtered )
{
var s = this._fnGetMasterSettings();
- this._fnRowDeselect( s.dt.aoData );
- },
+ this._fnRowDeselect( (filtered === true) ?
+ s.dt.aiDisplay :
+ s.dt.aoData
+ );
+ },
+
/**
* Select row(s)
* @param {node|object|array} n The row(s) to select. Can be a single DOM
@@ -415,7 +429,7 @@ TableTools.prototype = {
}
},
-
+
/**
* Deselect row(s)
* @param {node|object|array} n The row(s) to deselect. Can be a single DOM
@@ -425,8 +439,8 @@ TableTools.prototype = {
{
this._fnRowDeselect( n );
},
-
-
+
+
/**
* Get the title of the document - useful for file names. The title is retrieved from either
* the configuration object's 'title' parameter, or the HTML document title
@@ -445,7 +459,7 @@ TableTools.prototype = {
sTitle = anTitle[0].innerHTML;
}
}
-
+
/* Strip characters which the OS will object to - checking for UTF8 support in the scripting
* engine
*/
@@ -455,8 +469,8 @@ TableTools.prototype = {
return sTitle.replace(/[^a-zA-Z0-9_\.,\-_ !\(\)]/g, "");
}
},
-
-
+
+
/**
* Calculate a unity array with the column width by proportion for a set of columns to be
* included for a button. This is particularly useful for PDF creation, where we can use the
@@ -471,7 +485,7 @@ TableTools.prototype = {
aColumnsInc = this._fnColumnTargets( oConfig.mColumns ),
aColWidths = [],
iWidth = 0, iTotal = 0, i, iLen;
-
+
for ( i=0, iLen=aColumnsInc.length ; i<iLen ; i++ )
{
if ( aColumnsInc[i] )
@@ -481,16 +495,16 @@ TableTools.prototype = {
aColWidths.push( iWidth );
}
}
-
+
for ( i=0, iLen=aColWidths.length ; i<iLen ; i++ )
{
aColWidths[i] = aColWidths[i] / iTotal;
}
-
+
return aColWidths.join('\t');
},
-
-
+
+
/**
* Get the information contained in a table as a string
* @param {Object} oConfig Button configuration object
@@ -504,8 +518,8 @@ TableTools.prototype = {
return this._fnGetDataTablesData( oConfig );
}
},
-
-
+
+
/**
* Pass text to a flash button instance, which will be used on the button's click handler
* @param {Object} clip Flash button object
@@ -515,8 +529,8 @@ TableTools.prototype = {
{
this._fnFlashSetText( clip, text );
},
-
-
+
+
/**
* Resize the flash elements of the buttons attached to this TableTools instance - this is
* useful for when initialising TableTools when it is hidden (display:none) since sizes can't
@@ -537,8 +551,8 @@ TableTools.prototype = {
}
}
},
-
-
+
+
/**
* Check to see if any of the ZeroClipboard client's attached need to be resized
*/
@@ -559,8 +573,8 @@ TableTools.prototype = {
}
return false;
},
-
-
+
+
/**
* Programmatically enable or disable the print view
* @param {boolean} [bView=true] Show the print view if true or not given. If false, then
@@ -588,8 +602,8 @@ TableTools.prototype = {
this._fnPrintEnd();
}
},
-
-
+
+
/**
* Show a message to the end user which is nicely styled
* @param {string} message The HTML string to show to the user
@@ -601,46 +615,46 @@ TableTools.prototype = {
nInfo.innerHTML = message;
document.body.appendChild( nInfo );
-
+
setTimeout( function() {
$(nInfo).fadeOut( "normal", function() {
document.body.removeChild( nInfo );
} );
}, time );
},
-
-
-
+
+
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private methods (they are of course public in JS, but recommended as private)
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
+
/**
* Constructor logic
* @method _fnConstruct
* @param {Object} oOpts Same as TableTools constructor
* @returns void
- * @private
+ * @private
*/
"_fnConstruct": function ( oOpts )
{
var that = this;
-
+
this._fnCustomiseSettings( oOpts );
-
+
/* Container element */
this.dom.container = document.createElement( this.s.tags.container );
this.dom.container.className = this.classes.container;
-
+
/* Row selection config */
if ( this.s.select.type != 'none' )
{
this._fnRowSelectConfig();
}
-
+
/* Buttons */
this._fnButtonDefinations( this.s.buttonSet, this.dom.container );
-
+
/* Destructor - need to wipe the DOM for IE's garbage collector */
this.s.dt.aoDestroyCallback.push( {
"sName": "TableTools",
@@ -649,14 +663,14 @@ TableTools.prototype = {
}
} );
},
-
-
+
+
/**
* Take the user defined settings and the default settings and combine them.
* @method _fnCustomiseSettings
* @param {Object} oOpts Same as TableTools constructor
* @returns void
- * @private
+ * @private
*/
"_fnCustomiseSettings": function ( oOpts )
{
@@ -666,20 +680,20 @@ TableTools.prototype = {
this.s.master = true;
this.s.dt._TableToolsInit = true;
}
-
+
/* We can use the table node from comparisons to group controls */
this.dom.table = this.s.dt.nTable;
-
+
/* Clone the defaults and then the user options */
this.s.custom = $.extend( {}, TableTools.DEFAULTS, oOpts );
-
+
/* Flash file location */
this.s.swfPath = this.s.custom.sSwfPath;
if ( typeof ZeroClipboard_TableTools != 'undefined' )
{
ZeroClipboard_TableTools.moviePath = this.s.swfPath;
}
-
+
/* Table row selecting */
this.s.select.type = this.s.custom.sRowSelect;
this.s.select.preRowSelect = this.s.custom.fnPreRowSelect;
@@ -697,8 +711,8 @@ TableTools.prototype = {
/* Button set */
this.s.buttonSet = this.s.custom.aButtons;
},
-
-
+
+
/**
* Take the user input arrays and expand them to be fully defined, and then add them to a given
* DOM element
@@ -706,12 +720,12 @@ TableTools.prototype = {
* @param {array} buttonSet Set of user defined buttons
* @param {node} wrapper Node to add the created buttons to
* @returns void
- * @private
+ * @private
*/
"_fnButtonDefinations": function ( buttonSet, wrapper )
{
var buttonDef;
-
+
for ( var i=0, iLen=buttonSet.length ; i<iLen ; i++ )
{
if ( typeof buttonSet[i] == "string" )
@@ -733,26 +747,26 @@ TableTools.prototype = {
var o = $.extend( {}, TableTools.BUTTONS[ buttonSet[i].sExtends ], true );
buttonDef = $.extend( o, buttonSet[i], true );
}
-
- wrapper.appendChild( this._fnCreateButton(
- buttonDef,
+
+ wrapper.appendChild( this._fnCreateButton(
+ buttonDef,
$(wrapper).hasClass(this.classes.collection.container)
) );
}
},
-
-
+
+
/**
* Create and configure a TableTools button
* @method _fnCreateButton
* @param {Object} oConfig Button configuration object
* @returns {Node} Button element
- * @private
+ * @private
*/
"_fnCreateButton": function ( oConfig, bCollectionButton )
{
var nButton = this._fnButtonBase( oConfig, bCollectionButton );
-
+
if ( oConfig.sAction.match(/flash/) )
{
this._fnFlashConfig( nButton, oConfig );
@@ -770,17 +784,17 @@ TableTools.prototype = {
this._fnTextConfig( nButton, oConfig );
this._fnCollectionConfig( nButton, oConfig );
}
-
+
return nButton;
},
-
-
+
+
/**
* Create the DOM needed for the button and apply some base properties. All buttons start here
* @method _fnButtonBase
* @param {o} oConfig Button configuration object
* @returns {Node} DIV element for the button
- * @private
+ * @private
*/
"_fnButtonBase": function ( o, bCollectionButton )
{
@@ -803,25 +817,25 @@ TableTools.prototype = {
nButton = document.createElement( sTag ),
nSpan = document.createElement( sLiner ),
masterS = this._fnGetMasterSettings();
-
+
nButton.className = sClass+" "+o.sButtonClass;
nButton.setAttribute('id', "ToolTables_"+this.s.dt.sInstance+"_"+masterS.buttonCounter );
nButton.appendChild( nSpan );
nSpan.innerHTML = o.sButtonText;
-
+
masterS.buttonCounter++;
-
+
return nButton;
},
-
-
+
+
/**
* Get the settings object for the master instance. When more than one TableTools instance is
* assigned to a DataTable, only one of them can be the 'master' (for the select rows). As such,
* we will typically want to interact with that master for global properties.
* @method _fnGetMasterSettings
* @returns {Object} TableTools settings object
- * @private
+ * @private
*/
"_fnGetMasterSettings": function ()
{
@@ -842,15 +856,15 @@ TableTools.prototype = {
}
}
},
-
-
-
+
+
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Button collection functions
*/
-
+
/**
- * Create a collection button, when activated will present a drop downlist of other buttons
+ * Create a collection button, when activated will present a drop down list of other buttons
* @param {Node} nButton Button to use for the collection activation
* @param {Object} oConfig Button configuration object
* @returns void
@@ -863,11 +877,11 @@ TableTools.prototype = {
nHidden.className = this.classes.collection.container;
oConfig._collection = nHidden;
document.body.appendChild( nHidden );
-
+
this._fnButtonDefinations( oConfig.aButtons, nHidden );
},
-
-
+
+
/**
* Show a button collection
* @param {Node} nButton Button to use for the collection
@@ -885,13 +899,13 @@ TableTools.prototype = {
iDivY = oPos.top + $(nButton).outerHeight(),
iWinHeight = $(window).height(), iDocHeight = $(document).height(),
iWinWidth = $(window).width(), iDocWidth = $(document).width();
-
+
nHidden.style.position = "absolute";
nHidden.style.left = iDivX+"px";
nHidden.style.top = iDivY+"px";
nHidden.style.display = "block";
$(nHidden).css('opacity',0);
-
+
var nBackground = document.createElement('div');
nBackground.style.position = "absolute";
nBackground.style.left = "0px";
@@ -900,27 +914,27 @@ TableTools.prototype = {
nBackground.style.width = ((iWinWidth>iDocWidth)? iWinWidth : iDocWidth) +"px";
nBackground.className = this.classes.collection.background;
$(nBackground).css('opacity',0);
-
+
document.body.appendChild( nBackground );
document.body.appendChild( nHidden );
-
+
/* Visual corrections to try and keep the collection visible */
var iDivWidth = $(nHidden).outerWidth();
var iDivHeight = $(nHidden).outerHeight();
-
+
if ( iDivX + iDivWidth > iDocWidth )
{
nHidden.style.left = (iDocWidth-iDivWidth)+"px";
}
-
+
if ( iDivY + iDivHeight > iDocHeight )
{
nHidden.style.top = (iDivY-iDivHeight-$(nButton).outerHeight())+"px";
}
-
+
this.dom.collection.collection = nHidden;
this.dom.collection.background = nBackground;
-
+
/* This results in a very small delay for the end user but it allows the animation to be
* much smoother. If you don't want the animation, then the setTimeout can be removed
*/
@@ -931,14 +945,14 @@ TableTools.prototype = {
/* Resize the buttons to the Flash contents fit */
this.fnResizeButtons();
-
+
/* Event handler to remove the collection display */
$(nBackground).click( function () {
that._fnCollectionHide.call( that, null, null );
} );
},
-
-
+
+
/**
* Hide a button collection
* @param {Node} nButton Button to use for the collection
@@ -952,59 +966,59 @@ TableTools.prototype = {
{
return;
}
-
+
if ( this.dom.collection.collection !== null )
{
$(this.dom.collection.collection).animate({"opacity": 0}, 500, function (e) {
this.style.display = "none";
} );
-
+
$(this.dom.collection.background).animate({"opacity": 0}, 500, function (e) {
this.parentNode.removeChild( this );
} );
-
+
this.dom.collection.collection = null;
this.dom.collection.background = null;
}
},
-
-
-
+
+
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Row selection functions
*/
-
+
/**
* Add event handlers to a table to allow for row selection
* @method _fnRowSelectConfig
* @returns void
- * @private
+ * @private
*/
"_fnRowSelectConfig": function ()
{
if ( this.s.master )
{
var
- that = this,
- i, iLen,
+ that = this,
+ i, iLen,
dt = this.s.dt,
aoOpenRows = this.s.dt.aoOpenRows;
-
+
$(dt.nTable).addClass( this.classes.select.table );
-
+
$('tr', dt.nTBody).live( 'click', function(e) {
/* Sub-table must be ignored (odd that the selector won't do this with >) */
if ( this.parentNode != dt.nTBody )
{
return;
}
-
+
/* Check that we are actually working with a DataTables controlled row */
if ( dt.oInstance.fnGetData(this) === null )
{
return;
}
-
+
/* User defined selection function */
if ( that.s.select.preRowSelect !== null && !that.s.select.preRowSelect.call(that, e) )
{
@@ -1040,7 +1054,7 @@ TableTools.prototype = {
/**
* Select rows
* @param {*} src Rows to select - see _fnSelectData for a description of valid inputs
- * @private
+ * @private
*/
"_fnRowSelect": function ( src )
{
@@ -1068,7 +1082,7 @@ TableTools.prototype = {
/**
* Deselect rows
* @param {*} src Rows to deselect - see _fnSelectData for a description of valid inputs
- * @private
+ * @private
*/
"_fnRowDeselect": function ( src )
{
@@ -1092,12 +1106,12 @@ TableTools.prototype = {
TableTools._fnEventDispatch( this, 'select', firstTr );
},
-
+
/**
* Take a data source for row selection and convert it into aoData points for the DT
* @param {*} src Can be a single DOM TR node, an array of TR nodes (including a
- * a jQuery object), a single aoData point from DataTables or an array of aoData
- * points.
+ * a jQuery object), a single aoData point from DataTables, an array of aoData
+ * points or an array of aoData indexes
* @returns {array} An array of aoData points
*/
"_fnSelectData": function ( src )
@@ -1112,7 +1126,7 @@ TableTools.prototype = {
}
else if ( typeof src.length !== 'undefined' )
{
- // jQuery oject or an array of nodes, or aoData points
+ // jQuery object or an array of nodes, or aoData points
for ( i=0, iLen=src.length ; i<iLen ; i++ )
{
if ( src[i].nodeName )
@@ -1120,6 +1134,10 @@ TableTools.prototype = {
pos = this.s.dt.oInstance.fnGetPosition( src[i] );
out.push( this.s.dt.aoData[pos] );
}
+ else if ( typeof src[i] === 'number' )
+ {
+ out.push( this.s.dt.aoData[ src[i] ] );
+ }
else
{
out.push( src[i] );
@@ -1136,34 +1154,34 @@ TableTools.prototype = {
return out;
},
-
-
+
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Text button functions
*/
-
+
/**
* Configure a text based button for interaction events
* @method _fnTextConfig
* @param {Node} nButton Button element which is being considered
* @param {Object} oConfig Button configuration object
* @returns void
- * @private
+ * @private
*/
"_fnTextConfig": function ( nButton, oConfig )
{
var that = this;
-
+
if ( oConfig.fnInit !== null )
{
oConfig.fnInit.call( this, nButton, oConfig );
}
-
+
if ( oConfig.sToolTip !== "" )
{
nButton.title = oConfig.sToolTip;
}
-
+
$(nButton).hover( function () {
if ( oConfig.fnMouseover !== null )
{
@@ -1175,58 +1193,58 @@ TableTools.prototype = {
oConfig.fnMouseout.call( this, nButton, oConfig, null );
}
} );
-
+
if ( oConfig.fnSelect !== null )
{
TableTools._fnEventListen( this, 'select', function (n) {
oConfig.fnSelect.call( that, nButton, oConfig, n );
} );
}
-
+
$(nButton).click( function (e) {
//e.preventDefault();
-
+
if ( oConfig.fnClick !== null )
{
oConfig.fnClick.call( that, nButton, oConfig, null );
}
-
+
/* Provide a complete function to match the behaviour of the flash elements */
if ( oConfig.fnComplete !== null )
{
oConfig.fnComplete.call( that, nButton, oConfig, null, null );
}
-
+
that._fnCollectionHide( nButton, oConfig );
} );
},
-
-
-
+
+
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Flash button functions
*/
-
+
/**
* Configure a flash based button for interaction events
* @method _fnFlashConfig
* @param {Node} nButton Button element which is being considered
* @param {o} oConfig Button configuration object
* @returns void
- * @private
+ * @private
*/
"_fnFlashConfig": function ( nButton, oConfig )
{
var that = this;
var flash = new ZeroClipboard_TableTools.Client();
-
+
if ( oConfig.fnInit !== null )
{
oConfig.fnInit.call( this, nButton, oConfig );
}
-
+
flash.setHandCursor( true );
-
+
if ( oConfig.sAction == "flash_save" )
{
flash.setAction( 'save' );
@@ -1243,28 +1261,28 @@ TableTools.prototype = {
{
flash.setAction( 'copy' );
}
-
+
flash.addEventListener('mouseOver', function(client) {
if ( oConfig.fnMouseover !== null )
{
oConfig.fnMouseover.call( that, nButton, oConfig, flash );
}
} );
-
+
flash.addEventListener('mouseOut', function(client) {
if ( oConfig.fnMouseout !== null )
{
oConfig.fnMouseout.call( that, nButton, oConfig, flash );
}
} );
-
+
flash.addEventListener('mouseDown', function(client) {
if ( oConfig.fnClick !== null )
{
oConfig.fnClick.call( that, nButton, oConfig, flash );
}
} );
-
+
flash.addEventListener('complete', function (client, text) {
if ( oConfig.fnComplete !== null )
{
@@ -1272,11 +1290,11 @@ TableTools.prototype = {
}
that._fnCollectionHide( nButton, oConfig );
} );
-
+
this._fnFlashGlue( flash, nButton, oConfig.sToolTip );
},
-
-
+
+
/**
* Wait until the id is in the DOM before we "glue" the swf. Note that this function will call
* itself (using setTimeout) until it completes successfully
@@ -1285,13 +1303,13 @@ TableTools.prototype = {
* @param {Node} node node to glue swf to
* @param {String} text title of the flash movie
* @returns void
- * @private
+ * @private
*/
"_fnFlashGlue": function ( flash, node, text )
{
var that = this;
var id = node.getAttribute('id');
-
+
if ( document.getElementById(id) )
{
flash.glue( node, text );
@@ -1303,62 +1321,62 @@ TableTools.prototype = {
}, 100 );
}
},
-
-
+
+
/**
* Set the text for the flash clip to deal with
- *
- * This function is required for large information sets. There is a limit on the
- * amount of data that can be transfered between Javascript and Flash in a single call, so
+ *
+ * This function is required for large information sets. There is a limit on the
+ * amount of data that can be transferred between Javascript and Flash in a single call, so
* we use this method to build up the text in Flash by sending over chunks. It is estimated
- * that the data limit is around 64k, although it is undocuments, and appears to be different
+ * that the data limit is around 64k, although it is undocumented, and appears to be different
* between different flash versions. We chunk at 8KiB.
* @method _fnFlashSetText
* @param {Object} clip the ZeroClipboard object
* @param {String} sData the data to be set
* @returns void
- * @private
+ * @private
*/
"_fnFlashSetText": function ( clip, sData )
{
var asData = this._fnChunkData( sData, 8192 );
-
+
clip.clearText();
for ( var i=0, iLen=asData.length ; i<iLen ; i++ )
{
clip.appendText( asData[i] );
}
},
-
-
-
+
+
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Data retrieval functions
*/
-
+
/**
* Convert the mixed columns variable into a boolean array the same size as the columns, which
* indicates which columns we want to include
* @method _fnColumnTargets
- * @param {String|Array} mColumns The columns to be included in data retreieval. If a string
+ * @param {String|Array} mColumns The columns to be included in data retrieval. If a string
* then it can take the value of "visible" or "hidden" (to include all visible or
* hidden columns respectively). Or an array of column indexes
* @returns {Array} A boolean array the length of the columns of the table, which each value
* indicating if the column is to be included or not
- * @private
+ * @private
*/
"_fnColumnTargets": function ( mColumns )
{
var aColumns = [];
var dt = this.s.dt;
-
+
if ( typeof mColumns == "object" )
{
for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ )
{
aColumns.push( false );
}
-
+
for ( i=0, iLen=mColumns.length ; i<iLen ; i++ )
{
aColumns[ mColumns[i] ] = true;
@@ -1392,11 +1410,11 @@ TableTools.prototype = {
aColumns.push( true );
}
}
-
+
return aColumns;
},
-
-
+
+
/**
* New line character(s) depend on the platforms
* @method method
@@ -1414,21 +1432,21 @@ TableTools.prototype = {
return oConfig.sNewLine;
}
},
-
-
+
+
/**
* Get data from DataTables' internals and format it for output
* @method _fnGetDataTablesData
* @param {Object} oConfig Button configuration object
* @param {String} oConfig.sFieldBoundary Field boundary for the data cells in the string
- * @param {String} oConfig.sFieldSeperator Field seperator for the data cells
+ * @param {String} oConfig.sFieldSeperator Field separator for the data cells
* @param {String} oConfig.sNewline New line options
* @param {Mixed} oConfig.mColumns Which columns should be included in the output
* @param {Boolean} oConfig.bHeader Include the header
* @param {Boolean} oConfig.bFooter Include the footer
* @param {Boolean} oConfig.bSelectedOnly Include only the selected rows in the output
- * @returns {String} Concatinated string of data
- * @private
+ * @returns {String} Concatenated string of data
+ * @private
*/
"_fnGetDataTablesData": function ( oConfig )
{
@@ -1438,28 +1456,28 @@ TableTools.prototype = {
var regex = new RegExp(oConfig.sFieldBoundary, "g"); /* Do it here for speed */
var aColumnsInc = this._fnColumnTargets( oConfig.mColumns );
var bSelectedOnly = (typeof oConfig.bSelectedOnly != 'undefined') ? oConfig.bSelectedOnly : false;
-
+
/*
* Header
*/
if ( oConfig.bHeader )
{
aRow = [];
-
+
for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ )
{
if ( aColumnsInc[i] )
{
sLoopData = dt.aoColumns[i].sTitle.replace(/\n/g," ").replace( /<.*?>/g, "" ).replace(/^\s+|\s+$/g,"");
sLoopData = this._fnHtmlDecode( sLoopData );
-
+
aRow.push( this._fnBoundData( sLoopData, oConfig.sFieldBoundary, regex ) );
}
}
aData.push( aRow.join(oConfig.sFieldSeperator) );
}
-
+
/*
* Body
*/
@@ -1473,12 +1491,12 @@ TableTools.prototype = {
aDataIndex.push( dt.oInstance.fnGetPosition( aSelected[i] ) );
}
}
-
+
for ( j=0, jLen=aDataIndex.length ; j<jLen ; j++ )
{
tr = dt.aoData[ aDataIndex[j] ].nTr;
aRow = [];
-
+
/* Columns */
for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ )
{
@@ -1503,23 +1521,23 @@ TableTools.prototype = {
{
sLoopData = mTypeData+"";
}
-
+
/* Trim and clean the data */
sLoopData = sLoopData.replace(/^\s+/, '').replace(/\s+$/, '');
sLoopData = this._fnHtmlDecode( sLoopData );
-
+
/* Bound it and add it to the total data */
aRow.push( this._fnBoundData( sLoopData, oConfig.sFieldBoundary, regex ) );
}
}
-
+
aData.push( aRow.join(oConfig.sFieldSeperator) );
-
+
/* Details rows from fnOpen */
if ( oConfig.bOpenRows )
{
arr = $.grep(dt.aoOpenRows, function(o) { return o.nParent === tr; });
-
+
if ( arr.length === 1 )
{
sLoopData = this._fnBoundData( $('td', arr[0].nTr).html(), oConfig.sFieldBoundary, regex );
@@ -1527,42 +1545,42 @@ TableTools.prototype = {
}
}
}
-
+
/*
* Footer
*/
if ( oConfig.bFooter && dt.nTFoot !== null )
{
aRow = [];
-
+
for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ )
{
if ( aColumnsInc[i] && dt.aoColumns[i].nTf !== null )
{
sLoopData = dt.aoColumns[i].nTf.innerHTML.replace(/\n/g," ").replace( /<.*?>/g, "" );
sLoopData = this._fnHtmlDecode( sLoopData );
-
+
aRow.push( this._fnBoundData( sLoopData, oConfig.sFieldBoundary, regex ) );
}
}
-
+
aData.push( aRow.join(oConfig.sFieldSeperator) );
}
-
+
_sLastData = aData.join( this._fnNewline(oConfig) );
return _sLastData;
},
-
-
+
+
/**
* Wrap data up with a boundary string
* @method _fnBoundData
* @param {String} sData data to bound
* @param {String} sBoundary bounding char(s)
- * @param {RegExp} regex search for the bounding chars - constructed outside for efficincy
+ * @param {RegExp} regex search for the bounding chars - constructed outside for efficiency
* in the loop
* @returns {String} bound data
- * @private
+ * @private
*/
"_fnBoundData": function ( sData, sBoundary, regex )
{
@@ -1575,21 +1593,21 @@ TableTools.prototype = {
return sBoundary + sData.replace(regex, sBoundary+sBoundary) + sBoundary;
}
},
-
-
+
+
/**
* Break a string up into an array of smaller strings
* @method _fnChunkData
* @param {String} sData data to be broken up
* @param {Int} iSize chunk size
* @returns {Array} String array of broken up text
- * @private
+ * @private
*/
"_fnChunkData": function ( sData, iSize )
{
var asReturn = [];
var iStrlen = sData.length;
-
+
for ( var i=0 ; i<iStrlen ; i+=iSize )
{
if ( i+iSize < iStrlen )
@@ -1601,17 +1619,17 @@ TableTools.prototype = {
asReturn.push( sData.substring( i, iStrlen ) );
}
}
-
+
return asReturn;
},
-
-
+
+
/**
* Decode HTML entities
* @method _fnHtmlDecode
* @param {String} sData encoded string
* @returns {String} decoded string
- * @private
+ * @private
*/
"_fnHtmlDecode": function ( sData )
{
@@ -1619,13 +1637,13 @@ TableTools.prototype = {
{
return sData;
}
-
- var
+
+ var
aData = this._fnChunkData( sData, 2048 ),
n = document.createElement('div'),
i, iLen, iIndex,
sReturn = "", sInner;
-
+
/* nodeValue has a limit in browsers - so we chunk the data into smaller segments to build
* up the string. Note that the 'trick' here is to remember than we might have split over
* an HTML entity, so we backtrack a little to make sure this doesn't happen
@@ -1639,36 +1657,36 @@ TableTools.prototype = {
sInner = aData[i].substr( iIndex );
aData[i] = aData[i].substr( 0, iIndex );
}
-
+
n.innerHTML = aData[i];
sReturn += n.childNodes[0].nodeValue;
}
-
+
return sReturn;
},
-
-
-
+
+
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Printing functions
*/
-
+
/**
* Show print display
* @method _fnPrintStart
* @param {Event} e Event object
* @param {Object} oConfig Button configuration object
* @returns void
- * @private
+ * @private
*/
"_fnPrintStart": function ( oConfig )
{
var that = this;
var oSetDT = this.s.dt;
-
+
/* Parse through the DOM hiding everything that isn't needed for the table */
this._fnPrintHideNodes( oSetDT.nTable );
-
+
/* Show the whole table */
this.s.print.saveStart = oSetDT._iDisplayStart;
this.s.print.saveLength = oSetDT._iDisplayLength;
@@ -1680,13 +1698,13 @@ TableTools.prototype = {
oSetDT.oApi._fnCalculateEnd( oSetDT );
oSetDT.oApi._fnDraw( oSetDT );
}
-
+
/* Adjust the display for scrolling which might be done by DataTables */
if ( oSetDT.oScroll.sX !== "" || oSetDT.oScroll.sY !== "" )
{
this._fnPrintScrollStart( oSetDT );
}
-
+
/* Remove the other DataTables feature nodes - but leave the table! and info div */
var anFeature = oSetDT.aanFeatures;
for ( var cFeature in anFeature )
@@ -1703,7 +1721,7 @@ TableTools.prototype = {
}
}
}
-
+
/* Print class can be used for styling */
$(document.body).addClass( this.classes.print.body );
@@ -1721,8 +1739,8 @@ TableTools.prototype = {
this.dom.print.message.innerHTML = oConfig.sMessage;
document.body.insertBefore( this.dom.print.message, document.body.childNodes[0] );
}
-
- /* Cache the scrolling and the jump to the top of the t=page */
+
+ /* Cache the scrolling and the jump to the top of the page */
this.s.print.saveScroll = $(window).scrollTop();
window.scrollTo( 0, 0 );
@@ -1738,14 +1756,14 @@ TableTools.prototype = {
}
} );
},
-
-
+
+
/**
* Printing is finished, resume normal display
* @method _fnPrintEnd
* @param {Event} e Event object
* @returns void
- * @private
+ * @private
*/
"_fnPrintEnd": function ( e )
{
@@ -1753,47 +1771,47 @@ TableTools.prototype = {
var oSetDT = this.s.dt;
var oSetPrint = this.s.print;
var oDomPrint = this.dom.print;
-
+
/* Show all hidden nodes */
this._fnPrintShowNodes();
-
+
/* Restore DataTables' scrolling */
if ( oSetDT.oScroll.sX !== "" || oSetDT.oScroll.sY !== "" )
{
this._fnPrintScrollEnd();
}
-
+
/* Restore the scroll */
window.scrollTo( 0, oSetPrint.saveScroll );
-
+
/* Drop the print message */
if ( oDomPrint.message !== null )
{
document.body.removeChild( oDomPrint.message );
oDomPrint.message = null;
}
-
+
/* Styling class */
$(document.body).removeClass( 'DTTT_Print' );
-
+
/* Restore the table length */
oSetDT._iDisplayStart = oSetPrint.saveStart;
oSetDT._iDisplayLength = oSetPrint.saveLength;
oSetDT.oApi._fnCalculateEnd( oSetDT );
oSetDT.oApi._fnDraw( oSetDT );
-
+
$(document).unbind( "keydown.DTTT" );
},
-
-
+
+
/**
* Take account of scrolling in DataTables by showing the full table
* @returns void
- * @private
+ * @private
*/
"_fnPrintScrollStart": function ()
{
- var
+ var
oSetDT = this.s.dt,
nScrollHeadInner = oSetDT.nScrollHead.getElementsByTagName('div')[0],
nScrollHeadTable = nScrollHeadInner.getElementsByTagName('table')[0],
@@ -1807,7 +1825,7 @@ TableTools.prototype = {
{
oSetDT.nTable.removeChild( nTheadSize[0] );
}
-
+
if ( oSetDT.nTFoot !== null )
{
var nTfootSize = oSetDT.nTable.getElementsByTagName('tfoot');
@@ -1816,16 +1834,16 @@ TableTools.prototype = {
oSetDT.nTable.removeChild( nTfootSize[0] );
}
}
-
+
nTheadSize = oSetDT.nTHead.cloneNode(true);
oSetDT.nTable.insertBefore( nTheadSize, oSetDT.nTable.childNodes[0] );
-
+
if ( oSetDT.nTFoot !== null )
{
nTfootSize = oSetDT.nTFoot.cloneNode(true);
oSetDT.nTable.insertBefore( nTfootSize, oSetDT.nTable.childNodes[1] );
}
-
+
/* Now adjust the table's viewport so we can actually see it */
if ( oSetDT.oScroll.sX !== "" )
{
@@ -1833,71 +1851,71 @@ TableTools.prototype = {
nScrollBody.style.width = $(oSetDT.nTable).outerWidth()+"px";
nScrollBody.style.overflow = "visible";
}
-
+
if ( oSetDT.oScroll.sY !== "" )
{
nScrollBody.style.height = $(oSetDT.nTable).outerHeight()+"px";
nScrollBody.style.overflow = "visible";
}
},
-
-
+
+
/**
* Take account of scrolling in DataTables by showing the full table. Note that the redraw of
- * the DataTable that we do will actually deal with the majority of the hardword here
+ * the DataTable that we do will actually deal with the majority of the hard work here
* @returns void
- * @private
+ * @private
*/
"_fnPrintScrollEnd": function ()
{
- var
+ var
oSetDT = this.s.dt,
nScrollBody = oSetDT.nTable.parentNode;
-
+
if ( oSetDT.oScroll.sX !== "" )
{
nScrollBody.style.width = oSetDT.oApi._fnStringToCss( oSetDT.oScroll.sX );
nScrollBody.style.overflow = "auto";
}
-
+
if ( oSetDT.oScroll.sY !== "" )
{
nScrollBody.style.height = oSetDT.oApi._fnStringToCss( oSetDT.oScroll.sY );
nScrollBody.style.overflow = "auto";
}
},
-
-
+
+
/**
* Resume the display of all TableTools hidden nodes
* @method _fnPrintShowNodes
* @returns void
- * @private
+ * @private
*/
"_fnPrintShowNodes": function ( )
{
var anHidden = this.dom.print.hidden;
-
+
for ( var i=0, iLen=anHidden.length ; i<iLen ; i++ )
{
anHidden[i].node.style.display = anHidden[i].display;
}
anHidden.splice( 0, anHidden.length );
},
-
-
+
+
/**
* Hide nodes which are not needed in order to display the table. Note that this function is
* recursive
* @method _fnPrintHideNodes
* @param {Node} nNode Element which should be showing in a 'print' display
* @returns void
- * @private
+ * @private
*/
"_fnPrintHideNodes": function ( nNode )
{
var anHidden = this.dom.print.hidden;
-
+
var nParent = nNode.parentNode;
var nChildren = nParent.childNodes;
for ( var i=0, iLen=nChildren.length ; i<iLen ; i++ )
@@ -1917,7 +1935,7 @@ TableTools.prototype = {
}
}
}
-
+
if ( nParent.nodeName != "BODY" )
{
this._fnPrintHideNodes( nParent );
@@ -1987,7 +2005,7 @@ TableTools.fnGetInstance = function ( node )
{
node = document.getElementById(node);
}
-
+
for ( var i=0, iLen=TableTools._aInstances.length ; i<iLen ; i++ )
{
if ( TableTools._aInstances[i].s.master && TableTools._aInstances[i].dom.table == node )
@@ -2017,15 +2035,15 @@ TableTools._fnEventListen = function ( that, type, fn )
"fn": fn
} );
};
-
+
/**
- * An event has occured - look up every listener and fire it off. We check that the event we are
+ * An event has occurred - look up every listener and fire it off. We check that the event we are
* going to fire is attached to the same table (using the table node as reference) before firing
* @method _fnEventDispatch
* @param {Object} that Scope of the listening function (i.e. 'this' in the caller)
* @param {String} type Event type
- * @param {Node} node Element that the event occured on (may be null)
+ * @param {Node} node Element that the event occurred on (may be null)
* @returns void
* @private
* @static
@@ -2142,7 +2160,7 @@ TableTools.BUTTONS = {
"sPdfSize": "A4",
"sPdfMessage": "",
"fnClick": function( nButton, oConfig, flash ) {
- this.fnSetText( flash,
+ this.fnSetText( flash,
"title:"+ this.fnGetTitle(oConfig) +"\n"+
"message:"+ oConfig.sPdfMessage +"\n"+
"colWidth:"+ this.fnCalcColRatios(oConfig) +"\n"+
@@ -2241,7 +2259,7 @@ TableTools.BUTTONS = {
],
"success": oConfig.fnAjaxComplete,
"dataType": "json",
- "type": "POST",
+ "type": "POST",
"cache": false,
"error": function () {
alert( "Error detected when sending table data to server" );
@@ -2280,7 +2298,7 @@ TableTools.BUTTONS = {
/**
- * @namespace Classes used by TableTools - allows the styles to be overriden easily.
+ * @namespace Classes used by TableTools - allows the styles to be override easily.
* Note that when TableTools initialises it will take a copy of the classes object
* and will use its internal copy for the remainder of its run time.
*/
@@ -2311,7 +2329,7 @@ TableTools.classes = {
/**
- * @namespace ThemeRoller classes - built in for compability with DataTables'
+ * @namespace ThemeRoller classes - built in for compatibility with DataTables'
* bJQueryUI option.
*/
TableTools.classes_themeroller = {
@@ -2329,7 +2347,7 @@ TableTools.classes_themeroller = {
* @namespace TableTools default settings for initialisation
*/
TableTools.DEFAULTS = {
- "sSwfPath": "media/swf/copy_csv_xls_pdf.swf",
+ "sSwfPath": "/assets/dataTables/extras/swf/copy_csv_xls_pdf.swf",
"sRowSelect": "none",
"sSelectedClass": null,
"fnPreRowSelect": null,
@@ -2365,7 +2383,7 @@ TableTools.prototype.CLASS = "TableTools";
* @type String
* @default See code
*/
-TableTools.VERSION = "2.1.2";
+TableTools.VERSION = "2.1.3";
TableTools.prototype.VERSION = TableTools.VERSION;
@@ -2384,12 +2402,12 @@ if ( typeof $.fn.dataTable == "function" &&
{
$.fn.dataTableExt.aoFeatures.push( {
"fnInit": function( oDTSettings ) {
- var oOpts = typeof oDTSettings.oInit.oTableTools != 'undefined' ?
+ var oOpts = typeof oDTSettings.oInit.oTableTools != 'undefined' ?
oDTSettings.oInit.oTableTools : {};
-
+
var oTT = new TableTools( oDTSettings.oInstance, oOpts );
TableTools._aInstances.push( oTT );
-
+
return oTT.dom.container;
},
"cFeature": "T",
@@ -2403,4 +2421,4 @@ else
$.fn.DataTable.TableTools = TableTools;
-})(jQuery, window, document);
+})(jQuery, window, document);
View
76 vendor/assets/javascripts/dataTables/extras/TableTools.min.js
@@ -0,0 +1,76 @@
+// Simple Set Clipboard System
+// Author: Joseph Huckaby
+var ZeroClipboard_TableTools={version:"1.0.4-TableTools2",clients:{},moviePath:"",nextId:1,$:function(a){"string"==typeof a&&(a=document.getElementById(a));a.addClass||(a.hide=function(){this.style.display="none"},a.show=function(){this.style.display=""},a.addClass=function(a){this.removeClass(a);this.className+=" "+a},a.removeClass=function(a){this.className=this.className.replace(RegExp("\\s*"+a+"\\s*")," ").replace(/^\s+/,"