2011-12-15 14:05:52 +00:00
|
|
|
/**
|
|
|
|
* @summary DataTables
|
|
|
|
* @description Paginate, search and sort HTML tables
|
2011-12-20 14:48:27 +00:00
|
|
|
* @version 1.9.0.dev.2
|
2011-12-15 14:26:23 +00:00
|
|
|
* @file jquery.dataTables.js
|
2011-12-15 14:05:52 +00:00
|
|
|
* @author Allan Jardine (www.sprymedia.co.uk)
|
|
|
|
* @contact www.sprymedia.co.uk/contact
|
|
|
|
*
|
|
|
|
* @copyright Copyright 2010-2011 Allan Jardine, all rights reserved.
|
2011-11-24 14:05:22 +00:00
|
|
|
*
|
|
|
|
* This source file is free software, under either the GPL v2 license or a
|
2011-12-15 14:05:52 +00:00
|
|
|
* BSD style license, available at:
|
|
|
|
* http://datatables.net/license_gpl2
|
|
|
|
* http://datatables.net/license_bsd
|
2011-11-24 14:05:22 +00:00
|
|
|
*
|
|
|
|
* This source file is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
|
|
|
|
*
|
|
|
|
* For details please refer to: http://www.datatables.net
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*jslint evil: true, undef: true, browser: true */
|
2011-12-25 07:52:51 +00:00
|
|
|
/*globals $, jQuery,_fnExternApiFunc,_fnInitialise,_fnInitComplete,_fnLanguageCompat,_fnAddColumn,_fnColumnOptions,_fnAddData,_fnCreateTr,_fnGatherData,_fnBuildHead,_fnDrawHead,_fnDraw,_fnReDraw,_fnAjaxUpdate,_fnAjaxParameters,_fnAjaxUpdateDraw,_fnServerParams,_fnAddOptionsHtml,_fnFeatureHtmlTable,_fnScrollDraw,_fnAdjustColumnSizing,_fnFeatureHtmlFilter,_fnFilterComplete,_fnFilterCustom,_fnFilterColumn,_fnFilter,_fnBuildSearchArray,_fnBuildSearchRow,_fnFilterCreateSearch,_fnDataToSearch,_fnSort,_fnSortAttachListener,_fnSortingClasses,_fnFeatureHtmlPaginate,_fnPageChange,_fnFeatureHtmlInfo,_fnUpdateInfo,_fnFeatureHtmlLength,_fnFeatureHtmlProcessing,_fnProcessingDisplay,_fnVisibleToColumnIndex,_fnColumnIndexToVisible,_fnNodeToDataIndex,_fnVisbleColumns,_fnCalculateEnd,_fnConvertToWidth,_fnCalculateColumnWidths,_fnScrollingWidthAdjust,_fnGetWidestNode,_fnGetMaxLenString,_fnStringToCss,_fnDetectType,_fnSettingsFromNode,_fnGetDataMaster,_fnGetTrNodes,_fnGetTdNodes,_fnEscapeRegex,_fnDeleteIndex,_fnReOrderIndex,_fnColumnOrdering,_fnLog,_fnClearTable,_fnSaveState,_fnLoadState,_fnCreateCookie,_fnReadCookie,_fnDetectHeader,_fnGetUniqueThs,_fnScrollBarWidth,_fnApplyToChildren,_fnMap,_fnGetRowData,_fnGetCellData,_fnSetCellData,_fnGetObjectDataFn,_fnSetObjectDataFn,_fnApplyColumnDefs,_fnBindAction,_fnCallbackReg,_fnCallbackFire*/
|
2011-11-24 14:05:22 +00:00
|
|
|
|
2011-12-14 13:35:49 +00:00
|
|
|
(/** @lends <global> */function($, window, document, undefined) {
|
2011-11-25 16:34:31 +00:00
|
|
|
/**
|
|
|
|
* DataTables is a plug-in for the jQuery Javascript library. It is a
|
|
|
|
* highly flexible tool, based upon the foundations of progressive
|
|
|
|
* enhancement, which will add advanced interaction controls to any
|
|
|
|
* HTML table. For a full list of features please refer to
|
|
|
|
* <a href="http://datatables.net">DataTables.net</a>.
|
2011-12-09 08:33:45 +00:00
|
|
|
*
|
2011-12-14 15:08:42 +00:00
|
|
|
* Note that the <i>DataTable</i> object is not a global variable but is
|
|
|
|
* aliased to <i>jQuery.fn.DataTable</i> and <i>jQuery.fn.dataTable</i> through which
|
2011-12-15 12:43:26 +00:00
|
|
|
* it may be accessed.
|
2011-12-14 15:08:42 +00:00
|
|
|
*
|
2011-11-25 16:34:31 +00:00
|
|
|
* @class
|
|
|
|
* @param {object} [oInit={}] Configuration object for DataTables. Options
|
2011-12-14 16:22:58 +00:00
|
|
|
* are defined by {@link DataTable.defaults}
|
2011-11-25 16:34:31 +00:00
|
|
|
* @requires jQuery 1.3+
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* // Basic initialisation
|
|
|
|
* $(document).ready( function {
|
|
|
|
* $('#example').dataTable();
|
|
|
|
* } );
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* // Initialisation with configuration options - in this case, disable
|
|
|
|
* // pagination and sorting.
|
|
|
|
* $(document).ready( function {
|
|
|
|
* $('#example').dataTable( {
|
|
|
|
* "bPaginate": false,
|
|
|
|
* "bSort": false
|
|
|
|
* } );
|
|
|
|
* } );
|
|
|
|
*/
|
2011-12-06 18:03:29 +00:00
|
|
|
var DataTable = function( oInit )
|
2011-11-24 14:05:22 +00:00
|
|
|
{
|
|
|
|
require('core.columns.js');
|
|
|
|
require('core.data.js');
|
|
|
|
require('core.draw.js');
|
2011-12-11 08:44:28 +00:00
|
|
|
require('core.ajax.js');
|
2011-11-24 14:05:22 +00:00
|
|
|
require('core.filter.js');
|
|
|
|
require('core.info.js');
|
|
|
|
require('core.init.js');
|
|
|
|
require('core.length.js');
|
|
|
|
require('core.page.js');
|
|
|
|
require('core.processing.js');
|
|
|
|
require('core.scrolling.js');
|
|
|
|
require('core.sizing.js');
|
|
|
|
require('core.sort.js');
|
|
|
|
require('core.state.js');
|
|
|
|
require('core.support.js');
|
|
|
|
|
|
|
|
require('api.methods.js');
|
|
|
|
require('api.internal.js');
|
|
|
|
|
|
|
|
var _that = this;
|
|
|
|
return this.each(function() {
|
|
|
|
require('core.constructor.js');
|
|
|
|
} );
|
|
|
|
};
|
|
|
|
|
2011-12-03 09:36:19 +00:00
|
|
|
/**
|
|
|
|
* Version string for plug-ins to check compatibility. Allowed format is
|
|
|
|
* a.b.c.d.e where: a:int, b:int, c:int, d:string(dev|beta), e:int. d and
|
|
|
|
* e are optional
|
2011-12-09 08:33:45 +00:00
|
|
|
* @member
|
2011-12-03 09:36:19 +00:00
|
|
|
* @type string
|
|
|
|
* @default Version number
|
|
|
|
*/
|
2011-12-20 14:48:27 +00:00
|
|
|
DataTable.version = "1.9.0.dev.2";
|
2011-12-03 09:36:19 +00:00
|
|
|
|
2011-12-06 18:03:29 +00:00
|
|
|
/**
|
|
|
|
* Private data store, containing all of the settings objects that are created for the
|
|
|
|
* tables on a given page.
|
2011-12-14 15:08:42 +00:00
|
|
|
*
|
|
|
|
* Note that the <i>DataTable.settings</i> object is aliased to <i>jQuery.fn.dataTableExt</i>
|
|
|
|
* through which is may be accessed and manipulated, or <i>jQuery.fn.dataTable.settings</i>.
|
2011-12-09 08:33:45 +00:00
|
|
|
* @member
|
2011-12-06 18:03:29 +00:00
|
|
|
* @type array
|
|
|
|
* @default []
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
DataTable.settings = [];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Object models container, for the various models that DataTables has available
|
2011-12-15 13:54:23 +00:00
|
|
|
* to it. These models define the objects that are used to hold the active state
|
|
|
|
* and configuration of the table.
|
2011-12-06 18:03:29 +00:00
|
|
|
* @namespace
|
|
|
|
*/
|
2011-11-25 16:34:31 +00:00
|
|
|
DataTable.models = {};
|
2011-12-02 07:22:57 +00:00
|
|
|
require('model.ext.js');
|
2011-11-27 18:51:56 +00:00
|
|
|
require('model.search.js');
|
2011-11-25 16:34:31 +00:00
|
|
|
require('model.row.js');
|
|
|
|
require('model.column.js');
|
2011-12-14 16:22:58 +00:00
|
|
|
require('model.defaults.js');
|
2011-12-15 12:38:08 +00:00
|
|
|
require('model.defaults.columns.js');
|
2011-11-27 18:51:56 +00:00
|
|
|
require('model.settings.js');
|
2011-12-03 09:36:19 +00:00
|
|
|
|
2011-12-06 18:03:29 +00:00
|
|
|
/**
|
2011-12-09 08:33:45 +00:00
|
|
|
* Extension object for DataTables that is used to provide all extension options.
|
|
|
|
* See {@link DataTable.models.ext} for full information about the extension object.
|
2011-12-14 15:08:42 +00:00
|
|
|
*
|
|
|
|
* Note that the <i>DataTable.ext</i> object is aliased to <i>jQuery.fn.dataTableExt</i>
|
|
|
|
* through which is may be accessed and manipulated, or <i>jQuery.fn.dataTable.ext</i>.
|
2011-12-06 18:03:29 +00:00
|
|
|
* @namespace
|
|
|
|
*/
|
|
|
|
DataTable.ext = $.extend( true, {}, DataTable.models.ext );
|
2011-12-02 07:22:57 +00:00
|
|
|
require('ext.classes.js');
|
|
|
|
require('ext.paging.js');
|
|
|
|
require('ext.sorting.js');
|
|
|
|
require('ext.types.js');
|
2011-11-25 16:34:31 +00:00
|
|
|
|
2011-11-24 14:05:22 +00:00
|
|
|
// jQuery aliases
|
2011-12-06 18:04:57 +00:00
|
|
|
$.fn.DataTable = DataTable;
|
2011-11-24 14:05:22 +00:00
|
|
|
$.fn.dataTable = DataTable;
|
2011-12-06 18:03:29 +00:00
|
|
|
$.fn.dataTableSettings = DataTable.settings;
|
|
|
|
$.fn.dataTableExt = DataTable.ext;
|
2011-11-24 14:05:22 +00:00
|
|
|
|
2011-12-07 10:24:03 +00:00
|
|
|
|
|
|
|
// Information about events fired by DataTables - for documentation.
|
|
|
|
/**
|
|
|
|
* Draw event, fired whenever the table is redrawn on the page, at the same point as
|
|
|
|
* fnDrawCallback. This may be useful for binding events or performing calculations when
|
|
|
|
* the table is altered at all.
|
|
|
|
* @name DataTable#draw
|
|
|
|
* @event
|
|
|
|
* @param {event} e jQuery event object
|
|
|
|
* @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Filter event, fired when the filtering applied to the table (using the build in global
|
|
|
|
* global filter, or column filters) is altered.
|
|
|
|
* @name DataTable#filter
|
|
|
|
* @event
|
|
|
|
* @param {event} e jQuery event object
|
|
|
|
* @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Page change event, fired when the paging of the table is altered.
|
|
|
|
* @name DataTable#page
|
|
|
|
* @event
|
|
|
|
* @param {event} e jQuery event object
|
|
|
|
* @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sort event, fired when the sorting applied to the table is altered.
|
|
|
|
* @name DataTable#sort
|
|
|
|
* @event
|
|
|
|
* @param {event} e jQuery event object
|
|
|
|
* @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ajax (XHR) event, fired whenever an Ajax request is completed from a request to
|
|
|
|
* made to the server for new data (note that this trigger is called in fnServerData,
|
|
|
|
* if you override fnServerData and which to use this event, you need to trigger it in
|
|
|
|
* you success function).
|
|
|
|
* @name DataTable#xhr
|
|
|
|
* @event
|
|
|
|
* @param {event} e jQuery event object
|
|
|
|
* @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
|
|
*/
|
2011-12-14 13:35:49 +00:00
|
|
|
}(jQuery, window, document, undefined));
|