0
|
1 /**
|
|
2 * @summary DataTables
|
|
3 * @description Paginate, search and sort HTML tables
|
|
4 * @version 1.9.4
|
|
5 * @file jquery.dataTables.js
|
|
6 * @author Allan Jardine (www.sprymedia.co.uk)
|
|
7 * @contact www.sprymedia.co.uk/contact
|
|
8 *
|
|
9 * @copyright Copyright 2008-2012 Allan Jardine, all rights reserved.
|
|
10 *
|
|
11 * This source file is free software, under either the GPL v2 license or a
|
|
12 * BSD style license, available at:
|
|
13 * http://datatables.net/license_gpl2
|
|
14 * http://datatables.net/license_bsd
|
|
15 *
|
|
16 * This source file is distributed in the hope that it will be useful, but
|
|
17 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
18 * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
|
|
19 *
|
|
20 * For details please refer to: http://www.datatables.net
|
|
21 */
|
|
22
|
|
23 /*jslint evil: true, undef: true, browser: true */
|
|
24 /*globals $, jQuery,define,_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,_fnJsonString,_fnRender,_fnNodeToColumnIndex,_fnInfoMacros,_fnBrowserDetect,_fnGetColumns*/
|
|
25
|
|
26 (/** @lends <global> */function( window, document, undefined ) {
|
|
27
|
|
28 (function( factory ) {
|
|
29 "use strict";
|
|
30
|
|
31 // Define as an AMD module if possible
|
|
32 if ( typeof define === 'function' && define.amd )
|
|
33 {
|
|
34 define( ['jquery'], factory );
|
|
35 }
|
|
36 /* Define using browser globals otherwise
|
|
37 * Prevent multiple instantiations if the script is loaded twice
|
|
38 */
|
|
39 else if ( jQuery && !jQuery.fn.dataTable )
|
|
40 {
|
|
41 factory( jQuery );
|
|
42 }
|
|
43 }
|
|
44 (/** @lends <global> */function( $ ) {
|
|
45 "use strict";
|
|
46 /**
|
|
47 * DataTables is a plug-in for the jQuery Javascript library. It is a
|
|
48 * highly flexible tool, based upon the foundations of progressive
|
|
49 * enhancement, which will add advanced interaction controls to any
|
|
50 * HTML table. For a full list of features please refer to
|
|
51 * <a href="http://datatables.net">DataTables.net</a>.
|
|
52 *
|
|
53 * Note that the <i>DataTable</i> object is not a global variable but is
|
|
54 * aliased to <i>jQuery.fn.DataTable</i> and <i>jQuery.fn.dataTable</i> through which
|
|
55 * it may be accessed.
|
|
56 *
|
|
57 * @class
|
|
58 * @param {object} [oInit={}] Configuration object for DataTables. Options
|
|
59 * are defined by {@link DataTable.defaults}
|
|
60 * @requires jQuery 1.3+
|
|
61 *
|
|
62 * @example
|
|
63 * // Basic initialisation
|
|
64 * $(document).ready( function {
|
|
65 * $('#example').dataTable();
|
|
66 * } );
|
|
67 *
|
|
68 * @example
|
|
69 * // Initialisation with configuration options - in this case, disable
|
|
70 * // pagination and sorting.
|
|
71 * $(document).ready( function {
|
|
72 * $('#example').dataTable( {
|
|
73 * "bPaginate": false,
|
|
74 * "bSort": false
|
|
75 * } );
|
|
76 * } );
|
|
77 */
|
|
78 var DataTable = function( oInit )
|
|
79 {
|
|
80 require('core.columns.js');
|
|
81 require('core.data.js');
|
|
82 require('core.draw.js');
|
|
83 require('core.ajax.js');
|
|
84 require('core.filter.js');
|
|
85 require('core.info.js');
|
|
86 require('core.init.js');
|
|
87 require('core.length.js');
|
|
88 require('core.page.js');
|
|
89 require('core.processing.js');
|
|
90 require('core.scrolling.js');
|
|
91 require('core.sizing.js');
|
|
92 require('core.sort.js');
|
|
93 require('core.state.js');
|
|
94 require('core.support.js');
|
|
95
|
|
96 require('api.methods.js');
|
|
97 require('api.internal.js');
|
|
98
|
|
99 var _that = this;
|
|
100 this.each(function() {
|
|
101 require('core.constructor.js');
|
|
102 } );
|
|
103 _that = null;
|
|
104 return this;
|
|
105 };
|
|
106
|
|
107 require('api.static.js');
|
|
108
|
|
109 /**
|
|
110 * Version string for plug-ins to check compatibility. Allowed format is
|
|
111 * a.b.c.d.e where: a:int, b:int, c:int, d:string(dev|beta), e:int. d and
|
|
112 * e are optional
|
|
113 * @member
|
|
114 * @type string
|
|
115 * @default Version number
|
|
116 */
|
|
117 DataTable.version = "1.9.4";
|
|
118
|
|
119 /**
|
|
120 * Private data store, containing all of the settings objects that are created for the
|
|
121 * tables on a given page.
|
|
122 *
|
|
123 * Note that the <i>DataTable.settings</i> object is aliased to <i>jQuery.fn.dataTableExt</i>
|
|
124 * through which it may be accessed and manipulated, or <i>jQuery.fn.dataTable.settings</i>.
|
|
125 * @member
|
|
126 * @type array
|
|
127 * @default []
|
|
128 * @private
|
|
129 */
|
|
130 DataTable.settings = [];
|
|
131
|
|
132 /**
|
|
133 * Object models container, for the various models that DataTables has available
|
|
134 * to it. These models define the objects that are used to hold the active state
|
|
135 * and configuration of the table.
|
|
136 * @namespace
|
|
137 */
|
|
138 DataTable.models = {};
|
|
139 require('model.ext.js');
|
|
140 require('model.search.js');
|
|
141 require('model.row.js');
|
|
142 require('model.column.js');
|
|
143 require('model.defaults.js');
|
|
144 require('model.defaults.columns.js');
|
|
145 require('model.settings.js');
|
|
146
|
|
147 /**
|
|
148 * Extension object for DataTables that is used to provide all extension options.
|
|
149 *
|
|
150 * Note that the <i>DataTable.ext</i> object is available through
|
|
151 * <i>jQuery.fn.dataTable.ext</i> where it may be accessed and manipulated. It is
|
|
152 * also aliased to <i>jQuery.fn.dataTableExt</i> for historic reasons.
|
|
153 * @namespace
|
|
154 * @extends DataTable.models.ext
|
|
155 */
|
|
156 DataTable.ext = $.extend( true, {}, DataTable.models.ext );
|
|
157 require('ext.classes.js');
|
|
158 require('ext.paging.js');
|
|
159 require('ext.sorting.js');
|
|
160 require('ext.types.js');
|
|
161
|
|
162 // jQuery aliases
|
|
163 $.fn.DataTable = DataTable;
|
|
164 $.fn.dataTable = DataTable;
|
|
165 $.fn.dataTableSettings = DataTable.settings;
|
|
166 $.fn.dataTableExt = DataTable.ext;
|
|
167
|
|
168
|
|
169 // Information about events fired by DataTables - for documentation.
|
|
170 /**
|
|
171 * Draw event, fired whenever the table is redrawn on the page, at the same point as
|
|
172 * fnDrawCallback. This may be useful for binding events or performing calculations when
|
|
173 * the table is altered at all.
|
|
174 * @name DataTable#draw
|
|
175 * @event
|
|
176 * @param {event} e jQuery event object
|
|
177 * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
178 */
|
|
179
|
|
180 /**
|
|
181 * Filter event, fired when the filtering applied to the table (using the build in global
|
|
182 * global filter, or column filters) is altered.
|
|
183 * @name DataTable#filter
|
|
184 * @event
|
|
185 * @param {event} e jQuery event object
|
|
186 * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
187 */
|
|
188
|
|
189 /**
|
|
190 * Page change event, fired when the paging of the table is altered.
|
|
191 * @name DataTable#page
|
|
192 * @event
|
|
193 * @param {event} e jQuery event object
|
|
194 * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
195 */
|
|
196
|
|
197 /**
|
|
198 * Sort event, fired when the sorting applied to the table is altered.
|
|
199 * @name DataTable#sort
|
|
200 * @event
|
|
201 * @param {event} e jQuery event object
|
|
202 * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
203 */
|
|
204
|
|
205 /**
|
|
206 * DataTables initialisation complete event, fired when the table is fully drawn,
|
|
207 * including Ajax data loaded, if Ajax data is required.
|
|
208 * @name DataTable#init
|
|
209 * @event
|
|
210 * @param {event} e jQuery event object
|
|
211 * @param {object} oSettings DataTables settings object
|
|
212 * @param {object} json The JSON object request from the server - only
|
|
213 * present if client-side Ajax sourced data is used</li></ol>
|
|
214 */
|
|
215
|
|
216 /**
|
|
217 * State save event, fired when the table has changed state a new state save is required.
|
|
218 * This method allows modification of the state saving object prior to actually doing the
|
|
219 * save, including addition or other state properties (for plug-ins) or modification
|
|
220 * of a DataTables core property.
|
|
221 * @name DataTable#stateSaveParams
|
|
222 * @event
|
|
223 * @param {event} e jQuery event object
|
|
224 * @param {object} oSettings DataTables settings object
|
|
225 * @param {object} json The state information to be saved
|
|
226 */
|
|
227
|
|
228 /**
|
|
229 * State load event, fired when the table is loading state from the stored data, but
|
|
230 * prior to the settings object being modified by the saved state - allowing modification
|
|
231 * of the saved state is required or loading of state for a plug-in.
|
|
232 * @name DataTable#stateLoadParams
|
|
233 * @event
|
|
234 * @param {event} e jQuery event object
|
|
235 * @param {object} oSettings DataTables settings object
|
|
236 * @param {object} json The saved state information
|
|
237 */
|
|
238
|
|
239 /**
|
|
240 * State loaded event, fired when state has been loaded from stored data and the settings
|
|
241 * object has been modified by the loaded data.
|
|
242 * @name DataTable#stateLoaded
|
|
243 * @event
|
|
244 * @param {event} e jQuery event object
|
|
245 * @param {object} oSettings DataTables settings object
|
|
246 * @param {object} json The saved state information
|
|
247 */
|
|
248
|
|
249 /**
|
|
250 * Processing event, fired when DataTables is doing some kind of processing (be it,
|
|
251 * sort, filter or anything else). Can be used to indicate to the end user that
|
|
252 * there is something happening, or that something has finished.
|
|
253 * @name DataTable#processing
|
|
254 * @event
|
|
255 * @param {event} e jQuery event object
|
|
256 * @param {object} oSettings DataTables settings object
|
|
257 * @param {boolean} bShow Flag for if DataTables is doing processing or not
|
|
258 */
|
|
259
|
|
260 /**
|
|
261 * Ajax (XHR) event, fired whenever an Ajax request is completed from a request to
|
|
262 * made to the server for new data (note that this trigger is called in fnServerData,
|
|
263 * if you override fnServerData and which to use this event, you need to trigger it in
|
|
264 * you success function).
|
|
265 * @name DataTable#xhr
|
|
266 * @event
|
|
267 * @param {event} e jQuery event object
|
|
268 * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
269 * @param {object} json JSON returned from the server
|
|
270 */
|
|
271
|
|
272 /**
|
|
273 * Destroy event, fired when the DataTable is destroyed by calling fnDestroy or passing
|
|
274 * the bDestroy:true parameter in the initialisation object. This can be used to remove
|
|
275 * bound events, added DOM nodes, etc.
|
|
276 * @name DataTable#destroy
|
|
277 * @event
|
|
278 * @param {event} e jQuery event object
|
|
279 * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
280 */
|
|
281 }));
|
|
282
|
|
283 }(window, document));
|
|
284
|