Issues (4542)

js/datatables/src/DataTables.js (5 issues)

Severity
1
/**
2
 * @summary     DataTables
3
 * @description Paginate, search and sort HTML tables
4
 * @version     1.10.0-dev
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,_fnColumnOrdering,_fnLog,_fnClearTable,_fnSaveState,_fnLoadState,_fnDetectHeader,_fnGetUniqueThs,_fnScrollBarWidth,_fnApplyToChildren,_fnMap,_fnGetRowData,_fnGetCellData,_fnSetCellData,_fnGetObjectDataFn,_fnSetObjectDataFn,_fnApplyColumnDefs,_fnBindAction,_fnCallbackReg,_fnCallbackFire,_fnNodeToColumnIndex,_fnInfoMacros,_fnBrowserDetect,_fnGetColumns,_fnHungarianMap,_fnCamelToHungarian*/
25
26
(/** @lends <global> */function( window, document, undefined ) {
0 ignored issues
show
The parameter window is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
The parameter undefined is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
The parameter document is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
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
	/** 
48
	 * DataTables is a plug-in for the jQuery Javascript library. It is a 
49
	 * highly flexible tool, based upon the foundations of progressive 
50
	 * enhancement, which will add advanced interaction controls to any 
51
	 * HTML table. For a full list of features please refer to
52
	 * <a href="http://datatables.net">DataTables.net</a>.
53
	 *
54
	 * Note that the <i>DataTable</i> object is not a global variable but is
55
	 * aliased to <i>jQuery.fn.DataTable</i> and <i>jQuery.fn.dataTable</i> through which 
56
	 * it may be  accessed.
57
	 *
58
	 *  @class
59
	 *  @param {object} [oInit={}] Configuration object for DataTables. Options
60
	 *    are defined by {@link DataTable.defaults}
61
	 *  @requires jQuery 1.3+
62
	 * 
63
	 *  @example
64
	 *    // Basic initialisation
65
	 *    $(document).ready( function {
66
	 *      $('#example').dataTable();
67
	 *    } );
68
	 *  
69
	 *  @example
70
	 *    // Initialisation with configuration options - in this case, disable
71
	 *    // pagination and sorting.
72
	 *    $(document).ready( function {
73
	 *      $('#example').dataTable( {
74
	 *        "bPaginate": false,
75
	 *        "bSort": false 
76
	 *      } );
77
	 *    } );
78
	 */
79
	var DataTable;
80
81
	require('core.compat.js');
82
	require('core.columns.js');
83
	require('core.data.js');
84
	require('core.draw.js');
85
	require('core.ajax.js');
86
	require('core.filter.js');
87
	require('core.info.js');
88
	require('core.init.js');
89
	require('core.length.js');
90
	require('core.page.js');
91
	require('core.processing.js');
92
	require('core.scrolling.js');
93
	require('core.sizing.js');
94
	require('core.sort.js');
95
	require('core.state.js');
96
	require('core.support.js');
97
98
	DataTable = function( oInit )
0 ignored issues
show
The parameter oInit is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
99
	{
100
		require('api.methods.js');
101
		require('api.internal.js');
102
		
103
		var _that = this;
0 ignored issues
show
The variable _that seems to be never used. Consider removing it.
Loading history...
104
		this.each(function() {
105
			require('core.constructor.js');
106
		} );
107
		_that = null;
108
		return this;
109
	};
110
111
	require('api.static.js');
112
113
	/**
114
	 * Version string for plug-ins to check compatibility. Allowed format is
115
	 * `a.b.c-d` where: a:int, b:int, c:int, d:string(dev|beta|alpha). `d` is used
116
	 * only for non-release builds. See http://semver.org/ for more information.
117
	 *  @member
118
	 *  @type string
119
	 *  @default Version number
120
	 */
121
	DataTable.version = "1.10.0-dev";
122
123
	/**
124
	 * Private data store, containing all of the settings objects that are created for the
125
	 * tables on a given page.
126
	 * 
127
	 * Note that the <i>DataTable.settings</i> object is aliased to <i>jQuery.fn.dataTableExt</i> 
128
	 * through which it may be accessed and manipulated, or <i>jQuery.fn.dataTable.settings</i>.
129
	 *  @member
130
	 *  @type array
131
	 *  @default []
132
	 *  @private
133
	 */
134
	DataTable.settings = [];
135
136
	/**
137
	 * Object models container, for the various models that DataTables has available
138
	 * to it. These models define the objects that are used to hold the Aktif state 
139
	 * and configuration of the table.
140
	 *  @namespace
141
	 */
142
	DataTable.models = {};
143
	require('model.ext.js');
144
	require('model.search.js');
145
	require('model.row.js');
146
	require('model.column.js');
147
	require('model.defaults.js');
148
	require('model.defaults.columns.js');
149
	require('model.settings.js');
150
151
	/**
152
	 * Extension object for DataTables that is used to provide all extension options.
153
	 * 
154
	 * Note that the <i>DataTable.ext</i> object is available through
155
	 * <i>jQuery.fn.dataTable.ext</i> where it may be accessed and manipulated. It is
156
	 * also aliased to <i>jQuery.fn.dataTableExt</i> for historic reasons.
157
	 *  @namespace
158
	 *  @extends DataTable.models.ext
159
	 */
160
	DataTable.ext = $.extend( true, {}, DataTable.models.ext );
161
	require('ext.classes.js');
162
	require('ext.paging.js');
163
	require('ext.sorting.js');
164
	require('ext.types.js');
165
166
	// jQuery aliases
167
	$.fn.DataTable = DataTable;
168
	$.fn.dataTable = DataTable;
169
	$.fn.dataTableSettings = DataTable.settings;
170
	$.fn.dataTableExt = DataTable.ext;
171
172
173
	// Information about events fired by DataTables - for documentation.
174
	/**
175
	 * Draw event, fired whenever the table is redrawn on the page, at the same point as
176
	 * fnDrawCallback. This may be useful for binding events or performing calculations when
177
	 * the table is altered at all.
178
	 *  @name DataTable#draw
179
	 *  @event
180
	 *  @param {event} e jQuery event object
181
	 *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}
182
	 */
183
184
	/**
185
	 * Filter event, fired when the filtering applied to the table (using the build in global
186
	 * global filter, or column filters) is altered.
187
	 *  @name DataTable#filter
188
	 *  @event
189
	 *  @param {event} e jQuery event object
190
	 *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}
191
	 */
192
193
	/**
194
	 * Page change event, fired when the paging of the table is altered.
195
	 *  @name DataTable#page
196
	 *  @event
197
	 *  @param {event} e jQuery event object
198
	 *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}
199
	 */
200
201
	/**
202
	 * Sort event, fired when the sorting applied to the table is altered.
203
	 *  @name DataTable#sort
204
	 *  @event
205
	 *  @param {event} e jQuery event object
206
	 *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}
207
	 */
208
209
	/**
210
	 * DataTables initialisation complete event, fired when the table is fully drawn,
211
	 * including Ajax data loaded, if Ajax data is required.
212
	 *  @name DataTable#init
213
	 *  @event
214
	 *  @param {event} e jQuery event object
215
	 *  @param {object} oSettings DataTables settings object
216
	 *  @param {object} json The JSON object request from the server - only
217
	 *    present if client-side Ajax sourced data is used</li></ol>
218
	 */
219
220
	/**
221
	 * State save event, fired when the table has changed state a new state save is required.
222
	 * This method allows modification of the state saving object prior to actually doing the
223
	 * save, including addition or other state properties (for plug-ins) or modification
224
	 * of a DataTables core property.
225
	 *  @name DataTable#stateSaveParams
226
	 *  @event
227
	 *  @param {event} e jQuery event object
228
	 *  @param {object} oSettings DataTables settings object
229
	 *  @param {object} json The state information to be saved
230
	 */
231
232
	/**
233
	 * State load event, fired when the table is loading state from the stored data, but
234
	 * prior to the settings object being modified by the saved state - allowing modification
235
	 * of the saved state is required or loading of state for a plug-in.
236
	 *  @name DataTable#stateLoadParams
237
	 *  @event
238
	 *  @param {event} e jQuery event object
239
	 *  @param {object} oSettings DataTables settings object
240
	 *  @param {object} json The saved state information
241
	 */
242
243
	/**
244
	 * State loaded event, fired when state has been loaded from stored data and the settings
245
	 * object has been modified by the loaded data.
246
	 *  @name DataTable#stateLoaded
247
	 *  @event
248
	 *  @param {event} e jQuery event object
249
	 *  @param {object} oSettings DataTables settings object
250
	 *  @param {object} json The saved state information
251
	 */
252
253
	/**
254
	 * Processing event, fired when DataTables is doing some kind of processing (be it,
255
	 * sort, filter or anything else). Can be used to indicate to the end user that
256
	 * there is something happening, or that something has finished.
257
	 *  @name DataTable#processing
258
	 *  @event
259
	 *  @param {event} e jQuery event object
260
	 *  @param {object} oSettings DataTables settings object
261
	 *  @param {boolean} bShow Flag for if DataTables is doing processing or not
262
	 */
263
264
	/**
265
	 * Ajax (XHR) event, fired whenever an Ajax request is completed from a request to 
266
	 * made to the server for new data (note that this trigger is called in fnServerData,
267
	 * if you override fnServerData and which to use this event, you need to trigger it in
268
	 * you success function).
269
	 *  @name DataTable#xhr
270
	 *  @event
271
	 *  @param {event} e jQuery event object
272
	 *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}
273
	 *  @param {object} json JSON returned from the server
274
	 */
275
276
	/**
277
	 * Destroy event, fired when the DataTable is destroyed by calling fnDestroy or passing
278
	 * the bDestroy:true parameter in the initialisation object. This can be used to remove
279
	 * bound events, added DOM nodes, etc.
280
	 *  @name DataTable#destroy
281
	 *  @event
282
	 *  @param {event} e jQuery event object
283
	 *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}
284
	 */
285
}));
286
287
}(window, document));
288
289