Copied '+lines+' row'+plural+' to the clipboard.
', - 1500 - ); - } - } ), - - "pdf": $.extend( {}, TableTools.buttonBase, { - "sAction": "flash_pdf", - "sNewLine": "\n", - "sFileName": "*.pdf", - "sButtonClass": "DTTT_button_pdf", - "sButtonText": "PDF", - "sPdfOrientation": "portrait", - "sPdfSize": "A4", - "sPdfMessage": "", - "fnClick": function( nButton, oConfig, flash ) { - this.fnSetText( flash, - "title:"+ this.fnGetTitle(oConfig) +"\n"+ - "message:"+ oConfig.sPdfMessage +"\n"+ - "colWidth:"+ this.fnCalcColRatios(oConfig) +"\n"+ - "orientation:"+ oConfig.sPdfOrientation +"\n"+ - "size:"+ oConfig.sPdfSize +"\n"+ - "--/TableToolsOpts--\n" + - this.fnGetTableData(oConfig) - ); - } - } ), - - "print": $.extend( {}, TableTools.buttonBase, { - "sInfo": "Please use your browser's print function to "+ - "print this table. Press escape when finished.
", - "sMessage": null, - "bShowAll": true, - "sToolTip": "View print view", - "sButtonClass": "DTTT_button_print", - "sButtonText": "Print", - "fnClick": function ( nButton, oConfig ) { - this.fnPrint( true, oConfig ); - } - } ), - - "text": $.extend( {}, TableTools.buttonBase ), - - "select": $.extend( {}, TableTools.buttonBase, { - "sButtonText": "Select button", - "fnSelect": function( nButton, oConfig ) { - if ( this.fnGetSelected().length !== 0 ) { - $(nButton).removeClass( this.classes.buttons.disabled ); - } else { - $(nButton).addClass( this.classes.buttons.disabled ); - } - }, - "fnInit": function( nButton, oConfig ) { - $(nButton).addClass( this.classes.buttons.disabled ); - } - } ), - - "select_single": $.extend( {}, TableTools.buttonBase, { - "sButtonText": "Select button", - "fnSelect": function( nButton, oConfig ) { - var iSelected = this.fnGetSelected().length; - if ( iSelected == 1 ) { - $(nButton).removeClass( this.classes.buttons.disabled ); - } else { - $(nButton).addClass( this.classes.buttons.disabled ); - } - }, - "fnInit": function( nButton, oConfig ) { - $(nButton).addClass( this.classes.buttons.disabled ); - } - } ), - - "select_all": $.extend( {}, TableTools.buttonBase, { - "sButtonText": "Select all", - "fnClick": function( nButton, oConfig ) { - this.fnSelectAll(); - }, - "fnSelect": function( nButton, oConfig ) { - if ( this.fnGetSelected().length == this.s.dt.fnRecordsDisplay() ) { - $(nButton).addClass( this.classes.buttons.disabled ); - } else { - $(nButton).removeClass( this.classes.buttons.disabled ); - } - } - } ), - - "select_none": $.extend( {}, TableTools.buttonBase, { - "sButtonText": "Deselect all", - "fnClick": function( nButton, oConfig ) { - this.fnSelectNone(); - }, - "fnSelect": function( nButton, oConfig ) { - if ( this.fnGetSelected().length !== 0 ) { - $(nButton).removeClass( this.classes.buttons.disabled ); - } else { - $(nButton).addClass( this.classes.buttons.disabled ); - } - }, - "fnInit": function( nButton, oConfig ) { - $(nButton).addClass( this.classes.buttons.disabled ); - } - } ), - - "ajax": $.extend( {}, TableTools.buttonBase, { - "sAjaxUrl": "/xhr.php", - "sButtonText": "Ajax button", - "fnClick": function( nButton, oConfig ) { - var sData = this.fnGetTableData(oConfig); - $.ajax( { - "url": oConfig.sAjaxUrl, - "data": [ - { "name": "tableData", "value": sData } - ], - "success": oConfig.fnAjaxComplete, - "dataType": "json", - "type": "POST", - "cache": false, - "error": function () { - alert( "Error detected when sending table data to server" ); - } - } ); - }, - "fnAjaxComplete": function( json ) { - alert( 'Ajax complete' ); - } - } ), - - "div": $.extend( {}, TableTools.buttonBase, { - "sAction": "div", - "sTag": "div", - "sButtonClass": "DTTT_nonbutton", - "sButtonText": "Text button" - } ), - - "collection": $.extend( {}, TableTools.buttonBase, { - "sAction": "collection", - "sButtonClass": "DTTT_button_collection", - "sButtonText": "Collection", - "fnClick": function( nButton, oConfig ) { - this._fnCollectionShow(nButton, oConfig); - } - } ) -}; -/* - * on* callback parameters: - * 1. node - button element - * 2. object - configuration object for this button - * 3. object - ZeroClipboard reference (flash button only) - * 4. string - Returned string from Flash (flash button only - and only on 'complete') - */ - -// Alias to match the other plug-ins styling -TableTools.buttons = TableTools.BUTTONS; - - -/** - * @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. - */ -TableTools.classes = { - "container": "DTTT_container", - "buttons": { - "normal": "DTTT_button", - "disabled": "DTTT_disabled" - }, - "collection": { - "container": "DTTT_collection", - "background": "DTTT_collection_background", - "buttons": { - "normal": "DTTT_button", - "disabled": "DTTT_disabled" - } - }, - "select": { - "table": "DTTT_selectable", - "row": "DTTT_selected selected" - }, - "print": { - "body": "DTTT_Print", - "info": "DTTT_print_info", - "message": "DTTT_PrintMessage" - } -}; - - -/** - * @namespace ThemeRoller classes - built in for compatibility with DataTables' - * bJQueryUI option. - */ -TableTools.classes_themeroller = { - "container": "DTTT_container ui-buttonset ui-buttonset-multi", - "buttons": { - "normal": "DTTT_button ui-button ui-state-default" - }, - "collection": { - "container": "DTTT_collection ui-buttonset ui-buttonset-multi" - } -}; - - -/** - * @namespace TableTools default settings for initialisation - */ -TableTools.DEFAULTS = { - "sSwfPath": "../swf/copy_csv_xls_pdf.swf", - "sRowSelect": "none", - "sRowSelector": "tr", - "sSelectedClass": null, - "fnPreRowSelect": null, - "fnRowSelected": null, - "fnRowDeselected": null, - "aButtons": [ "copy", "csv", "xls", "pdf", "print" ], - "oTags": { - "container": "div", - "button": "a", // We really want to use buttons here, but Firefox and IE ignore the - // click on the Flash element in the button (but not mouse[in|out]). - "liner": "span", - "collection": { - "container": "div", - "button": "a", - "liner": "span" - } - } -}; - -// Alias to match the other plug-ins -TableTools.defaults = TableTools.DEFAULTS; - - -/** - * Name of this class - * @constant CLASS - * @type String - * @default TableTools - */ -TableTools.prototype.CLASS = "TableTools"; - - -/** - * TableTools version - * @constant VERSION - * @type String - * @default See code - */ -TableTools.version = "2.2.4"; - - - -// DataTables 1.10 API -// -// This will be extended in a big way in in TableTools 3 to provide API methods -// such as rows().select() and rows.selected() etc, but for the moment the -// tabletools() method simply returns the instance. - -if ( $.fn.dataTable.Api ) { - $.fn.dataTable.Api.register( 'tabletools()', function () { - var tt = null; - - if ( this.context.length > 0 ) { - tt = TableTools.fnGetInstance( this.context[0].nTable ); - } - - return tt; - } ); -} - - - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Initialisation - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Register a new feature with DataTables - */ -if ( typeof $.fn.dataTable == "function" && - typeof $.fn.dataTableExt.fnVersionCheck == "function" && - $.fn.dataTableExt.fnVersionCheck('1.9.0') ) -{ - $.fn.dataTableExt.aoFeatures.push( { - "fnInit": function( oDTSettings ) { - var init = oDTSettings.oInit; - var opts = init ? - init.tableTools || init.oTableTools || {} : - {}; - - return new TableTools( oDTSettings.oInstance, opts ).dom.container; - }, - "cFeature": "T", - "sFeature": "TableTools" - } ); -} -else -{ - alert( "Warning: TableTools requires DataTables 1.9.0 or newer - www.datatables.net/download"); -} - -$.fn.DataTable.TableTools = TableTools; - -})(jQuery, window, document); - -/* - * Register a new feature with DataTables - */ -if ( typeof $.fn.dataTable == "function" && - typeof $.fn.dataTableExt.fnVersionCheck == "function" && - $.fn.dataTableExt.fnVersionCheck('1.9.0') ) -{ - $.fn.dataTableExt.aoFeatures.push( { - "fnInit": function( oDTSettings ) { - 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", - "sFeature": "TableTools" - } ); -} -else -{ - alert( "Warning: TableTools 2 requires DataTables 1.9.0 or newer - www.datatables.net/download"); -} - - -$.fn.dataTable.TableTools = TableTools; -$.fn.DataTable.TableTools = TableTools; - - -return TableTools; -}; // /factory - - -// Define as an AMD module if possible -if ( typeof define === 'function' && define.amd ) { - define( ['jquery', 'datatables'], factory ); -} -else if ( typeof exports === 'object' ) { - // Node/CommonJS - factory( require('jquery'), require('datatables') ); -} -else if ( jQuery && !jQuery.fn.dataTable.TableTools ) { - // Otherwise simply initialise as normal, stopping multiple evaluation - factory( jQuery, jQuery.fn.dataTable ); -} - - -})(window, document); -