Version Description
Download this release
Release Info
Developer | wfryan |
Plugin | Wordfence Security – Firewall & Malware Scan |
Version | 6.3.18 |
Comparing to | |
See all releases |
Code changes from version 6.3.17 to 6.3.18
- js/jquery.dataTables.js +0 -15321
- js/jquery.dataTables.min.js +2 -137
- lib/menu_options.php +1 -1
- lib/wfActivityReport.php +42 -1
- lib/wfScanEngine.php +2 -2
- lib/wfSchema.php +8 -0
- lib/wordfenceClass.php +17 -1
- lib/wordfenceConstants.php +1 -0
- readme.txt +1 -1
- wordfence.php +2 -2
js/jquery.dataTables.js
DELETED
@@ -1,15321 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* This combined file was created by the WFDataTables downloader builder:
|
3 |
-
* https://datatables.net/download
|
4 |
-
*
|
5 |
-
* To rebuild or modify this file with the latest versions of the included
|
6 |
-
* software please visit:
|
7 |
-
* https://datatables.net/download/#dt/dt-1.10.13
|
8 |
-
*
|
9 |
-
* Included libraries:
|
10 |
-
* WFDataTables 1.10.13
|
11 |
-
*/
|
12 |
-
|
13 |
-
/*! WFDataTables 1.10.13
|
14 |
-
* ©2008-2016 SpryMedia Ltd - datatables.net/license
|
15 |
-
*/
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @summary WFDataTables
|
19 |
-
* @description Paginate, search and order HTML tables
|
20 |
-
* @version 1.10.13
|
21 |
-
* @file jquery.wfDataTables.js
|
22 |
-
* @author SpryMedia Ltd
|
23 |
-
* @contact www.datatables.net
|
24 |
-
* @copyright Copyright 2008-2016 SpryMedia Ltd.
|
25 |
-
*
|
26 |
-
* This source file is free software, available under the following license:
|
27 |
-
* MIT license - http://datatables.net/license
|
28 |
-
*
|
29 |
-
* This source file is distributed in the hope that it will be useful, but
|
30 |
-
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
31 |
-
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
|
32 |
-
*
|
33 |
-
* For details please refer to: http://www.datatables.net
|
34 |
-
*/
|
35 |
-
|
36 |
-
/*jslint evil: true, undef: true, browser: true */
|
37 |
-
/*globals $,require,jQuery,define,_selector_run,_selector_opts,_selector_first,_selector_row_indexes,_ext,_Api,_api_register,_api_registerPlural,_re_new_lines,_re_html,_re_formatted_numeric,_re_escape_regex,_empty,_intVal,_numToDecimal,_isNumber,_isHtml,_htmlNumeric,_pluck,_pluck_order,_range,_stripHtml,_unique,_fnBuildAjax,_fnAjaxUpdate,_fnAjaxParameters,_fnAjaxUpdateDraw,_fnAjaxDataSrc,_fnAddColumn,_fnColumnOptions,_fnAdjustColumnSizing,_fnVisibleToColumnIndex,_fnColumnIndexToVisible,_fnVisbleColumns,_fnGetColumns,_fnColumnTypes,_fnApplyColumnDefs,_fnHungarianMap,_fnCamelToHungarian,_fnLanguageCompat,_fnBrowserDetect,_fnAddData,_fnAddTr,_fnNodeToDataIndex,_fnNodeToColumnIndex,_fnGetCellData,_fnSetCellData,_fnSplitObjNotation,_fnGetObjectDataFn,_fnSetObjectDataFn,_fnGetDataMaster,_fnClearTable,_fnDeleteIndex,_fnInvalidate,_fnGetRowElements,_fnCreateTr,_fnBuildHead,_fnDrawHead,_fnDraw,_fnReDraw,_fnAddOptionsHtml,_fnDetectHeader,_fnGetUniqueThs,_fnFeatureHtmlFilter,_fnFilterComplete,_fnFilterCustom,_fnFilterColumn,_fnFilter,_fnFilterCreateSearch,_fnEscapeRegex,_fnFilterData,_fnFeatureHtmlInfo,_fnUpdateInfo,_fnInfoMacros,_fnInitialise,_fnInitComplete,_fnLengthChange,_fnFeatureHtmlLength,_fnFeatureHtmlPaginate,_fnPageChange,_fnFeatureHtmlProcessing,_fnProcessingDisplay,_fnFeatureHtmlTable,_fnScrollDraw,_fnApplyToChildren,_fnCalculateColumnWidths,_fnThrottle,_fnConvertToWidth,_fnGetWidestNode,_fnGetMaxLenString,_fnStringToCss,_fnSortFlatten,_fnSort,_fnSortAria,_fnSortListener,_fnSortAttachListener,_fnSortingClasses,_fnSortData,_fnSaveState,_fnLoadState,_fnSettingsFromNode,_fnLog,_fnMap,_fnBindAction,_fnCallbackReg,_fnCallbackFire,_fnLengthOverflow,_fnRenderer,_fnDataSource,_fnRowAttributes*/
|
38 |
-
|
39 |
-
(function( factory ) {
|
40 |
-
"use strict";
|
41 |
-
|
42 |
-
if ( typeof define === 'function' && define.amd ) {
|
43 |
-
// AMD
|
44 |
-
define( ['jquery'], function ( $ ) {
|
45 |
-
return factory( $, window, document );
|
46 |
-
} );
|
47 |
-
}
|
48 |
-
else if ( typeof exports === 'object' ) {
|
49 |
-
// CommonJS
|
50 |
-
module.exports = function (root, $) {
|
51 |
-
if ( ! root ) {
|
52 |
-
// CommonJS environments without a window global must pass a
|
53 |
-
// root. This will give an error otherwise
|
54 |
-
root = window;
|
55 |
-
}
|
56 |
-
|
57 |
-
if ( ! $ ) {
|
58 |
-
$ = typeof window !== 'undefined' ? // jQuery's factory checks for a global window
|
59 |
-
require('jquery') :
|
60 |
-
require('jquery')( root );
|
61 |
-
}
|
62 |
-
|
63 |
-
return factory( $, root, root.document );
|
64 |
-
};
|
65 |
-
}
|
66 |
-
else {
|
67 |
-
// Browser
|
68 |
-
factory( jQuery, window, document );
|
69 |
-
}
|
70 |
-
}
|
71 |
-
(function( $, window, document, undefined ) {
|
72 |
-
"use strict";
|
73 |
-
|
74 |
-
/**
|
75 |
-
* WFDataTables is a plug-in for the jQuery Javascript library. It is a highly
|
76 |
-
* flexible tool, based upon the foundations of progressive enhancement,
|
77 |
-
* which will add advanced interaction controls to any HTML table. For a
|
78 |
-
* full list of features please refer to
|
79 |
-
* [WFDataTables.net](href="http://datatables.net).
|
80 |
-
*
|
81 |
-
* Note that the `WFDataTable` object is not a global variable but is aliased
|
82 |
-
* to `jQuery.fn.WFDataTable` and `jQuery.fn.wfDataTable` through which it may
|
83 |
-
* be accessed.
|
84 |
-
*
|
85 |
-
* @class
|
86 |
-
* @param {object} [init={}] Configuration object for WFDataTables. Options
|
87 |
-
* are defined by {@link WFDataTable.defaults}
|
88 |
-
* @requires jQuery 1.7+
|
89 |
-
*
|
90 |
-
* @example
|
91 |
-
* // Basic initialisation
|
92 |
-
* $(document).ready( function {
|
93 |
-
* $('#example').wfDataTable();
|
94 |
-
* } );
|
95 |
-
*
|
96 |
-
* @example
|
97 |
-
* // Initialisation with configuration options - in this case, disable
|
98 |
-
* // pagination and sorting.
|
99 |
-
* $(document).ready( function {
|
100 |
-
* $('#example').wfDataTable( {
|
101 |
-
* "paginate": false,
|
102 |
-
* "sort": false
|
103 |
-
* } );
|
104 |
-
* } );
|
105 |
-
*/
|
106 |
-
var WFDataTable = function ( options )
|
107 |
-
{
|
108 |
-
/**
|
109 |
-
* Perform a jQuery selector action on the table's TR elements (from the tbody) and
|
110 |
-
* return the resulting jQuery object.
|
111 |
-
* @param {string|node|jQuery} sSelector jQuery selector or node collection to act on
|
112 |
-
* @param {object} [oOpts] Optional parameters for modifying the rows to be included
|
113 |
-
* @param {string} [oOpts.filter=none] Select TR elements that meet the current filter
|
114 |
-
* criterion ("applied") or all TR elements (i.e. no filter).
|
115 |
-
* @param {string} [oOpts.order=current] Order of the TR elements in the processed array.
|
116 |
-
* Can be either 'current', whereby the current sorting of the table is used, or
|
117 |
-
* 'original' whereby the original order the data was read into the table is used.
|
118 |
-
* @param {string} [oOpts.page=all] Limit the selection to the currently displayed page
|
119 |
-
* ("current") or not ("all"). If 'current' is given, then order is assumed to be
|
120 |
-
* 'current' and filter is 'applied', regardless of what they might be given as.
|
121 |
-
* @returns {object} jQuery object, filtered by the given selector.
|
122 |
-
* @dtopt API
|
123 |
-
* @deprecated Since v1.10
|
124 |
-
*
|
125 |
-
* @example
|
126 |
-
* $(document).ready(function() {
|
127 |
-
* var oTable = $('#example').wfDataTable();
|
128 |
-
*
|
129 |
-
* // Highlight every second row
|
130 |
-
* oTable.$('tr:odd').css('backgroundColor', 'blue');
|
131 |
-
* } );
|
132 |
-
*
|
133 |
-
* @example
|
134 |
-
* $(document).ready(function() {
|
135 |
-
* var oTable = $('#example').wfDataTable();
|
136 |
-
*
|
137 |
-
* // Filter to rows with 'Webkit' in them, add a background colour and then
|
138 |
-
* // remove the filter, thus highlighting the 'Webkit' rows only.
|
139 |
-
* oTable.fnFilter('Webkit');
|
140 |
-
* oTable.$('tr', {"search": "applied"}).css('backgroundColor', 'blue');
|
141 |
-
* oTable.fnFilter('');
|
142 |
-
* } );
|
143 |
-
*/
|
144 |
-
this.$ = function ( sSelector, oOpts )
|
145 |
-
{
|
146 |
-
return this.api(true).$( sSelector, oOpts );
|
147 |
-
};
|
148 |
-
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Almost identical to $ in operation, but in this case returns the data for the matched
|
152 |
-
* rows - as such, the jQuery selector used should match TR row nodes or TD/TH cell nodes
|
153 |
-
* rather than any descendants, so the data can be obtained for the row/cell. If matching
|
154 |
-
* rows are found, the data returned is the original data array/object that was used to
|
155 |
-
* create the row (or a generated array if from a DOM source).
|
156 |
-
*
|
157 |
-
* This method is often useful in-combination with $ where both functions are given the
|
158 |
-
* same parameters and the array indexes will match identically.
|
159 |
-
* @param {string|node|jQuery} sSelector jQuery selector or node collection to act on
|
160 |
-
* @param {object} [oOpts] Optional parameters for modifying the rows to be included
|
161 |
-
* @param {string} [oOpts.filter=none] Select elements that meet the current filter
|
162 |
-
* criterion ("applied") or all elements (i.e. no filter).
|
163 |
-
* @param {string} [oOpts.order=current] Order of the data in the processed array.
|
164 |
-
* Can be either 'current', whereby the current sorting of the table is used, or
|
165 |
-
* 'original' whereby the original order the data was read into the table is used.
|
166 |
-
* @param {string} [oOpts.page=all] Limit the selection to the currently displayed page
|
167 |
-
* ("current") or not ("all"). If 'current' is given, then order is assumed to be
|
168 |
-
* 'current' and filter is 'applied', regardless of what they might be given as.
|
169 |
-
* @returns {array} Data for the matched elements. If any elements, as a result of the
|
170 |
-
* selector, were not TR, TD or TH elements in the WFDataTable, they will have a null
|
171 |
-
* entry in the array.
|
172 |
-
* @dtopt API
|
173 |
-
* @deprecated Since v1.10
|
174 |
-
*
|
175 |
-
* @example
|
176 |
-
* $(document).ready(function() {
|
177 |
-
* var oTable = $('#example').wfDataTable();
|
178 |
-
*
|
179 |
-
* // Get the data from the first row in the table
|
180 |
-
* var data = oTable._('tr:first');
|
181 |
-
*
|
182 |
-
* // Do something useful with the data
|
183 |
-
* alert( "First cell is: "+data[0] );
|
184 |
-
* } );
|
185 |
-
*
|
186 |
-
* @example
|
187 |
-
* $(document).ready(function() {
|
188 |
-
* var oTable = $('#example').wfDataTable();
|
189 |
-
*
|
190 |
-
* // Filter to 'Webkit' and get all data for
|
191 |
-
* oTable.fnFilter('Webkit');
|
192 |
-
* var data = oTable._('tr', {"search": "applied"});
|
193 |
-
*
|
194 |
-
* // Do something with the data
|
195 |
-
* alert( data.length+" rows matched the search" );
|
196 |
-
* } );
|
197 |
-
*/
|
198 |
-
this._ = function ( sSelector, oOpts )
|
199 |
-
{
|
200 |
-
return this.api(true).rows( sSelector, oOpts ).data();
|
201 |
-
};
|
202 |
-
|
203 |
-
|
204 |
-
/**
|
205 |
-
* Create a WFDataTables Api instance, with the currently selected tables for
|
206 |
-
* the Api's context.
|
207 |
-
* @param {boolean} [traditional=false] Set the API instance's context to be
|
208 |
-
* only the table referred to by the `WFDataTable.ext.iApiIndex` option, as was
|
209 |
-
* used in the API presented by WFDataTables 1.9- (i.e. the traditional mode),
|
210 |
-
* or if all tables captured in the jQuery object should be used.
|
211 |
-
* @return {WFDataTables.Api}
|
212 |
-
*/
|
213 |
-
this.api = function ( traditional )
|
214 |
-
{
|
215 |
-
return traditional ?
|
216 |
-
new _Api(
|
217 |
-
_fnSettingsFromNode( this[ _ext.iApiIndex ] )
|
218 |
-
) :
|
219 |
-
new _Api( this );
|
220 |
-
};
|
221 |
-
|
222 |
-
|
223 |
-
/**
|
224 |
-
* Add a single new row or multiple rows of data to the table. Please note
|
225 |
-
* that this is suitable for client-side processing only - if you are using
|
226 |
-
* server-side processing (i.e. "bServerSide": true), then to add data, you
|
227 |
-
* must add it to the data source, i.e. the server-side, through an Ajax call.
|
228 |
-
* @param {array|object} data The data to be added to the table. This can be:
|
229 |
-
* <ul>
|
230 |
-
* <li>1D array of data - add a single row with the data provided</li>
|
231 |
-
* <li>2D array of arrays - add multiple rows in a single call</li>
|
232 |
-
* <li>object - data object when using <i>mData</i></li>
|
233 |
-
* <li>array of objects - multiple data objects when using <i>mData</i></li>
|
234 |
-
* </ul>
|
235 |
-
* @param {bool} [redraw=true] redraw the table or not
|
236 |
-
* @returns {array} An array of integers, representing the list of indexes in
|
237 |
-
* <i>aoData</i> ({@link WFDataTable.models.oSettings}) that have been added to
|
238 |
-
* the table.
|
239 |
-
* @dtopt API
|
240 |
-
* @deprecated Since v1.10
|
241 |
-
*
|
242 |
-
* @example
|
243 |
-
* // Global var for counter
|
244 |
-
* var giCount = 2;
|
245 |
-
*
|
246 |
-
* $(document).ready(function() {
|
247 |
-
* $('#example').wfDataTable();
|
248 |
-
* } );
|
249 |
-
*
|
250 |
-
* function fnClickAddRow() {
|
251 |
-
* $('#example').wfDataTable().fnAddData( [
|
252 |
-
* giCount+".1",
|
253 |
-
* giCount+".2",
|
254 |
-
* giCount+".3",
|
255 |
-
* giCount+".4" ]
|
256 |
-
* );
|
257 |
-
*
|
258 |
-
* giCount++;
|
259 |
-
* }
|
260 |
-
*/
|
261 |
-
this.fnAddData = function( data, redraw )
|
262 |
-
{
|
263 |
-
var api = this.api( true );
|
264 |
-
|
265 |
-
/* Check if we want to add multiple rows or not */
|
266 |
-
var rows = $.isArray(data) && ( $.isArray(data[0]) || $.isPlainObject(data[0]) ) ?
|
267 |
-
api.rows.add( data ) :
|
268 |
-
api.row.add( data );
|
269 |
-
|
270 |
-
if ( redraw === undefined || redraw ) {
|
271 |
-
api.draw();
|
272 |
-
}
|
273 |
-
|
274 |
-
return rows.flatten().toArray();
|
275 |
-
};
|
276 |
-
|
277 |
-
|
278 |
-
/**
|
279 |
-
* This function will make WFDataTables recalculate the column sizes, based on the data
|
280 |
-
* contained in the table and the sizes applied to the columns (in the DOM, CSS or
|
281 |
-
* through the sWidth parameter). This can be useful when the width of the table's
|
282 |
-
* parent element changes (for example a window resize).
|
283 |
-
* @param {boolean} [bRedraw=true] Redraw the table or not, you will typically want to
|
284 |
-
* @dtopt API
|
285 |
-
* @deprecated Since v1.10
|
286 |
-
*
|
287 |
-
* @example
|
288 |
-
* $(document).ready(function() {
|
289 |
-
* var oTable = $('#example').wfDataTable( {
|
290 |
-
* "sScrollY": "200px",
|
291 |
-
* "bPaginate": false
|
292 |
-
* } );
|
293 |
-
*
|
294 |
-
* $(window).on('resize', function () {
|
295 |
-
* oTable.fnAdjustColumnSizing();
|
296 |
-
* } );
|
297 |
-
* } );
|
298 |
-
*/
|
299 |
-
this.fnAdjustColumnSizing = function ( bRedraw )
|
300 |
-
{
|
301 |
-
var api = this.api( true ).columns.adjust();
|
302 |
-
var settings = api.settings()[0];
|
303 |
-
var scroll = settings.oScroll;
|
304 |
-
|
305 |
-
if ( bRedraw === undefined || bRedraw ) {
|
306 |
-
api.draw( false );
|
307 |
-
}
|
308 |
-
else if ( scroll.sX !== "" || scroll.sY !== "" ) {
|
309 |
-
/* If not redrawing, but scrolling, we want to apply the new column sizes anyway */
|
310 |
-
_fnScrollDraw( settings );
|
311 |
-
}
|
312 |
-
};
|
313 |
-
|
314 |
-
|
315 |
-
/**
|
316 |
-
* Quickly and simply clear a table
|
317 |
-
* @param {bool} [bRedraw=true] redraw the table or not
|
318 |
-
* @dtopt API
|
319 |
-
* @deprecated Since v1.10
|
320 |
-
*
|
321 |
-
* @example
|
322 |
-
* $(document).ready(function() {
|
323 |
-
* var oTable = $('#example').wfDataTable();
|
324 |
-
*
|
325 |
-
* // Immediately 'nuke' the current rows (perhaps waiting for an Ajax callback...)
|
326 |
-
* oTable.fnClearTable();
|
327 |
-
* } );
|
328 |
-
*/
|
329 |
-
this.fnClearTable = function( bRedraw )
|
330 |
-
{
|
331 |
-
var api = this.api( true ).clear();
|
332 |
-
|
333 |
-
if ( bRedraw === undefined || bRedraw ) {
|
334 |
-
api.draw();
|
335 |
-
}
|
336 |
-
};
|
337 |
-
|
338 |
-
|
339 |
-
/**
|
340 |
-
* The exact opposite of 'opening' a row, this function will close any rows which
|
341 |
-
* are currently 'open'.
|
342 |
-
* @param {node} nTr the table row to 'close'
|
343 |
-
* @returns {int} 0 on success, or 1 if failed (can't find the row)
|
344 |
-
* @dtopt API
|
345 |
-
* @deprecated Since v1.10
|
346 |
-
*
|
347 |
-
* @example
|
348 |
-
* $(document).ready(function() {
|
349 |
-
* var oTable;
|
350 |
-
*
|
351 |
-
* // 'open' an information row when a row is clicked on
|
352 |
-
* $('#example tbody tr').click( function () {
|
353 |
-
* if ( oTable.fnIsOpen(this) ) {
|
354 |
-
* oTable.fnClose( this );
|
355 |
-
* } else {
|
356 |
-
* oTable.fnOpen( this, "Temporary row opened", "info_row" );
|
357 |
-
* }
|
358 |
-
* } );
|
359 |
-
*
|
360 |
-
* oTable = $('#example').wfDataTable();
|
361 |
-
* } );
|
362 |
-
*/
|
363 |
-
this.fnClose = function( nTr )
|
364 |
-
{
|
365 |
-
this.api( true ).row( nTr ).child.hide();
|
366 |
-
};
|
367 |
-
|
368 |
-
|
369 |
-
/**
|
370 |
-
* Remove a row for the table
|
371 |
-
* @param {mixed} target The index of the row from aoData to be deleted, or
|
372 |
-
* the TR element you want to delete
|
373 |
-
* @param {function|null} [callBack] Callback function
|
374 |
-
* @param {bool} [redraw=true] Redraw the table or not
|
375 |
-
* @returns {array} The row that was deleted
|
376 |
-
* @dtopt API
|
377 |
-
* @deprecated Since v1.10
|
378 |
-
*
|
379 |
-
* @example
|
380 |
-
* $(document).ready(function() {
|
381 |
-
* var oTable = $('#example').wfDataTable();
|
382 |
-
*
|
383 |
-
* // Immediately remove the first row
|
384 |
-
* oTable.fnDeleteRow( 0 );
|
385 |
-
* } );
|
386 |
-
*/
|
387 |
-
this.fnDeleteRow = function( target, callback, redraw )
|
388 |
-
{
|
389 |
-
var api = this.api( true );
|
390 |
-
var rows = api.rows( target );
|
391 |
-
var settings = rows.settings()[0];
|
392 |
-
var data = settings.aoData[ rows[0][0] ];
|
393 |
-
|
394 |
-
rows.remove();
|
395 |
-
|
396 |
-
if ( callback ) {
|
397 |
-
callback.call( this, settings, data );
|
398 |
-
}
|
399 |
-
|
400 |
-
if ( redraw === undefined || redraw ) {
|
401 |
-
api.draw();
|
402 |
-
}
|
403 |
-
|
404 |
-
return data;
|
405 |
-
};
|
406 |
-
|
407 |
-
|
408 |
-
/**
|
409 |
-
* Restore the table to it's original state in the DOM by removing all of WFDataTables
|
410 |
-
* enhancements, alterations to the DOM structure of the table and event listeners.
|
411 |
-
* @param {boolean} [remove=false] Completely remove the table from the DOM
|
412 |
-
* @dtopt API
|
413 |
-
* @deprecated Since v1.10
|
414 |
-
*
|
415 |
-
* @example
|
416 |
-
* $(document).ready(function() {
|
417 |
-
* // This example is fairly pointless in reality, but shows how fnDestroy can be used
|
418 |
-
* var oTable = $('#example').wfDataTable();
|
419 |
-
* oTable.fnDestroy();
|
420 |
-
* } );
|
421 |
-
*/
|
422 |
-
this.fnDestroy = function ( remove )
|
423 |
-
{
|
424 |
-
this.api( true ).destroy( remove );
|
425 |
-
};
|
426 |
-
|
427 |
-
|
428 |
-
/**
|
429 |
-
* Redraw the table
|
430 |
-
* @param {bool} [complete=true] Re-filter and resort (if enabled) the table before the draw.
|
431 |
-
* @dtopt API
|
432 |
-
* @deprecated Since v1.10
|
433 |
-
*
|
434 |
-
* @example
|
435 |
-
* $(document).ready(function() {
|
436 |
-
* var oTable = $('#example').wfDataTable();
|
437 |
-
*
|
438 |
-
* // Re-draw the table - you wouldn't want to do it here, but it's an example :-)
|
439 |
-
* oTable.fnDraw();
|
440 |
-
* } );
|
441 |
-
*/
|
442 |
-
this.fnDraw = function( complete )
|
443 |
-
{
|
444 |
-
// Note that this isn't an exact match to the old call to _fnDraw - it takes
|
445 |
-
// into account the new data, but can hold position.
|
446 |
-
this.api( true ).draw( complete );
|
447 |
-
};
|
448 |
-
|
449 |
-
|
450 |
-
/**
|
451 |
-
* Filter the input based on data
|
452 |
-
* @param {string} sInput String to filter the table on
|
453 |
-
* @param {int|null} [iColumn] Column to limit filtering to
|
454 |
-
* @param {bool} [bRegex=false] Treat as regular expression or not
|
455 |
-
* @param {bool} [bSmart=true] Perform smart filtering or not
|
456 |
-
* @param {bool} [bShowGlobal=true] Show the input global filter in it's input box(es)
|
457 |
-
* @param {bool} [bCaseInsensitive=true] Do case-insensitive matching (true) or not (false)
|
458 |
-
* @dtopt API
|
459 |
-
* @deprecated Since v1.10
|
460 |
-
*
|
461 |
-
* @example
|
462 |
-
* $(document).ready(function() {
|
463 |
-
* var oTable = $('#example').wfDataTable();
|
464 |
-
*
|
465 |
-
* // Sometime later - filter...
|
466 |
-
* oTable.fnFilter( 'test string' );
|
467 |
-
* } );
|
468 |
-
*/
|
469 |
-
this.fnFilter = function( sInput, iColumn, bRegex, bSmart, bShowGlobal, bCaseInsensitive )
|
470 |
-
{
|
471 |
-
var api = this.api( true );
|
472 |
-
|
473 |
-
if ( iColumn === null || iColumn === undefined ) {
|
474 |
-
api.search( sInput, bRegex, bSmart, bCaseInsensitive );
|
475 |
-
}
|
476 |
-
else {
|
477 |
-
api.column( iColumn ).search( sInput, bRegex, bSmart, bCaseInsensitive );
|
478 |
-
}
|
479 |
-
|
480 |
-
api.draw();
|
481 |
-
};
|
482 |
-
|
483 |
-
|
484 |
-
/**
|
485 |
-
* Get the data for the whole table, an individual row or an individual cell based on the
|
486 |
-
* provided parameters.
|
487 |
-
* @param {int|node} [src] A TR row node, TD/TH cell node or an integer. If given as
|
488 |
-
* a TR node then the data source for the whole row will be returned. If given as a
|
489 |
-
* TD/TH cell node then iCol will be automatically calculated and the data for the
|
490 |
-
* cell returned. If given as an integer, then this is treated as the aoData internal
|
491 |
-
* data index for the row (see fnGetPosition) and the data for that row used.
|
492 |
-
* @param {int} [col] Optional column index that you want the data of.
|
493 |
-
* @returns {array|object|string} If mRow is undefined, then the data for all rows is
|
494 |
-
* returned. If mRow is defined, just data for that row, and is iCol is
|
495 |
-
* defined, only data for the designated cell is returned.
|
496 |
-
* @dtopt API
|
497 |
-
* @deprecated Since v1.10
|
498 |
-
*
|
499 |
-
* @example
|
500 |
-
* // Row data
|
501 |
-
* $(document).ready(function() {
|
502 |
-
* oTable = $('#example').wfDataTable();
|
503 |
-
*
|
504 |
-
* oTable.$('tr').click( function () {
|
505 |
-
* var data = oTable.fnGetData( this );
|
506 |
-
* // ... do something with the array / object of data for the row
|
507 |
-
* } );
|
508 |
-
* } );
|
509 |
-
*
|
510 |
-
* @example
|
511 |
-
* // Individual cell data
|
512 |
-
* $(document).ready(function() {
|
513 |
-
* oTable = $('#example').wfDataTable();
|
514 |
-
*
|
515 |
-
* oTable.$('td').click( function () {
|
516 |
-
* var sData = oTable.fnGetData( this );
|
517 |
-
* alert( 'The cell clicked on had the value of '+sData );
|
518 |
-
* } );
|
519 |
-
* } );
|
520 |
-
*/
|
521 |
-
this.fnGetData = function( src, col )
|
522 |
-
{
|
523 |
-
var api = this.api( true );
|
524 |
-
|
525 |
-
if ( src !== undefined ) {
|
526 |
-
var type = src.nodeName ? src.nodeName.toLowerCase() : '';
|
527 |
-
|
528 |
-
return col !== undefined || type == 'td' || type == 'th' ?
|
529 |
-
api.cell( src, col ).data() :
|
530 |
-
api.row( src ).data() || null;
|
531 |
-
}
|
532 |
-
|
533 |
-
return api.data().toArray();
|
534 |
-
};
|
535 |
-
|
536 |
-
|
537 |
-
/**
|
538 |
-
* Get an array of the TR nodes that are used in the table's body. Note that you will
|
539 |
-
* typically want to use the '$' API method in preference to this as it is more
|
540 |
-
* flexible.
|
541 |
-
* @param {int} [iRow] Optional row index for the TR element you want
|
542 |
-
* @returns {array|node} If iRow is undefined, returns an array of all TR elements
|
543 |
-
* in the table's body, or iRow is defined, just the TR element requested.
|
544 |
-
* @dtopt API
|
545 |
-
* @deprecated Since v1.10
|
546 |
-
*
|
547 |
-
* @example
|
548 |
-
* $(document).ready(function() {
|
549 |
-
* var oTable = $('#example').wfDataTable();
|
550 |
-
*
|
551 |
-
* // Get the nodes from the table
|
552 |
-
* var nNodes = oTable.fnGetNodes( );
|
553 |
-
* } );
|
554 |
-
*/
|
555 |
-
this.fnGetNodes = function( iRow )
|
556 |
-
{
|
557 |
-
var api = this.api( true );
|
558 |
-
|
559 |
-
return iRow !== undefined ?
|
560 |
-
api.row( iRow ).node() :
|
561 |
-
api.rows().nodes().flatten().toArray();
|
562 |
-
};
|
563 |
-
|
564 |
-
|
565 |
-
/**
|
566 |
-
* Get the array indexes of a particular cell from it's DOM element
|
567 |
-
* and column index including hidden columns
|
568 |
-
* @param {node} node this can either be a TR, TD or TH in the table's body
|
569 |
-
* @returns {int} If nNode is given as a TR, then a single index is returned, or
|
570 |
-
* if given as a cell, an array of [row index, column index (visible),
|
571 |
-
* column index (all)] is given.
|
572 |
-
* @dtopt API
|
573 |
-
* @deprecated Since v1.10
|
574 |
-
*
|
575 |
-
* @example
|
576 |
-
* $(document).ready(function() {
|
577 |
-
* $('#example tbody td').click( function () {
|
578 |
-
* // Get the position of the current data from the node
|
579 |
-
* var aPos = oTable.fnGetPosition( this );
|
580 |
-
*
|
581 |
-
* // Get the data array for this row
|
582 |
-
* var aData = oTable.fnGetData( aPos[0] );
|
583 |
-
*
|
584 |
-
* // Update the data array and return the value
|
585 |
-
* aData[ aPos[1] ] = 'clicked';
|
586 |
-
* this.innerHTML = 'clicked';
|
587 |
-
* } );
|
588 |
-
*
|
589 |
-
* // Init WFDataTables
|
590 |
-
* oTable = $('#example').wfDataTable();
|
591 |
-
* } );
|
592 |
-
*/
|
593 |
-
this.fnGetPosition = function( node )
|
594 |
-
{
|
595 |
-
var api = this.api( true );
|
596 |
-
var nodeName = node.nodeName.toUpperCase();
|
597 |
-
|
598 |
-
if ( nodeName == 'TR' ) {
|
599 |
-
return api.row( node ).index();
|
600 |
-
}
|
601 |
-
else if ( nodeName == 'TD' || nodeName == 'TH' ) {
|
602 |
-
var cell = api.cell( node ).index();
|
603 |
-
|
604 |
-
return [
|
605 |
-
cell.row,
|
606 |
-
cell.columnVisible,
|
607 |
-
cell.column
|
608 |
-
];
|
609 |
-
}
|
610 |
-
return null;
|
611 |
-
};
|
612 |
-
|
613 |
-
|
614 |
-
/**
|
615 |
-
* Check to see if a row is 'open' or not.
|
616 |
-
* @param {node} nTr the table row to check
|
617 |
-
* @returns {boolean} true if the row is currently open, false otherwise
|
618 |
-
* @dtopt API
|
619 |
-
* @deprecated Since v1.10
|
620 |
-
*
|
621 |
-
* @example
|
622 |
-
* $(document).ready(function() {
|
623 |
-
* var oTable;
|
624 |
-
*
|
625 |
-
* // 'open' an information row when a row is clicked on
|
626 |
-
* $('#example tbody tr').click( function () {
|
627 |
-
* if ( oTable.fnIsOpen(this) ) {
|
628 |
-
* oTable.fnClose( this );
|
629 |
-
* } else {
|
630 |
-
* oTable.fnOpen( this, "Temporary row opened", "info_row" );
|
631 |
-
* }
|
632 |
-
* } );
|
633 |
-
*
|
634 |
-
* oTable = $('#example').wfDataTable();
|
635 |
-
* } );
|
636 |
-
*/
|
637 |
-
this.fnIsOpen = function( nTr )
|
638 |
-
{
|
639 |
-
return this.api( true ).row( nTr ).child.isShown();
|
640 |
-
};
|
641 |
-
|
642 |
-
|
643 |
-
/**
|
644 |
-
* This function will place a new row directly after a row which is currently
|
645 |
-
* on display on the page, with the HTML contents that is passed into the
|
646 |
-
* function. This can be used, for example, to ask for confirmation that a
|
647 |
-
* particular record should be deleted.
|
648 |
-
* @param {node} nTr The table row to 'open'
|
649 |
-
* @param {string|node|jQuery} mHtml The HTML to put into the row
|
650 |
-
* @param {string} sClass Class to give the new TD cell
|
651 |
-
* @returns {node} The row opened. Note that if the table row passed in as the
|
652 |
-
* first parameter, is not found in the table, this method will silently
|
653 |
-
* return.
|
654 |
-
* @dtopt API
|
655 |
-
* @deprecated Since v1.10
|
656 |
-
*
|
657 |
-
* @example
|
658 |
-
* $(document).ready(function() {
|
659 |
-
* var oTable;
|
660 |
-
*
|
661 |
-
* // 'open' an information row when a row is clicked on
|
662 |
-
* $('#example tbody tr').click( function () {
|
663 |
-
* if ( oTable.fnIsOpen(this) ) {
|
664 |
-
* oTable.fnClose( this );
|
665 |
-
* } else {
|
666 |
-
* oTable.fnOpen( this, "Temporary row opened", "info_row" );
|
667 |
-
* }
|
668 |
-
* } );
|
669 |
-
*
|
670 |
-
* oTable = $('#example').wfDataTable();
|
671 |
-
* } );
|
672 |
-
*/
|
673 |
-
this.fnOpen = function( nTr, mHtml, sClass )
|
674 |
-
{
|
675 |
-
return this.api( true )
|
676 |
-
.row( nTr )
|
677 |
-
.child( mHtml, sClass )
|
678 |
-
.show()
|
679 |
-
.child()[0];
|
680 |
-
};
|
681 |
-
|
682 |
-
|
683 |
-
/**
|
684 |
-
* Change the pagination - provides the internal logic for pagination in a simple API
|
685 |
-
* function. With this function you can have a WFDataTables table go to the next,
|
686 |
-
* previous, first or last pages.
|
687 |
-
* @param {string|int} mAction Paging action to take: "first", "previous", "next" or "last"
|
688 |
-
* or page number to jump to (integer), note that page 0 is the first page.
|
689 |
-
* @param {bool} [bRedraw=true] Redraw the table or not
|
690 |
-
* @dtopt API
|
691 |
-
* @deprecated Since v1.10
|
692 |
-
*
|
693 |
-
* @example
|
694 |
-
* $(document).ready(function() {
|
695 |
-
* var oTable = $('#example').wfDataTable();
|
696 |
-
* oTable.fnPageChange( 'next' );
|
697 |
-
* } );
|
698 |
-
*/
|
699 |
-
this.fnPageChange = function ( mAction, bRedraw )
|
700 |
-
{
|
701 |
-
var api = this.api( true ).page( mAction );
|
702 |
-
|
703 |
-
if ( bRedraw === undefined || bRedraw ) {
|
704 |
-
api.draw(false);
|
705 |
-
}
|
706 |
-
};
|
707 |
-
|
708 |
-
|
709 |
-
/**
|
710 |
-
* Show a particular column
|
711 |
-
* @param {int} iCol The column whose display should be changed
|
712 |
-
* @param {bool} bShow Show (true) or hide (false) the column
|
713 |
-
* @param {bool} [bRedraw=true] Redraw the table or not
|
714 |
-
* @dtopt API
|
715 |
-
* @deprecated Since v1.10
|
716 |
-
*
|
717 |
-
* @example
|
718 |
-
* $(document).ready(function() {
|
719 |
-
* var oTable = $('#example').wfDataTable();
|
720 |
-
*
|
721 |
-
* // Hide the second column after initialisation
|
722 |
-
* oTable.fnSetColumnVis( 1, false );
|
723 |
-
* } );
|
724 |
-
*/
|
725 |
-
this.fnSetColumnVis = function ( iCol, bShow, bRedraw )
|
726 |
-
{
|
727 |
-
var api = this.api( true ).column( iCol ).visible( bShow );
|
728 |
-
|
729 |
-
if ( bRedraw === undefined || bRedraw ) {
|
730 |
-
api.columns.adjust().draw();
|
731 |
-
}
|
732 |
-
};
|
733 |
-
|
734 |
-
|
735 |
-
/**
|
736 |
-
* Get the settings for a particular table for external manipulation
|
737 |
-
* @returns {object} WFDataTables settings object. See
|
738 |
-
* {@link WFDataTable.models.oSettings}
|
739 |
-
* @dtopt API
|
740 |
-
* @deprecated Since v1.10
|
741 |
-
*
|
742 |
-
* @example
|
743 |
-
* $(document).ready(function() {
|
744 |
-
* var oTable = $('#example').wfDataTable();
|
745 |
-
* var oSettings = oTable.fnSettings();
|
746 |
-
*
|
747 |
-
* // Show an example parameter from the settings
|
748 |
-
* alert( oSettings._iDisplayStart );
|
749 |
-
* } );
|
750 |
-
*/
|
751 |
-
this.fnSettings = function()
|
752 |
-
{
|
753 |
-
return _fnSettingsFromNode( this[_ext.iApiIndex] );
|
754 |
-
};
|
755 |
-
|
756 |
-
|
757 |
-
/**
|
758 |
-
* Sort the table by a particular column
|
759 |
-
* @param {int} iCol the data index to sort on. Note that this will not match the
|
760 |
-
* 'display index' if you have hidden data entries
|
761 |
-
* @dtopt API
|
762 |
-
* @deprecated Since v1.10
|
763 |
-
*
|
764 |
-
* @example
|
765 |
-
* $(document).ready(function() {
|
766 |
-
* var oTable = $('#example').wfDataTable();
|
767 |
-
*
|
768 |
-
* // Sort immediately with columns 0 and 1
|
769 |
-
* oTable.fnSort( [ [0,'asc'], [1,'asc'] ] );
|
770 |
-
* } );
|
771 |
-
*/
|
772 |
-
this.fnSort = function( aaSort )
|
773 |
-
{
|
774 |
-
this.api( true ).order( aaSort ).draw();
|
775 |
-
};
|
776 |
-
|
777 |
-
|
778 |
-
/**
|
779 |
-
* Attach a sort listener to an element for a given column
|
780 |
-
* @param {node} nNode the element to attach the sort listener to
|
781 |
-
* @param {int} iColumn the column that a click on this node will sort on
|
782 |
-
* @param {function} [fnCallback] callback function when sort is run
|
783 |
-
* @dtopt API
|
784 |
-
* @deprecated Since v1.10
|
785 |
-
*
|
786 |
-
* @example
|
787 |
-
* $(document).ready(function() {
|
788 |
-
* var oTable = $('#example').wfDataTable();
|
789 |
-
*
|
790 |
-
* // Sort on column 1, when 'sorter' is clicked on
|
791 |
-
* oTable.fnSortListener( document.getElementById('sorter'), 1 );
|
792 |
-
* } );
|
793 |
-
*/
|
794 |
-
this.fnSortListener = function( nNode, iColumn, fnCallback )
|
795 |
-
{
|
796 |
-
this.api( true ).order.listener( nNode, iColumn, fnCallback );
|
797 |
-
};
|
798 |
-
|
799 |
-
|
800 |
-
/**
|
801 |
-
* Update a table cell or row - this method will accept either a single value to
|
802 |
-
* update the cell with, an array of values with one element for each column or
|
803 |
-
* an object in the same format as the original data source. The function is
|
804 |
-
* self-referencing in order to make the multi column updates easier.
|
805 |
-
* @param {object|array|string} mData Data to update the cell/row with
|
806 |
-
* @param {node|int} mRow TR element you want to update or the aoData index
|
807 |
-
* @param {int} [iColumn] The column to update, give as null or undefined to
|
808 |
-
* update a whole row.
|
809 |
-
* @param {bool} [bRedraw=true] Redraw the table or not
|
810 |
-
* @param {bool} [bAction=true] Perform pre-draw actions or not
|
811 |
-
* @returns {int} 0 on success, 1 on error
|
812 |
-
* @dtopt API
|
813 |
-
* @deprecated Since v1.10
|
814 |
-
*
|
815 |
-
* @example
|
816 |
-
* $(document).ready(function() {
|
817 |
-
* var oTable = $('#example').wfDataTable();
|
818 |
-
* oTable.fnUpdate( 'Example update', 0, 0 ); // Single cell
|
819 |
-
* oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], $('tbody tr')[0] ); // Row
|
820 |
-
* } );
|
821 |
-
*/
|
822 |
-
this.fnUpdate = function( mData, mRow, iColumn, bRedraw, bAction )
|
823 |
-
{
|
824 |
-
var api = this.api( true );
|
825 |
-
|
826 |
-
if ( iColumn === undefined || iColumn === null ) {
|
827 |
-
api.row( mRow ).data( mData );
|
828 |
-
}
|
829 |
-
else {
|
830 |
-
api.cell( mRow, iColumn ).data( mData );
|
831 |
-
}
|
832 |
-
|
833 |
-
if ( bAction === undefined || bAction ) {
|
834 |
-
api.columns.adjust();
|
835 |
-
}
|
836 |
-
|
837 |
-
if ( bRedraw === undefined || bRedraw ) {
|
838 |
-
api.draw();
|
839 |
-
}
|
840 |
-
return 0;
|
841 |
-
};
|
842 |
-
|
843 |
-
|
844 |
-
/**
|
845 |
-
* Provide a common method for plug-ins to check the version of WFDataTables being used, in order
|
846 |
-
* to ensure compatibility.
|
847 |
-
* @param {string} sVersion Version string to check for, in the format "X.Y.Z". Note that the
|
848 |
-
* formats "X" and "X.Y" are also acceptable.
|
849 |
-
* @returns {boolean} true if this version of WFDataTables is greater or equal to the required
|
850 |
-
* version, or false if this version of DataTales is not suitable
|
851 |
-
* @method
|
852 |
-
* @dtopt API
|
853 |
-
* @deprecated Since v1.10
|
854 |
-
*
|
855 |
-
* @example
|
856 |
-
* $(document).ready(function() {
|
857 |
-
* var oTable = $('#example').wfDataTable();
|
858 |
-
* alert( oTable.fnVersionCheck( '1.9.0' ) );
|
859 |
-
* } );
|
860 |
-
*/
|
861 |
-
this.fnVersionCheck = _ext.fnVersionCheck;
|
862 |
-
|
863 |
-
|
864 |
-
var _that = this;
|
865 |
-
var emptyInit = options === undefined;
|
866 |
-
var len = this.length;
|
867 |
-
|
868 |
-
if ( emptyInit ) {
|
869 |
-
options = {};
|
870 |
-
}
|
871 |
-
|
872 |
-
this.oApi = this.internal = _ext.internal;
|
873 |
-
|
874 |
-
// Extend with old style plug-in API methods
|
875 |
-
for ( var fn in WFDataTable.ext.internal ) {
|
876 |
-
if ( fn ) {
|
877 |
-
this[fn] = _fnExternApiFunc(fn);
|
878 |
-
}
|
879 |
-
}
|
880 |
-
|
881 |
-
this.each(function() {
|
882 |
-
// For each initialisation we want to give it a clean initialisation
|
883 |
-
// object that can be bashed around
|
884 |
-
var o = {};
|
885 |
-
var oInit = len > 1 ? // optimisation for single table case
|
886 |
-
_fnExtend( o, options, true ) :
|
887 |
-
options;
|
888 |
-
|
889 |
-
/*global oInit,_that,emptyInit*/
|
890 |
-
var i=0, iLen, j, jLen, k, kLen;
|
891 |
-
var sId = this.getAttribute( 'id' );
|
892 |
-
var bInitHandedOff = false;
|
893 |
-
var defaults = WFDataTable.defaults;
|
894 |
-
var $this = $(this);
|
895 |
-
|
896 |
-
|
897 |
-
/* Sanity check */
|
898 |
-
if ( this.nodeName.toLowerCase() != 'table' )
|
899 |
-
{
|
900 |
-
_fnLog( null, 0, 'Non-table node initialisation ('+this.nodeName+')', 2 );
|
901 |
-
return;
|
902 |
-
}
|
903 |
-
|
904 |
-
/* Backwards compatibility for the defaults */
|
905 |
-
_fnCompatOpts( defaults );
|
906 |
-
_fnCompatCols( defaults.column );
|
907 |
-
|
908 |
-
/* Convert the camel-case defaults to Hungarian */
|
909 |
-
_fnCamelToHungarian( defaults, defaults, true );
|
910 |
-
_fnCamelToHungarian( defaults.column, defaults.column, true );
|
911 |
-
|
912 |
-
/* Setting up the initialisation object */
|
913 |
-
_fnCamelToHungarian( defaults, $.extend( oInit, $this.data() ) );
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
/* Check to see if we are re-initialising a table */
|
918 |
-
var allSettings = WFDataTable.settings;
|
919 |
-
for ( i=0, iLen=allSettings.length ; i<iLen ; i++ )
|
920 |
-
{
|
921 |
-
var s = allSettings[i];
|
922 |
-
|
923 |
-
/* Base check on table node */
|
924 |
-
if ( s.nTable == this || s.nTHead.parentNode == this || (s.nTFoot && s.nTFoot.parentNode == this) )
|
925 |
-
{
|
926 |
-
var bRetrieve = oInit.bRetrieve !== undefined ? oInit.bRetrieve : defaults.bRetrieve;
|
927 |
-
var bDestroy = oInit.bDestroy !== undefined ? oInit.bDestroy : defaults.bDestroy;
|
928 |
-
|
929 |
-
if ( emptyInit || bRetrieve )
|
930 |
-
{
|
931 |
-
return s.oInstance;
|
932 |
-
}
|
933 |
-
else if ( bDestroy )
|
934 |
-
{
|
935 |
-
s.oInstance.fnDestroy();
|
936 |
-
break;
|
937 |
-
}
|
938 |
-
else
|
939 |
-
{
|
940 |
-
_fnLog( s, 0, 'Cannot reinitialise WFDataTable', 3 );
|
941 |
-
return;
|
942 |
-
}
|
943 |
-
}
|
944 |
-
|
945 |
-
/* If the element we are initialising has the same ID as a table which was previously
|
946 |
-
* initialised, but the table nodes don't match (from before) then we destroy the old
|
947 |
-
* instance by simply deleting it. This is under the assumption that the table has been
|
948 |
-
* destroyed by other methods. Anyone using non-id selectors will need to do this manually
|
949 |
-
*/
|
950 |
-
if ( s.sTableId == this.id )
|
951 |
-
{
|
952 |
-
allSettings.splice( i, 1 );
|
953 |
-
break;
|
954 |
-
}
|
955 |
-
}
|
956 |
-
|
957 |
-
/* Ensure the table has an ID - required for accessibility */
|
958 |
-
if ( sId === null || sId === "" )
|
959 |
-
{
|
960 |
-
sId = "WFDataTables_Table_"+(WFDataTable.ext._unique++);
|
961 |
-
this.id = sId;
|
962 |
-
}
|
963 |
-
|
964 |
-
/* Create the settings object for this table and set some of the default parameters */
|
965 |
-
var oSettings = $.extend( true, {}, WFDataTable.models.oSettings, {
|
966 |
-
"sDestroyWidth": $this[0].style.width,
|
967 |
-
"sInstance": sId,
|
968 |
-
"sTableId": sId
|
969 |
-
} );
|
970 |
-
oSettings.nTable = this;
|
971 |
-
oSettings.oApi = _that.internal;
|
972 |
-
oSettings.oInit = oInit;
|
973 |
-
|
974 |
-
allSettings.push( oSettings );
|
975 |
-
|
976 |
-
// Need to add the instance after the instance after the settings object has been added
|
977 |
-
// to the settings array, so we can self reference the table instance if more than one
|
978 |
-
oSettings.oInstance = (_that.length===1) ? _that : $this.wfDataTable();
|
979 |
-
|
980 |
-
// Backwards compatibility, before we apply all the defaults
|
981 |
-
_fnCompatOpts( oInit );
|
982 |
-
|
983 |
-
if ( oInit.oLanguage )
|
984 |
-
{
|
985 |
-
_fnLanguageCompat( oInit.oLanguage );
|
986 |
-
}
|
987 |
-
|
988 |
-
// If the length menu is given, but the init display length is not, use the length menu
|
989 |
-
if ( oInit.aLengthMenu && ! oInit.iDisplayLength )
|
990 |
-
{
|
991 |
-
oInit.iDisplayLength = $.isArray( oInit.aLengthMenu[0] ) ?
|
992 |
-
oInit.aLengthMenu[0][0] : oInit.aLengthMenu[0];
|
993 |
-
}
|
994 |
-
|
995 |
-
// Apply the defaults and init options to make a single init object will all
|
996 |
-
// options defined from defaults and instance options.
|
997 |
-
oInit = _fnExtend( $.extend( true, {}, defaults ), oInit );
|
998 |
-
|
999 |
-
|
1000 |
-
// Map the initialisation options onto the settings object
|
1001 |
-
_fnMap( oSettings.oFeatures, oInit, [
|
1002 |
-
"bPaginate",
|
1003 |
-
"bLengthChange",
|
1004 |
-
"bFilter",
|
1005 |
-
"bSort",
|
1006 |
-
"bSortMulti",
|
1007 |
-
"bInfo",
|
1008 |
-
"bProcessing",
|
1009 |
-
"bAutoWidth",
|
1010 |
-
"bSortClasses",
|
1011 |
-
"bServerSide",
|
1012 |
-
"bDeferRender"
|
1013 |
-
] );
|
1014 |
-
_fnMap( oSettings, oInit, [
|
1015 |
-
"asStripeClasses",
|
1016 |
-
"ajax",
|
1017 |
-
"fnServerData",
|
1018 |
-
"fnFormatNumber",
|
1019 |
-
"sServerMethod",
|
1020 |
-
"aaSorting",
|
1021 |
-
"aaSortingFixed",
|
1022 |
-
"aLengthMenu",
|
1023 |
-
"sPaginationType",
|
1024 |
-
"sAjaxSource",
|
1025 |
-
"sAjaxDataProp",
|
1026 |
-
"iStateDuration",
|
1027 |
-
"sDom",
|
1028 |
-
"bSortCellsTop",
|
1029 |
-
"iTabIndex",
|
1030 |
-
"fnStateLoadCallback",
|
1031 |
-
"fnStateSaveCallback",
|
1032 |
-
"renderer",
|
1033 |
-
"searchDelay",
|
1034 |
-
"rowId",
|
1035 |
-
[ "iCookieDuration", "iStateDuration" ], // backwards compat
|
1036 |
-
[ "oSearch", "oPreviousSearch" ],
|
1037 |
-
[ "aoSearchCols", "aoPreSearchCols" ],
|
1038 |
-
[ "iDisplayLength", "_iDisplayLength" ],
|
1039 |
-
[ "bJQueryUI", "bJUI" ]
|
1040 |
-
] );
|
1041 |
-
_fnMap( oSettings.oScroll, oInit, [
|
1042 |
-
[ "sScrollX", "sX" ],
|
1043 |
-
[ "sScrollXInner", "sXInner" ],
|
1044 |
-
[ "sScrollY", "sY" ],
|
1045 |
-
[ "bScrollCollapse", "bCollapse" ]
|
1046 |
-
] );
|
1047 |
-
_fnMap( oSettings.oLanguage, oInit, "fnInfoCallback" );
|
1048 |
-
|
1049 |
-
/* Callback functions which are array driven */
|
1050 |
-
_fnCallbackReg( oSettings, 'aoDrawCallback', oInit.fnDrawCallback, 'user' );
|
1051 |
-
_fnCallbackReg( oSettings, 'aoServerParams', oInit.fnServerParams, 'user' );
|
1052 |
-
_fnCallbackReg( oSettings, 'aoStateSaveParams', oInit.fnStateSaveParams, 'user' );
|
1053 |
-
_fnCallbackReg( oSettings, 'aoStateLoadParams', oInit.fnStateLoadParams, 'user' );
|
1054 |
-
_fnCallbackReg( oSettings, 'aoStateLoaded', oInit.fnStateLoaded, 'user' );
|
1055 |
-
_fnCallbackReg( oSettings, 'aoRowCallback', oInit.fnRowCallback, 'user' );
|
1056 |
-
_fnCallbackReg( oSettings, 'aoRowCreatedCallback', oInit.fnCreatedRow, 'user' );
|
1057 |
-
_fnCallbackReg( oSettings, 'aoHeaderCallback', oInit.fnHeaderCallback, 'user' );
|
1058 |
-
_fnCallbackReg( oSettings, 'aoFooterCallback', oInit.fnFooterCallback, 'user' );
|
1059 |
-
_fnCallbackReg( oSettings, 'aoInitComplete', oInit.fnInitComplete, 'user' );
|
1060 |
-
_fnCallbackReg( oSettings, 'aoPreDrawCallback', oInit.fnPreDrawCallback, 'user' );
|
1061 |
-
|
1062 |
-
oSettings.rowIdFn = _fnGetObjectDataFn( oInit.rowId );
|
1063 |
-
|
1064 |
-
/* Browser support detection */
|
1065 |
-
_fnBrowserDetect( oSettings );
|
1066 |
-
|
1067 |
-
var oClasses = oSettings.oClasses;
|
1068 |
-
|
1069 |
-
// @todo Remove in 1.11
|
1070 |
-
if ( oInit.bJQueryUI )
|
1071 |
-
{
|
1072 |
-
/* Use the JUI classes object for display. You could clone the oStdClasses object if
|
1073 |
-
* you want to have multiple tables with multiple independent classes
|
1074 |
-
*/
|
1075 |
-
$.extend( oClasses, WFDataTable.ext.oJUIClasses, oInit.oClasses );
|
1076 |
-
|
1077 |
-
if ( oInit.sDom === defaults.sDom && defaults.sDom === "lfrtip" )
|
1078 |
-
{
|
1079 |
-
/* Set the DOM to use a layout suitable for jQuery UI's theming */
|
1080 |
-
oSettings.sDom = '<"H"lfr>t<"F"ip>';
|
1081 |
-
}
|
1082 |
-
|
1083 |
-
if ( ! oSettings.renderer ) {
|
1084 |
-
oSettings.renderer = 'jqueryui';
|
1085 |
-
}
|
1086 |
-
else if ( $.isPlainObject( oSettings.renderer ) && ! oSettings.renderer.header ) {
|
1087 |
-
oSettings.renderer.header = 'jqueryui';
|
1088 |
-
}
|
1089 |
-
}
|
1090 |
-
else
|
1091 |
-
{
|
1092 |
-
$.extend( oClasses, WFDataTable.ext.classes, oInit.oClasses );
|
1093 |
-
}
|
1094 |
-
$this.addClass( oClasses.sTable );
|
1095 |
-
|
1096 |
-
|
1097 |
-
if ( oSettings.iInitDisplayStart === undefined )
|
1098 |
-
{
|
1099 |
-
/* Display start point, taking into account the save saving */
|
1100 |
-
oSettings.iInitDisplayStart = oInit.iDisplayStart;
|
1101 |
-
oSettings._iDisplayStart = oInit.iDisplayStart;
|
1102 |
-
}
|
1103 |
-
|
1104 |
-
if ( oInit.iDeferLoading !== null )
|
1105 |
-
{
|
1106 |
-
oSettings.bDeferLoading = true;
|
1107 |
-
var tmp = $.isArray( oInit.iDeferLoading );
|
1108 |
-
oSettings._iRecordsDisplay = tmp ? oInit.iDeferLoading[0] : oInit.iDeferLoading;
|
1109 |
-
oSettings._iRecordsTotal = tmp ? oInit.iDeferLoading[1] : oInit.iDeferLoading;
|
1110 |
-
}
|
1111 |
-
|
1112 |
-
/* Language definitions */
|
1113 |
-
var oLanguage = oSettings.oLanguage;
|
1114 |
-
$.extend( true, oLanguage, oInit.oLanguage );
|
1115 |
-
|
1116 |
-
if ( oLanguage.sUrl )
|
1117 |
-
{
|
1118 |
-
/* Get the language definitions from a file - because this Ajax call makes the language
|
1119 |
-
* get async to the remainder of this function we use bInitHandedOff to indicate that
|
1120 |
-
* _fnInitialise will be fired by the returned Ajax handler, rather than the constructor
|
1121 |
-
*/
|
1122 |
-
$.ajax( {
|
1123 |
-
dataType: 'json',
|
1124 |
-
url: oLanguage.sUrl,
|
1125 |
-
success: function ( json ) {
|
1126 |
-
_fnLanguageCompat( json );
|
1127 |
-
_fnCamelToHungarian( defaults.oLanguage, json );
|
1128 |
-
$.extend( true, oLanguage, json );
|
1129 |
-
_fnInitialise( oSettings );
|
1130 |
-
},
|
1131 |
-
error: function () {
|
1132 |
-
// Error occurred loading language file, continue on as best we can
|
1133 |
-
_fnInitialise( oSettings );
|
1134 |
-
}
|
1135 |
-
} );
|
1136 |
-
bInitHandedOff = true;
|
1137 |
-
}
|
1138 |
-
|
1139 |
-
/*
|
1140 |
-
* Stripes
|
1141 |
-
*/
|
1142 |
-
if ( oInit.asStripeClasses === null )
|
1143 |
-
{
|
1144 |
-
oSettings.asStripeClasses =[
|
1145 |
-
oClasses.sStripeOdd,
|
1146 |
-
oClasses.sStripeEven
|
1147 |
-
];
|
1148 |
-
}
|
1149 |
-
|
1150 |
-
/* Remove row stripe classes if they are already on the table row */
|
1151 |
-
var stripeClasses = oSettings.asStripeClasses;
|
1152 |
-
var rowOne = $this.children('tbody').find('tr').eq(0);
|
1153 |
-
if ( $.inArray( true, $.map( stripeClasses, function(el, i) {
|
1154 |
-
return rowOne.hasClass(el);
|
1155 |
-
} ) ) !== -1 ) {
|
1156 |
-
$('tbody tr', this).removeClass( stripeClasses.join(' ') );
|
1157 |
-
oSettings.asDestroyStripes = stripeClasses.slice();
|
1158 |
-
}
|
1159 |
-
|
1160 |
-
/*
|
1161 |
-
* Columns
|
1162 |
-
* See if we should load columns automatically or use defined ones
|
1163 |
-
*/
|
1164 |
-
var anThs = [];
|
1165 |
-
var aoColumnsInit;
|
1166 |
-
var nThead = this.getElementsByTagName('thead');
|
1167 |
-
if ( nThead.length !== 0 )
|
1168 |
-
{
|
1169 |
-
_fnDetectHeader( oSettings.aoHeader, nThead[0] );
|
1170 |
-
anThs = _fnGetUniqueThs( oSettings );
|
1171 |
-
}
|
1172 |
-
|
1173 |
-
/* If not given a column array, generate one with nulls */
|
1174 |
-
if ( oInit.aoColumns === null )
|
1175 |
-
{
|
1176 |
-
aoColumnsInit = [];
|
1177 |
-
for ( i=0, iLen=anThs.length ; i<iLen ; i++ )
|
1178 |
-
{
|
1179 |
-
aoColumnsInit.push( null );
|
1180 |
-
}
|
1181 |
-
}
|
1182 |
-
else
|
1183 |
-
{
|
1184 |
-
aoColumnsInit = oInit.aoColumns;
|
1185 |
-
}
|
1186 |
-
|
1187 |
-
/* Add the columns */
|
1188 |
-
for ( i=0, iLen=aoColumnsInit.length ; i<iLen ; i++ )
|
1189 |
-
{
|
1190 |
-
_fnAddColumn( oSettings, anThs ? anThs[i] : null );
|
1191 |
-
}
|
1192 |
-
|
1193 |
-
/* Apply the column definitions */
|
1194 |
-
_fnApplyColumnDefs( oSettings, oInit.aoColumnDefs, aoColumnsInit, function (iCol, oDef) {
|
1195 |
-
_fnColumnOptions( oSettings, iCol, oDef );
|
1196 |
-
} );
|
1197 |
-
|
1198 |
-
/* HTML5 attribute detection - build an mData object automatically if the
|
1199 |
-
* attributes are found
|
1200 |
-
*/
|
1201 |
-
if ( rowOne.length ) {
|
1202 |
-
var a = function ( cell, name ) {
|
1203 |
-
return cell.getAttribute( 'data-'+name ) !== null ? name : null;
|
1204 |
-
};
|
1205 |
-
|
1206 |
-
$( rowOne[0] ).children('th, td').each( function (i, cell) {
|
1207 |
-
var col = oSettings.aoColumns[i];
|
1208 |
-
|
1209 |
-
if ( col.mData === i ) {
|
1210 |
-
var sort = a( cell, 'sort' ) || a( cell, 'order' );
|
1211 |
-
var filter = a( cell, 'filter' ) || a( cell, 'search' );
|
1212 |
-
|
1213 |
-
if ( sort !== null || filter !== null ) {
|
1214 |
-
col.mData = {
|
1215 |
-
_: i+'.display',
|
1216 |
-
sort: sort !== null ? i+'.@data-'+sort : undefined,
|
1217 |
-
type: sort !== null ? i+'.@data-'+sort : undefined,
|
1218 |
-
filter: filter !== null ? i+'.@data-'+filter : undefined
|
1219 |
-
};
|
1220 |
-
|
1221 |
-
_fnColumnOptions( oSettings, i );
|
1222 |
-
}
|
1223 |
-
}
|
1224 |
-
} );
|
1225 |
-
}
|
1226 |
-
|
1227 |
-
var features = oSettings.oFeatures;
|
1228 |
-
var loadedInit = function () {
|
1229 |
-
/*
|
1230 |
-
* Sorting
|
1231 |
-
* @todo For modularisation (1.11) this needs to do into a sort start up handler
|
1232 |
-
*/
|
1233 |
-
|
1234 |
-
// If aaSorting is not defined, then we use the first indicator in asSorting
|
1235 |
-
// in case that has been altered, so the default sort reflects that option
|
1236 |
-
if ( oInit.aaSorting === undefined ) {
|
1237 |
-
var sorting = oSettings.aaSorting;
|
1238 |
-
for ( i=0, iLen=sorting.length ; i<iLen ; i++ ) {
|
1239 |
-
sorting[i][1] = oSettings.aoColumns[ i ].asSorting[0];
|
1240 |
-
}
|
1241 |
-
}
|
1242 |
-
|
1243 |
-
/* Do a first pass on the sorting classes (allows any size changes to be taken into
|
1244 |
-
* account, and also will apply sorting disabled classes if disabled
|
1245 |
-
*/
|
1246 |
-
_fnSortingClasses( oSettings );
|
1247 |
-
|
1248 |
-
if ( features.bSort ) {
|
1249 |
-
_fnCallbackReg( oSettings, 'aoDrawCallback', function () {
|
1250 |
-
if ( oSettings.bSorted ) {
|
1251 |
-
var aSort = _fnSortFlatten( oSettings );
|
1252 |
-
var sortedColumns = {};
|
1253 |
-
|
1254 |
-
$.each( aSort, function (i, val) {
|
1255 |
-
sortedColumns[ val.src ] = val.dir;
|
1256 |
-
} );
|
1257 |
-
|
1258 |
-
_fnCallbackFire( oSettings, null, 'order', [oSettings, aSort, sortedColumns] );
|
1259 |
-
_fnSortAria( oSettings );
|
1260 |
-
}
|
1261 |
-
} );
|
1262 |
-
}
|
1263 |
-
|
1264 |
-
_fnCallbackReg( oSettings, 'aoDrawCallback', function () {
|
1265 |
-
if ( oSettings.bSorted || _fnDataSource( oSettings ) === 'ssp' || features.bDeferRender ) {
|
1266 |
-
_fnSortingClasses( oSettings );
|
1267 |
-
}
|
1268 |
-
}, 'sc' );
|
1269 |
-
|
1270 |
-
|
1271 |
-
/*
|
1272 |
-
* Final init
|
1273 |
-
* Cache the header, body and footer as required, creating them if needed
|
1274 |
-
*/
|
1275 |
-
|
1276 |
-
// Work around for Webkit bug 83867 - store the caption-side before removing from doc
|
1277 |
-
var captions = $this.children('caption').each( function () {
|
1278 |
-
this._captionSide = $(this).css('caption-side');
|
1279 |
-
} );
|
1280 |
-
|
1281 |
-
var thead = $this.children('thead');
|
1282 |
-
if ( thead.length === 0 ) {
|
1283 |
-
thead = $('<thead/>').appendTo($this);
|
1284 |
-
}
|
1285 |
-
oSettings.nTHead = thead[0];
|
1286 |
-
|
1287 |
-
var tbody = $this.children('tbody');
|
1288 |
-
if ( tbody.length === 0 ) {
|
1289 |
-
tbody = $('<tbody/>').appendTo($this);
|
1290 |
-
}
|
1291 |
-
oSettings.nTBody = tbody[0];
|
1292 |
-
|
1293 |
-
var tfoot = $this.children('tfoot');
|
1294 |
-
if ( tfoot.length === 0 && captions.length > 0 && (oSettings.oScroll.sX !== "" || oSettings.oScroll.sY !== "") ) {
|
1295 |
-
// If we are a scrolling table, and no footer has been given, then we need to create
|
1296 |
-
// a tfoot element for the caption element to be appended to
|
1297 |
-
tfoot = $('<tfoot/>').appendTo($this);
|
1298 |
-
}
|
1299 |
-
|
1300 |
-
if ( tfoot.length === 0 || tfoot.children().length === 0 ) {
|
1301 |
-
$this.addClass( oClasses.sNoFooter );
|
1302 |
-
}
|
1303 |
-
else if ( tfoot.length > 0 ) {
|
1304 |
-
oSettings.nTFoot = tfoot[0];
|
1305 |
-
_fnDetectHeader( oSettings.aoFooter, oSettings.nTFoot );
|
1306 |
-
}
|
1307 |
-
|
1308 |
-
/* Check if there is data passing into the constructor */
|
1309 |
-
if ( oInit.aaData ) {
|
1310 |
-
for ( i=0 ; i<oInit.aaData.length ; i++ ) {
|
1311 |
-
_fnAddData( oSettings, oInit.aaData[ i ] );
|
1312 |
-
}
|
1313 |
-
}
|
1314 |
-
else if ( oSettings.bDeferLoading || _fnDataSource( oSettings ) == 'dom' ) {
|
1315 |
-
/* Grab the data from the page - only do this when deferred loading or no Ajax
|
1316 |
-
* source since there is no point in reading the DOM data if we are then going
|
1317 |
-
* to replace it with Ajax data
|
1318 |
-
*/
|
1319 |
-
_fnAddTr( oSettings, $(oSettings.nTBody).children('tr') );
|
1320 |
-
}
|
1321 |
-
|
1322 |
-
/* Copy the data index array */
|
1323 |
-
oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
|
1324 |
-
|
1325 |
-
/* Initialisation complete - table can be drawn */
|
1326 |
-
oSettings.bInitialised = true;
|
1327 |
-
|
1328 |
-
/* Check if we need to initialise the table (it might not have been handed off to the
|
1329 |
-
* language processor)
|
1330 |
-
*/
|
1331 |
-
if ( bInitHandedOff === false ) {
|
1332 |
-
_fnInitialise( oSettings );
|
1333 |
-
}
|
1334 |
-
};
|
1335 |
-
|
1336 |
-
/* Must be done after everything which can be overridden by the state saving! */
|
1337 |
-
if ( oInit.bStateSave )
|
1338 |
-
{
|
1339 |
-
features.bStateSave = true;
|
1340 |
-
_fnCallbackReg( oSettings, 'aoDrawCallback', _fnSaveState, 'state_save' );
|
1341 |
-
_fnLoadState( oSettings, oInit, loadedInit );
|
1342 |
-
}
|
1343 |
-
else {
|
1344 |
-
loadedInit();
|
1345 |
-
}
|
1346 |
-
|
1347 |
-
} );
|
1348 |
-
_that = null;
|
1349 |
-
return this;
|
1350 |
-
};
|
1351 |
-
|
1352 |
-
|
1353 |
-
/*
|
1354 |
-
* It is useful to have variables which are scoped locally so only the
|
1355 |
-
* WFDataTables functions can access them and they don't leak into global space.
|
1356 |
-
* At the same time these functions are often useful over multiple files in the
|
1357 |
-
* core and API, so we list, or at least document, all variables which are used
|
1358 |
-
* by WFDataTables as private variables here. This also ensures that there is no
|
1359 |
-
* clashing of variable names and that they can easily referenced for reuse.
|
1360 |
-
*/
|
1361 |
-
|
1362 |
-
|
1363 |
-
// Defined else where
|
1364 |
-
// _selector_run
|
1365 |
-
// _selector_opts
|
1366 |
-
// _selector_first
|
1367 |
-
// _selector_row_indexes
|
1368 |
-
|
1369 |
-
var _ext; // WFDataTable.ext
|
1370 |
-
var _Api; // WFDataTable.Api
|
1371 |
-
var _api_register; // WFDataTable.Api.register
|
1372 |
-
var _api_registerPlural; // WFDataTable.Api.registerPlural
|
1373 |
-
|
1374 |
-
var _re_dic = {};
|
1375 |
-
var _re_new_lines = /[\r\n]/g;
|
1376 |
-
var _re_html = /<.*?>/g;
|
1377 |
-
|
1378 |
-
// This is not strict ISO8601 - Date.parse() is quite lax, although
|
1379 |
-
// implementations differ between browsers.
|
1380 |
-
var _re_date = /^\d{2,4}[\.\/\-]\d{1,2}[\.\/\-]\d{1,2}([T ]{1}\d{1,2}[:\.]\d{2}([\.:]\d{2})?)?$/;
|
1381 |
-
|
1382 |
-
// Escape regular expression special characters
|
1383 |
-
var _re_escape_regex = new RegExp( '(\\' + [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$', '^', '-' ].join('|\\') + ')', 'g' );
|
1384 |
-
|
1385 |
-
// http://en.wikipedia.org/wiki/Foreign_exchange_market
|
1386 |
-
// - \u20BD - Russian ruble.
|
1387 |
-
// - \u20a9 - South Korean Won
|
1388 |
-
// - \u20BA - Turkish Lira
|
1389 |
-
// - \u20B9 - Indian Rupee
|
1390 |
-
// - R - Brazil (R$) and South Africa
|
1391 |
-
// - fr - Swiss Franc
|
1392 |
-
// - kr - Swedish krona, Norwegian krone and Danish krone
|
1393 |
-
// - \u2009 is thin space and \u202F is narrow no-break space, both used in many
|
1394 |
-
// standards as thousands separators.
|
1395 |
-
var _re_formatted_numeric = /[',$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfk]/gi;
|
1396 |
-
|
1397 |
-
|
1398 |
-
var _empty = function ( d ) {
|
1399 |
-
return !d || d === true || d === '-' ? true : false;
|
1400 |
-
};
|
1401 |
-
|
1402 |
-
|
1403 |
-
var _intVal = function ( s ) {
|
1404 |
-
var integer = parseInt( s, 10 );
|
1405 |
-
return !isNaN(integer) && isFinite(s) ? integer : null;
|
1406 |
-
};
|
1407 |
-
|
1408 |
-
// Convert from a formatted number with characters other than `.` as the
|
1409 |
-
// decimal place, to a Javascript number
|
1410 |
-
var _numToDecimal = function ( num, decimalPoint ) {
|
1411 |
-
// Cache created regular expressions for speed as this function is called often
|
1412 |
-
if ( ! _re_dic[ decimalPoint ] ) {
|
1413 |
-
_re_dic[ decimalPoint ] = new RegExp( _fnEscapeRegex( decimalPoint ), 'g' );
|
1414 |
-
}
|
1415 |
-
return typeof num === 'string' && decimalPoint !== '.' ?
|
1416 |
-
num.replace( /\./g, '' ).replace( _re_dic[ decimalPoint ], '.' ) :
|
1417 |
-
num;
|
1418 |
-
};
|
1419 |
-
|
1420 |
-
|
1421 |
-
var _isNumber = function ( d, decimalPoint, formatted ) {
|
1422 |
-
var strType = typeof d === 'string';
|
1423 |
-
|
1424 |
-
// If empty return immediately so there must be a number if it is a
|
1425 |
-
// formatted string (this stops the string "k", or "kr", etc being detected
|
1426 |
-
// as a formatted number for currency
|
1427 |
-
if ( _empty( d ) ) {
|
1428 |
-
return true;
|
1429 |
-
}
|
1430 |
-
|
1431 |
-
if ( decimalPoint && strType ) {
|
1432 |
-
d = _numToDecimal( d, decimalPoint );
|
1433 |
-
}
|
1434 |
-
|
1435 |
-
if ( formatted && strType ) {
|
1436 |
-
d = d.replace( _re_formatted_numeric, '' );
|
1437 |
-
}
|
1438 |
-
|
1439 |
-
return !isNaN( parseFloat(d) ) && isFinite( d );
|
1440 |
-
};
|
1441 |
-
|
1442 |
-
|
1443 |
-
// A string without HTML in it can be considered to be HTML still
|
1444 |
-
var _isHtml = function ( d ) {
|
1445 |
-
return _empty( d ) || typeof d === 'string';
|
1446 |
-
};
|
1447 |
-
|
1448 |
-
|
1449 |
-
var _htmlNumeric = function ( d, decimalPoint, formatted ) {
|
1450 |
-
if ( _empty( d ) ) {
|
1451 |
-
return true;
|
1452 |
-
}
|
1453 |
-
|
1454 |
-
var html = _isHtml( d );
|
1455 |
-
return ! html ?
|
1456 |
-
null :
|
1457 |
-
_isNumber( _stripHtml( d ), decimalPoint, formatted ) ?
|
1458 |
-
true :
|
1459 |
-
null;
|
1460 |
-
};
|
1461 |
-
|
1462 |
-
|
1463 |
-
var _pluck = function ( a, prop, prop2 ) {
|
1464 |
-
var out = [];
|
1465 |
-
var i=0, ien=a.length;
|
1466 |
-
|
1467 |
-
// Could have the test in the loop for slightly smaller code, but speed
|
1468 |
-
// is essential here
|
1469 |
-
if ( prop2 !== undefined ) {
|
1470 |
-
for ( ; i<ien ; i++ ) {
|
1471 |
-
if ( a[i] && a[i][ prop ] ) {
|
1472 |
-
out.push( a[i][ prop ][ prop2 ] );
|
1473 |
-
}
|
1474 |
-
}
|
1475 |
-
}
|
1476 |
-
else {
|
1477 |
-
for ( ; i<ien ; i++ ) {
|
1478 |
-
if ( a[i] ) {
|
1479 |
-
out.push( a[i][ prop ] );
|
1480 |
-
}
|
1481 |
-
}
|
1482 |
-
}
|
1483 |
-
|
1484 |
-
return out;
|
1485 |
-
};
|
1486 |
-
|
1487 |
-
|
1488 |
-
// Basically the same as _pluck, but rather than looping over `a` we use `order`
|
1489 |
-
// as the indexes to pick from `a`
|
1490 |
-
var _pluck_order = function ( a, order, prop, prop2 )
|
1491 |
-
{
|
1492 |
-
var out = [];
|
1493 |
-
var i=0, ien=order.length;
|
1494 |
-
|
1495 |
-
// Could have the test in the loop for slightly smaller code, but speed
|
1496 |
-
// is essential here
|
1497 |
-
if ( prop2 !== undefined ) {
|
1498 |
-
for ( ; i<ien ; i++ ) {
|
1499 |
-
if ( a[ order[i] ][ prop ] ) {
|
1500 |
-
out.push( a[ order[i] ][ prop ][ prop2 ] );
|
1501 |
-
}
|
1502 |
-
}
|
1503 |
-
}
|
1504 |
-
else {
|
1505 |
-
for ( ; i<ien ; i++ ) {
|
1506 |
-
out.push( a[ order[i] ][ prop ] );
|
1507 |
-
}
|
1508 |
-
}
|
1509 |
-
|
1510 |
-
return out;
|
1511 |
-
};
|
1512 |
-
|
1513 |
-
|
1514 |
-
var _range = function ( len, start )
|
1515 |
-
{
|
1516 |
-
var out = [];
|
1517 |
-
var end;
|
1518 |
-
|
1519 |
-
if ( start === undefined ) {
|
1520 |
-
start = 0;
|
1521 |
-
end = len;
|
1522 |
-
}
|
1523 |
-
else {
|
1524 |
-
end = start;
|
1525 |
-
start = len;
|
1526 |
-
}
|
1527 |
-
|
1528 |
-
for ( var i=start ; i<end ; i++ ) {
|
1529 |
-
out.push( i );
|
1530 |
-
}
|
1531 |
-
|
1532 |
-
return out;
|
1533 |
-
};
|
1534 |
-
|
1535 |
-
|
1536 |
-
var _removeEmpty = function ( a )
|
1537 |
-
{
|
1538 |
-
var out = [];
|
1539 |
-
|
1540 |
-
for ( var i=0, ien=a.length ; i<ien ; i++ ) {
|
1541 |
-
if ( a[i] ) { // careful - will remove all falsy values!
|
1542 |
-
out.push( a[i] );
|
1543 |
-
}
|
1544 |
-
}
|
1545 |
-
|
1546 |
-
return out;
|
1547 |
-
};
|
1548 |
-
|
1549 |
-
|
1550 |
-
var _stripHtml = function ( d ) {
|
1551 |
-
return d.replace( _re_html, '' );
|
1552 |
-
};
|
1553 |
-
|
1554 |
-
|
1555 |
-
/**
|
1556 |
-
* Find the unique elements in a source array.
|
1557 |
-
*
|
1558 |
-
* @param {array} src Source array
|
1559 |
-
* @return {array} Array of unique items
|
1560 |
-
* @ignore
|
1561 |
-
*/
|
1562 |
-
var _unique = function ( src )
|
1563 |
-
{
|
1564 |
-
// A faster unique method is to use object keys to identify used values,
|
1565 |
-
// but this doesn't work with arrays or objects, which we must also
|
1566 |
-
// consider. See jsperf.com/compare-array-unique-versions/4 for more
|
1567 |
-
// information.
|
1568 |
-
var
|
1569 |
-
out = [],
|
1570 |
-
val,
|
1571 |
-
i, ien=src.length,
|
1572 |
-
j, k=0;
|
1573 |
-
|
1574 |
-
again: for ( i=0 ; i<ien ; i++ ) {
|
1575 |
-
val = src[i];
|
1576 |
-
|
1577 |
-
for ( j=0 ; j<k ; j++ ) {
|
1578 |
-
if ( out[j] === val ) {
|
1579 |
-
continue again;
|
1580 |
-
}
|
1581 |
-
}
|
1582 |
-
|
1583 |
-
out.push( val );
|
1584 |
-
k++;
|
1585 |
-
}
|
1586 |
-
|
1587 |
-
return out;
|
1588 |
-
};
|
1589 |
-
|
1590 |
-
|
1591 |
-
/**
|
1592 |
-
* WFDataTables utility methods
|
1593 |
-
*
|
1594 |
-
* This namespace provides helper methods that WFDataTables uses internally to
|
1595 |
-
* create a WFDataTable, but which are not exclusively used only for WFDataTables.
|
1596 |
-
* These methods can be used by extension authors to save the duplication of
|
1597 |
-
* code.
|
1598 |
-
*
|
1599 |
-
* @namespace
|
1600 |
-
*/
|
1601 |
-
WFDataTable.util = {
|
1602 |
-
/**
|
1603 |
-
* Throttle the calls to a function. Arguments and context are maintained
|
1604 |
-
* for the throttled function.
|
1605 |
-
*
|
1606 |
-
* @param {function} fn Function to be called
|
1607 |
-
* @param {integer} freq Call frequency in mS
|
1608 |
-
* @return {function} Wrapped function
|
1609 |
-
*/
|
1610 |
-
throttle: function ( fn, freq ) {
|
1611 |
-
var
|
1612 |
-
frequency = freq !== undefined ? freq : 200,
|
1613 |
-
last,
|
1614 |
-
timer;
|
1615 |
-
|
1616 |
-
return function () {
|
1617 |
-
var
|
1618 |
-
that = this,
|
1619 |
-
now = +new Date(),
|
1620 |
-
args = arguments;
|
1621 |
-
|
1622 |
-
if ( last && now < last + frequency ) {
|
1623 |
-
clearTimeout( timer );
|
1624 |
-
|
1625 |
-
timer = setTimeout( function () {
|
1626 |
-
last = undefined;
|
1627 |
-
fn.apply( that, args );
|
1628 |
-
}, frequency );
|
1629 |
-
}
|
1630 |
-
else {
|
1631 |
-
last = now;
|
1632 |
-
fn.apply( that, args );
|
1633 |
-
}
|
1634 |
-
};
|
1635 |
-
},
|
1636 |
-
|
1637 |
-
|
1638 |
-
/**
|
1639 |
-
* Escape a string such that it can be used in a regular expression
|
1640 |
-
*
|
1641 |
-
* @param {string} val string to escape
|
1642 |
-
* @returns {string} escaped string
|
1643 |
-
*/
|
1644 |
-
escapeRegex: function ( val ) {
|
1645 |
-
return val.replace( _re_escape_regex, '\\$1' );
|
1646 |
-
}
|
1647 |
-
};
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
/**
|
1652 |
-
* Create a mapping object that allows camel case parameters to be looked up
|
1653 |
-
* for their Hungarian counterparts. The mapping is stored in a private
|
1654 |
-
* parameter called `_hungarianMap` which can be accessed on the source object.
|
1655 |
-
* @param {object} o
|
1656 |
-
* @memberof WFDataTable#oApi
|
1657 |
-
*/
|
1658 |
-
function _fnHungarianMap ( o )
|
1659 |
-
{
|
1660 |
-
var
|
1661 |
-
hungarian = 'a aa ai ao as b fn i m o s ',
|
1662 |
-
match,
|
1663 |
-
newKey,
|
1664 |
-
map = {};
|
1665 |
-
|
1666 |
-
$.each( o, function (key, val) {
|
1667 |
-
match = key.match(/^([^A-Z]+?)([A-Z])/);
|
1668 |
-
|
1669 |
-
if ( match && hungarian.indexOf(match[1]+' ') !== -1 )
|
1670 |
-
{
|
1671 |
-
newKey = key.replace( match[0], match[2].toLowerCase() );
|
1672 |
-
map[ newKey ] = key;
|
1673 |
-
|
1674 |
-
if ( match[1] === 'o' )
|
1675 |
-
{
|
1676 |
-
_fnHungarianMap( o[key] );
|
1677 |
-
}
|
1678 |
-
}
|
1679 |
-
} );
|
1680 |
-
|
1681 |
-
o._hungarianMap = map;
|
1682 |
-
}
|
1683 |
-
|
1684 |
-
|
1685 |
-
/**
|
1686 |
-
* Convert from camel case parameters to Hungarian, based on a Hungarian map
|
1687 |
-
* created by _fnHungarianMap.
|
1688 |
-
* @param {object} src The model object which holds all parameters that can be
|
1689 |
-
* mapped.
|
1690 |
-
* @param {object} user The object to convert from camel case to Hungarian.
|
1691 |
-
* @param {boolean} force When set to `true`, properties which already have a
|
1692 |
-
* Hungarian value in the `user` object will be overwritten. Otherwise they
|
1693 |
-
* won't be.
|
1694 |
-
* @memberof WFDataTable#oApi
|
1695 |
-
*/
|
1696 |
-
function _fnCamelToHungarian ( src, user, force )
|
1697 |
-
{
|
1698 |
-
if ( ! src._hungarianMap ) {
|
1699 |
-
_fnHungarianMap( src );
|
1700 |
-
}
|
1701 |
-
|
1702 |
-
var hungarianKey;
|
1703 |
-
|
1704 |
-
$.each( user, function (key, val) {
|
1705 |
-
hungarianKey = src._hungarianMap[ key ];
|
1706 |
-
|
1707 |
-
if ( hungarianKey !== undefined && (force || user[hungarianKey] === undefined) )
|
1708 |
-
{
|
1709 |
-
// For objects, we need to buzz down into the object to copy parameters
|
1710 |
-
if ( hungarianKey.charAt(0) === 'o' )
|
1711 |
-
{
|
1712 |
-
// Copy the camelCase options over to the hungarian
|
1713 |
-
if ( ! user[ hungarianKey ] ) {
|
1714 |
-
user[ hungarianKey ] = {};
|
1715 |
-
}
|
1716 |
-
$.extend( true, user[hungarianKey], user[key] );
|
1717 |
-
|
1718 |
-
_fnCamelToHungarian( src[hungarianKey], user[hungarianKey], force );
|
1719 |
-
}
|
1720 |
-
else {
|
1721 |
-
user[hungarianKey] = user[ key ];
|
1722 |
-
}
|
1723 |
-
}
|
1724 |
-
} );
|
1725 |
-
}
|
1726 |
-
|
1727 |
-
|
1728 |
-
/**
|
1729 |
-
* Language compatibility - when certain options are given, and others aren't, we
|
1730 |
-
* need to duplicate the values over, in order to provide backwards compatibility
|
1731 |
-
* with older language files.
|
1732 |
-
* @param {object} oSettings dataTables settings object
|
1733 |
-
* @memberof WFDataTable#oApi
|
1734 |
-
*/
|
1735 |
-
function _fnLanguageCompat( lang )
|
1736 |
-
{
|
1737 |
-
var defaults = WFDataTable.defaults.oLanguage;
|
1738 |
-
var zeroRecords = lang.sZeroRecords;
|
1739 |
-
|
1740 |
-
/* Backwards compatibility - if there is no sEmptyTable given, then use the same as
|
1741 |
-
* sZeroRecords - assuming that is given.
|
1742 |
-
*/
|
1743 |
-
if ( ! lang.sEmptyTable && zeroRecords &&
|
1744 |
-
defaults.sEmptyTable === "No data available in table" )
|
1745 |
-
{
|
1746 |
-
_fnMap( lang, lang, 'sZeroRecords', 'sEmptyTable' );
|
1747 |
-
}
|
1748 |
-
|
1749 |
-
/* Likewise with loading records */
|
1750 |
-
if ( ! lang.sLoadingRecords && zeroRecords &&
|
1751 |
-
defaults.sLoadingRecords === "Loading..." )
|
1752 |
-
{
|
1753 |
-
_fnMap( lang, lang, 'sZeroRecords', 'sLoadingRecords' );
|
1754 |
-
}
|
1755 |
-
|
1756 |
-
// Old parameter name of the thousands separator mapped onto the new
|
1757 |
-
if ( lang.sInfoThousands ) {
|
1758 |
-
lang.sThousands = lang.sInfoThousands;
|
1759 |
-
}
|
1760 |
-
|
1761 |
-
var decimal = lang.sDecimal;
|
1762 |
-
if ( decimal ) {
|
1763 |
-
_addNumericSort( decimal );
|
1764 |
-
}
|
1765 |
-
}
|
1766 |
-
|
1767 |
-
|
1768 |
-
/**
|
1769 |
-
* Map one parameter onto another
|
1770 |
-
* @param {object} o Object to map
|
1771 |
-
* @param {*} knew The new parameter name
|
1772 |
-
* @param {*} old The old parameter name
|
1773 |
-
*/
|
1774 |
-
var _fnCompatMap = function ( o, knew, old ) {
|
1775 |
-
if ( o[ knew ] !== undefined ) {
|
1776 |
-
o[ old ] = o[ knew ];
|
1777 |
-
}
|
1778 |
-
};
|
1779 |
-
|
1780 |
-
|
1781 |
-
/**
|
1782 |
-
* Provide backwards compatibility for the main DT options. Note that the new
|
1783 |
-
* options are mapped onto the old parameters, so this is an external interface
|
1784 |
-
* change only.
|
1785 |
-
* @param {object} init Object to map
|
1786 |
-
*/
|
1787 |
-
function _fnCompatOpts ( init )
|
1788 |
-
{
|
1789 |
-
_fnCompatMap( init, 'ordering', 'bSort' );
|
1790 |
-
_fnCompatMap( init, 'orderMulti', 'bSortMulti' );
|
1791 |
-
_fnCompatMap( init, 'orderClasses', 'bSortClasses' );
|
1792 |
-
_fnCompatMap( init, 'orderCellsTop', 'bSortCellsTop' );
|
1793 |
-
_fnCompatMap( init, 'order', 'aaSorting' );
|
1794 |
-
_fnCompatMap( init, 'orderFixed', 'aaSortingFixed' );
|
1795 |
-
_fnCompatMap( init, 'paging', 'bPaginate' );
|
1796 |
-
_fnCompatMap( init, 'pagingType', 'sPaginationType' );
|
1797 |
-
_fnCompatMap( init, 'pageLength', 'iDisplayLength' );
|
1798 |
-
_fnCompatMap( init, 'searching', 'bFilter' );
|
1799 |
-
|
1800 |
-
// Boolean initialisation of x-scrolling
|
1801 |
-
if ( typeof init.sScrollX === 'boolean' ) {
|
1802 |
-
init.sScrollX = init.sScrollX ? '100%' : '';
|
1803 |
-
}
|
1804 |
-
if ( typeof init.scrollX === 'boolean' ) {
|
1805 |
-
init.scrollX = init.scrollX ? '100%' : '';
|
1806 |
-
}
|
1807 |
-
|
1808 |
-
// Column search objects are in an array, so it needs to be converted
|
1809 |
-
// element by element
|
1810 |
-
var searchCols = init.aoSearchCols;
|
1811 |
-
|
1812 |
-
if ( searchCols ) {
|
1813 |
-
for ( var i=0, ien=searchCols.length ; i<ien ; i++ ) {
|
1814 |
-
if ( searchCols[i] ) {
|
1815 |
-
_fnCamelToHungarian( WFDataTable.models.oSearch, searchCols[i] );
|
1816 |
-
}
|
1817 |
-
}
|
1818 |
-
}
|
1819 |
-
}
|
1820 |
-
|
1821 |
-
|
1822 |
-
/**
|
1823 |
-
* Provide backwards compatibility for column options. Note that the new options
|
1824 |
-
* are mapped onto the old parameters, so this is an external interface change
|
1825 |
-
* only.
|
1826 |
-
* @param {object} init Object to map
|
1827 |
-
*/
|
1828 |
-
function _fnCompatCols ( init )
|
1829 |
-
{
|
1830 |
-
_fnCompatMap( init, 'orderable', 'bSortable' );
|
1831 |
-
_fnCompatMap( init, 'orderData', 'aDataSort' );
|
1832 |
-
_fnCompatMap( init, 'orderSequence', 'asSorting' );
|
1833 |
-
_fnCompatMap( init, 'orderDataType', 'sortDataType' );
|
1834 |
-
|
1835 |
-
// orderData can be given as an integer
|
1836 |
-
var dataSort = init.aDataSort;
|
1837 |
-
if ( dataSort && ! $.isArray( dataSort ) ) {
|
1838 |
-
init.aDataSort = [ dataSort ];
|
1839 |
-
}
|
1840 |
-
}
|
1841 |
-
|
1842 |
-
|
1843 |
-
/**
|
1844 |
-
* Browser feature detection for capabilities, quirks
|
1845 |
-
* @param {object} settings dataTables settings object
|
1846 |
-
* @memberof WFDataTable#oApi
|
1847 |
-
*/
|
1848 |
-
function _fnBrowserDetect( settings )
|
1849 |
-
{
|
1850 |
-
// We don't need to do this every time WFDataTables is constructed, the values
|
1851 |
-
// calculated are specific to the browser and OS configuration which we
|
1852 |
-
// don't expect to change between initialisations
|
1853 |
-
if ( ! WFDataTable.__browser ) {
|
1854 |
-
var browser = {};
|
1855 |
-
WFDataTable.__browser = browser;
|
1856 |
-
|
1857 |
-
// Scrolling feature / quirks detection
|
1858 |
-
var n = $('<div/>')
|
1859 |
-
.css( {
|
1860 |
-
position: 'fixed',
|
1861 |
-
top: 0,
|
1862 |
-
left: $(window).scrollLeft()*-1, // allow for scrolling
|
1863 |
-
height: 1,
|
1864 |
-
width: 1,
|
1865 |
-
overflow: 'hidden'
|
1866 |
-
} )
|
1867 |
-
.append(
|
1868 |
-
$('<div/>')
|
1869 |
-
.css( {
|
1870 |
-
position: 'absolute',
|
1871 |
-
top: 1,
|
1872 |
-
left: 1,
|
1873 |
-
width: 100,
|
1874 |
-
overflow: 'scroll'
|
1875 |
-
} )
|
1876 |
-
.append(
|
1877 |
-
$('<div/>')
|
1878 |
-
.css( {
|
1879 |
-
width: '100%',
|
1880 |
-
height: 10
|
1881 |
-
} )
|
1882 |
-
)
|
1883 |
-
)
|
1884 |
-
.appendTo( 'body' );
|
1885 |
-
|
1886 |
-
var outer = n.children();
|
1887 |
-
var inner = outer.children();
|
1888 |
-
|
1889 |
-
// Numbers below, in order, are:
|
1890 |
-
// inner.offsetWidth, inner.clientWidth, outer.offsetWidth, outer.clientWidth
|
1891 |
-
//
|
1892 |
-
// IE6 XP: 100 100 100 83
|
1893 |
-
// IE7 Vista: 100 100 100 83
|
1894 |
-
// IE 8+ Windows: 83 83 100 83
|
1895 |
-
// Evergreen Windows: 83 83 100 83
|
1896 |
-
// Evergreen Mac with scrollbars: 85 85 100 85
|
1897 |
-
// Evergreen Mac without scrollbars: 100 100 100 100
|
1898 |
-
|
1899 |
-
// Get scrollbar width
|
1900 |
-
browser.barWidth = outer[0].offsetWidth - outer[0].clientWidth;
|
1901 |
-
|
1902 |
-
// IE6/7 will oversize a width 100% element inside a scrolling element, to
|
1903 |
-
// include the width of the scrollbar, while other browsers ensure the inner
|
1904 |
-
// element is contained without forcing scrolling
|
1905 |
-
browser.bScrollOversize = inner[0].offsetWidth === 100 && outer[0].clientWidth !== 100;
|
1906 |
-
|
1907 |
-
// In rtl text layout, some browsers (most, but not all) will place the
|
1908 |
-
// scrollbar on the left, rather than the right.
|
1909 |
-
browser.bScrollbarLeft = Math.round( inner.offset().left ) !== 1;
|
1910 |
-
|
1911 |
-
// IE8- don't provide height and width for getBoundingClientRect
|
1912 |
-
browser.bBounding = n[0].getBoundingClientRect().width ? true : false;
|
1913 |
-
|
1914 |
-
n.remove();
|
1915 |
-
}
|
1916 |
-
|
1917 |
-
$.extend( settings.oBrowser, WFDataTable.__browser );
|
1918 |
-
settings.oScroll.iBarWidth = WFDataTable.__browser.barWidth;
|
1919 |
-
}
|
1920 |
-
|
1921 |
-
|
1922 |
-
/**
|
1923 |
-
* Array.prototype reduce[Right] method, used for browsers which don't support
|
1924 |
-
* JS 1.6. Done this way to reduce code size, since we iterate either way
|
1925 |
-
* @param {object} settings dataTables settings object
|
1926 |
-
* @memberof WFDataTable#oApi
|
1927 |
-
*/
|
1928 |
-
function _fnReduce ( that, fn, init, start, end, inc )
|
1929 |
-
{
|
1930 |
-
var
|
1931 |
-
i = start,
|
1932 |
-
value,
|
1933 |
-
isSet = false;
|
1934 |
-
|
1935 |
-
if ( init !== undefined ) {
|
1936 |
-
value = init;
|
1937 |
-
isSet = true;
|
1938 |
-
}
|
1939 |
-
|
1940 |
-
while ( i !== end ) {
|
1941 |
-
if ( ! that.hasOwnProperty(i) ) {
|
1942 |
-
continue;
|
1943 |
-
}
|
1944 |
-
|
1945 |
-
value = isSet ?
|
1946 |
-
fn( value, that[i], i, that ) :
|
1947 |
-
that[i];
|
1948 |
-
|
1949 |
-
isSet = true;
|
1950 |
-
i += inc;
|
1951 |
-
}
|
1952 |
-
|
1953 |
-
return value;
|
1954 |
-
}
|
1955 |
-
|
1956 |
-
/**
|
1957 |
-
* Add a column to the list used for the table with default values
|
1958 |
-
* @param {object} oSettings dataTables settings object
|
1959 |
-
* @param {node} nTh The th element for this column
|
1960 |
-
* @memberof WFDataTable#oApi
|
1961 |
-
*/
|
1962 |
-
function _fnAddColumn( oSettings, nTh )
|
1963 |
-
{
|
1964 |
-
// Add column to aoColumns array
|
1965 |
-
var oDefaults = WFDataTable.defaults.column;
|
1966 |
-
var iCol = oSettings.aoColumns.length;
|
1967 |
-
var oCol = $.extend( {}, WFDataTable.models.oColumn, oDefaults, {
|
1968 |
-
"nTh": nTh ? nTh : document.createElement('th'),
|
1969 |
-
"sTitle": oDefaults.sTitle ? oDefaults.sTitle : nTh ? nTh.innerHTML : '',
|
1970 |
-
"aDataSort": oDefaults.aDataSort ? oDefaults.aDataSort : [iCol],
|
1971 |
-
"mData": oDefaults.mData ? oDefaults.mData : iCol,
|
1972 |
-
idx: iCol
|
1973 |
-
} );
|
1974 |
-
oSettings.aoColumns.push( oCol );
|
1975 |
-
|
1976 |
-
// Add search object for column specific search. Note that the `searchCols[ iCol ]`
|
1977 |
-
// passed into extend can be undefined. This allows the user to give a default
|
1978 |
-
// with only some of the parameters defined, and also not give a default
|
1979 |
-
var searchCols = oSettings.aoPreSearchCols;
|
1980 |
-
searchCols[ iCol ] = $.extend( {}, WFDataTable.models.oSearch, searchCols[ iCol ] );
|
1981 |
-
|
1982 |
-
// Use the default column options function to initialise classes etc
|
1983 |
-
_fnColumnOptions( oSettings, iCol, $(nTh).data() );
|
1984 |
-
}
|
1985 |
-
|
1986 |
-
|
1987 |
-
/**
|
1988 |
-
* Apply options for a column
|
1989 |
-
* @param {object} oSettings dataTables settings object
|
1990 |
-
* @param {int} iCol column index to consider
|
1991 |
-
* @param {object} oOptions object with sType, bVisible and bSearchable etc
|
1992 |
-
* @memberof WFDataTable#oApi
|
1993 |
-
*/
|
1994 |
-
function _fnColumnOptions( oSettings, iCol, oOptions )
|
1995 |
-
{
|
1996 |
-
var oCol = oSettings.aoColumns[ iCol ];
|
1997 |
-
var oClasses = oSettings.oClasses;
|
1998 |
-
var th = $(oCol.nTh);
|
1999 |
-
|
2000 |
-
// Try to get width information from the DOM. We can't get it from CSS
|
2001 |
-
// as we'd need to parse the CSS stylesheet. `width` option can override
|
2002 |
-
if ( ! oCol.sWidthOrig ) {
|
2003 |
-
// Width attribute
|
2004 |
-
oCol.sWidthOrig = th.attr('width') || null;
|
2005 |
-
|
2006 |
-
// Style attribute
|
2007 |
-
var t = (th.attr('style') || '').match(/width:\s*(\d+[pxem%]+)/);
|
2008 |
-
if ( t ) {
|
2009 |
-
oCol.sWidthOrig = t[1];
|
2010 |
-
}
|
2011 |
-
}
|
2012 |
-
|
2013 |
-
/* User specified column options */
|
2014 |
-
if ( oOptions !== undefined && oOptions !== null )
|
2015 |
-
{
|
2016 |
-
// Backwards compatibility
|
2017 |
-
_fnCompatCols( oOptions );
|
2018 |
-
|
2019 |
-
// Map camel case parameters to their Hungarian counterparts
|
2020 |
-
_fnCamelToHungarian( WFDataTable.defaults.column, oOptions );
|
2021 |
-
|
2022 |
-
/* Backwards compatibility for mDataProp */
|
2023 |
-
if ( oOptions.mDataProp !== undefined && !oOptions.mData )
|
2024 |
-
{
|
2025 |
-
oOptions.mData = oOptions.mDataProp;
|
2026 |
-
}
|
2027 |
-
|
2028 |
-
if ( oOptions.sType )
|
2029 |
-
{
|
2030 |
-
oCol._sManualType = oOptions.sType;
|
2031 |
-
}
|
2032 |
-
|
2033 |
-
// `class` is a reserved word in Javascript, so we need to provide
|
2034 |
-
// the ability to use a valid name for the camel case input
|
2035 |
-
if ( oOptions.className && ! oOptions.sClass )
|
2036 |
-
{
|
2037 |
-
oOptions.sClass = oOptions.className;
|
2038 |
-
}
|
2039 |
-
|
2040 |
-
$.extend( oCol, oOptions );
|
2041 |
-
_fnMap( oCol, oOptions, "sWidth", "sWidthOrig" );
|
2042 |
-
|
2043 |
-
/* iDataSort to be applied (backwards compatibility), but aDataSort will take
|
2044 |
-
* priority if defined
|
2045 |
-
*/
|
2046 |
-
if ( oOptions.iDataSort !== undefined )
|
2047 |
-
{
|
2048 |
-
oCol.aDataSort = [ oOptions.iDataSort ];
|
2049 |
-
}
|
2050 |
-
_fnMap( oCol, oOptions, "aDataSort" );
|
2051 |
-
}
|
2052 |
-
|
2053 |
-
/* Cache the data get and set functions for speed */
|
2054 |
-
var mDataSrc = oCol.mData;
|
2055 |
-
var mData = _fnGetObjectDataFn( mDataSrc );
|
2056 |
-
var mRender = oCol.mRender ? _fnGetObjectDataFn( oCol.mRender ) : null;
|
2057 |
-
|
2058 |
-
var attrTest = function( src ) {
|
2059 |
-
return typeof src === 'string' && src.indexOf('@') !== -1;
|
2060 |
-
};
|
2061 |
-
oCol._bAttrSrc = $.isPlainObject( mDataSrc ) && (
|
2062 |
-
attrTest(mDataSrc.sort) || attrTest(mDataSrc.type) || attrTest(mDataSrc.filter)
|
2063 |
-
);
|
2064 |
-
oCol._setter = null;
|
2065 |
-
|
2066 |
-
oCol.fnGetData = function (rowData, type, meta) {
|
2067 |
-
var innerData = mData( rowData, type, undefined, meta );
|
2068 |
-
|
2069 |
-
return mRender && type ?
|
2070 |
-
mRender( innerData, type, rowData, meta ) :
|
2071 |
-
innerData;
|
2072 |
-
};
|
2073 |
-
oCol.fnSetData = function ( rowData, val, meta ) {
|
2074 |
-
return _fnSetObjectDataFn( mDataSrc )( rowData, val, meta );
|
2075 |
-
};
|
2076 |
-
|
2077 |
-
// Indicate if WFDataTables should read DOM data as an object or array
|
2078 |
-
// Used in _fnGetRowElements
|
2079 |
-
if ( typeof mDataSrc !== 'number' ) {
|
2080 |
-
oSettings._rowReadObject = true;
|
2081 |
-
}
|
2082 |
-
|
2083 |
-
/* Feature sorting overrides column specific when off */
|
2084 |
-
if ( !oSettings.oFeatures.bSort )
|
2085 |
-
{
|
2086 |
-
oCol.bSortable = false;
|
2087 |
-
th.addClass( oClasses.sSortableNone ); // Have to add class here as order event isn't called
|
2088 |
-
}
|
2089 |
-
|
2090 |
-
/* Check that the class assignment is correct for sorting */
|
2091 |
-
var bAsc = $.inArray('asc', oCol.asSorting) !== -1;
|
2092 |
-
var bDesc = $.inArray('desc', oCol.asSorting) !== -1;
|
2093 |
-
if ( !oCol.bSortable || (!bAsc && !bDesc) )
|
2094 |
-
{
|
2095 |
-
oCol.sSortingClass = oClasses.sSortableNone;
|
2096 |
-
oCol.sSortingClassJUI = "";
|
2097 |
-
}
|
2098 |
-
else if ( bAsc && !bDesc )
|
2099 |
-
{
|
2100 |
-
oCol.sSortingClass = oClasses.sSortableAsc;
|
2101 |
-
oCol.sSortingClassJUI = oClasses.sSortJUIAscAllowed;
|
2102 |
-
}
|
2103 |
-
else if ( !bAsc && bDesc )
|
2104 |
-
{
|
2105 |
-
oCol.sSortingClass = oClasses.sSortableDesc;
|
2106 |
-
oCol.sSortingClassJUI = oClasses.sSortJUIDescAllowed;
|
2107 |
-
}
|
2108 |
-
else
|
2109 |
-
{
|
2110 |
-
oCol.sSortingClass = oClasses.sSortable;
|
2111 |
-
oCol.sSortingClassJUI = oClasses.sSortJUI;
|
2112 |
-
}
|
2113 |
-
}
|
2114 |
-
|
2115 |
-
|
2116 |
-
/**
|
2117 |
-
* Adjust the table column widths for new data. Note: you would probably want to
|
2118 |
-
* do a redraw after calling this function!
|
2119 |
-
* @param {object} settings dataTables settings object
|
2120 |
-
* @memberof WFDataTable#oApi
|
2121 |
-
*/
|
2122 |
-
function _fnAdjustColumnSizing ( settings )
|
2123 |
-
{
|
2124 |
-
/* Not interested in doing column width calculation if auto-width is disabled */
|
2125 |
-
if ( settings.oFeatures.bAutoWidth !== false )
|
2126 |
-
{
|
2127 |
-
var columns = settings.aoColumns;
|
2128 |
-
|
2129 |
-
_fnCalculateColumnWidths( settings );
|
2130 |
-
for ( var i=0 , iLen=columns.length ; i<iLen ; i++ )
|
2131 |
-
{
|
2132 |
-
columns[i].nTh.style.width = columns[i].sWidth;
|
2133 |
-
}
|
2134 |
-
}
|
2135 |
-
|
2136 |
-
var scroll = settings.oScroll;
|
2137 |
-
if ( scroll.sY !== '' || scroll.sX !== '')
|
2138 |
-
{
|
2139 |
-
_fnScrollDraw( settings );
|
2140 |
-
}
|
2141 |
-
|
2142 |
-
_fnCallbackFire( settings, null, 'column-sizing', [settings] );
|
2143 |
-
}
|
2144 |
-
|
2145 |
-
|
2146 |
-
/**
|
2147 |
-
* Covert the index of a visible column to the index in the data array (take account
|
2148 |
-
* of hidden columns)
|
2149 |
-
* @param {object} oSettings dataTables settings object
|
2150 |
-
* @param {int} iMatch Visible column index to lookup
|
2151 |
-
* @returns {int} i the data index
|
2152 |
-
* @memberof WFDataTable#oApi
|
2153 |
-
*/
|
2154 |
-
function _fnVisibleToColumnIndex( oSettings, iMatch )
|
2155 |
-
{
|
2156 |
-
var aiVis = _fnGetColumns( oSettings, 'bVisible' );
|
2157 |
-
|
2158 |
-
return typeof aiVis[iMatch] === 'number' ?
|
2159 |
-
aiVis[iMatch] :
|
2160 |
-
null;
|
2161 |
-
}
|
2162 |
-
|
2163 |
-
|
2164 |
-
/**
|
2165 |
-
* Covert the index of an index in the data array and convert it to the visible
|
2166 |
-
* column index (take account of hidden columns)
|
2167 |
-
* @param {int} iMatch Column index to lookup
|
2168 |
-
* @param {object} oSettings dataTables settings object
|
2169 |
-
* @returns {int} i the data index
|
2170 |
-
* @memberof WFDataTable#oApi
|
2171 |
-
*/
|
2172 |
-
function _fnColumnIndexToVisible( oSettings, iMatch )
|
2173 |
-
{
|
2174 |
-
var aiVis = _fnGetColumns( oSettings, 'bVisible' );
|
2175 |
-
var iPos = $.inArray( iMatch, aiVis );
|
2176 |
-
|
2177 |
-
return iPos !== -1 ? iPos : null;
|
2178 |
-
}
|
2179 |
-
|
2180 |
-
|
2181 |
-
/**
|
2182 |
-
* Get the number of visible columns
|
2183 |
-
* @param {object} oSettings dataTables settings object
|
2184 |
-
* @returns {int} i the number of visible columns
|
2185 |
-
* @memberof WFDataTable#oApi
|
2186 |
-
*/
|
2187 |
-
function _fnVisbleColumns( oSettings )
|
2188 |
-
{
|
2189 |
-
var vis = 0;
|
2190 |
-
|
2191 |
-
// No reduce in IE8, use a loop for now
|
2192 |
-
$.each( oSettings.aoColumns, function ( i, col ) {
|
2193 |
-
if ( col.bVisible && $(col.nTh).css('display') !== 'none' ) {
|
2194 |
-
vis++;
|
2195 |
-
}
|
2196 |
-
} );
|
2197 |
-
|
2198 |
-
return vis;
|
2199 |
-
}
|
2200 |
-
|
2201 |
-
|
2202 |
-
/**
|
2203 |
-
* Get an array of column indexes that match a given property
|
2204 |
-
* @param {object} oSettings dataTables settings object
|
2205 |
-
* @param {string} sParam Parameter in aoColumns to look for - typically
|
2206 |
-
* bVisible or bSearchable
|
2207 |
-
* @returns {array} Array of indexes with matched properties
|
2208 |
-
* @memberof WFDataTable#oApi
|
2209 |
-
*/
|
2210 |
-
function _fnGetColumns( oSettings, sParam )
|
2211 |
-
{
|
2212 |
-
var a = [];
|
2213 |
-
|
2214 |
-
$.map( oSettings.aoColumns, function(val, i) {
|
2215 |
-
if ( val[sParam] ) {
|
2216 |
-
a.push( i );
|
2217 |
-
}
|
2218 |
-
} );
|
2219 |
-
|
2220 |
-
return a;
|
2221 |
-
}
|
2222 |
-
|
2223 |
-
|
2224 |
-
/**
|
2225 |
-
* Calculate the 'type' of a column
|
2226 |
-
* @param {object} settings dataTables settings object
|
2227 |
-
* @memberof WFDataTable#oApi
|
2228 |
-
*/
|
2229 |
-
function _fnColumnTypes ( settings )
|
2230 |
-
{
|
2231 |
-
var columns = settings.aoColumns;
|
2232 |
-
var data = settings.aoData;
|
2233 |
-
var types = WFDataTable.ext.type.detect;
|
2234 |
-
var i, ien, j, jen, k, ken;
|
2235 |
-
var col, cell, detectedType, cache;
|
2236 |
-
|
2237 |
-
// For each column, spin over the
|
2238 |
-
for ( i=0, ien=columns.length ; i<ien ; i++ ) {
|
2239 |
-
col = columns[i];
|
2240 |
-
cache = [];
|
2241 |
-
|
2242 |
-
if ( ! col.sType && col._sManualType ) {
|
2243 |
-
col.sType = col._sManualType;
|
2244 |
-
}
|
2245 |
-
else if ( ! col.sType ) {
|
2246 |
-
for ( j=0, jen=types.length ; j<jen ; j++ ) {
|
2247 |
-
for ( k=0, ken=data.length ; k<ken ; k++ ) {
|
2248 |
-
// Use a cache array so we only need to get the type data
|
2249 |
-
// from the formatter once (when using multiple detectors)
|
2250 |
-
if ( cache[k] === undefined ) {
|
2251 |
-
cache[k] = _fnGetCellData( settings, k, i, 'type' );
|
2252 |
-
}
|
2253 |
-
|
2254 |
-
detectedType = types[j]( cache[k], settings );
|
2255 |
-
|
2256 |
-
// If null, then this type can't apply to this column, so
|
2257 |
-
// rather than testing all cells, break out. There is an
|
2258 |
-
// exception for the last type which is `html`. We need to
|
2259 |
-
// scan all rows since it is possible to mix string and HTML
|
2260 |
-
// types
|
2261 |
-
if ( ! detectedType && j !== types.length-1 ) {
|
2262 |
-
break;
|
2263 |
-
}
|
2264 |
-
|
2265 |
-
// Only a single match is needed for html type since it is
|
2266 |
-
// bottom of the pile and very similar to string
|
2267 |
-
if ( detectedType === 'html' ) {
|
2268 |
-
break;
|
2269 |
-
}
|
2270 |
-
}
|
2271 |
-
|
2272 |
-
// Type is valid for all data points in the column - use this
|
2273 |
-
// type
|
2274 |
-
if ( detectedType ) {
|
2275 |
-
col.sType = detectedType;
|
2276 |
-
break;
|
2277 |
-
}
|
2278 |
-
}
|
2279 |
-
|
2280 |
-
// Fall back - if no type was detected, always use string
|
2281 |
-
if ( ! col.sType ) {
|
2282 |
-
col.sType = 'string';
|
2283 |
-
}
|
2284 |
-
}
|
2285 |
-
}
|
2286 |
-
}
|
2287 |
-
|
2288 |
-
|
2289 |
-
/**
|
2290 |
-
* Take the column definitions and static columns arrays and calculate how
|
2291 |
-
* they relate to column indexes. The callback function will then apply the
|
2292 |
-
* definition found for a column to a suitable configuration object.
|
2293 |
-
* @param {object} oSettings dataTables settings object
|
2294 |
-
* @param {array} aoColDefs The aoColumnDefs array that is to be applied
|
2295 |
-
* @param {array} aoCols The aoColumns array that defines columns individually
|
2296 |
-
* @param {function} fn Callback function - takes two parameters, the calculated
|
2297 |
-
* column index and the definition for that column.
|
2298 |
-
* @memberof WFDataTable#oApi
|
2299 |
-
*/
|
2300 |
-
function _fnApplyColumnDefs( oSettings, aoColDefs, aoCols, fn )
|
2301 |
-
{
|
2302 |
-
var i, iLen, j, jLen, k, kLen, def;
|
2303 |
-
var columns = oSettings.aoColumns;
|
2304 |
-
|
2305 |
-
// Column definitions with aTargets
|
2306 |
-
if ( aoColDefs )
|
2307 |
-
{
|
2308 |
-
/* Loop over the definitions array - loop in reverse so first instance has priority */
|
2309 |
-
for ( i=aoColDefs.length-1 ; i>=0 ; i-- )
|
2310 |
-
{
|
2311 |
-
def = aoColDefs[i];
|
2312 |
-
|
2313 |
-
/* Each definition can target multiple columns, as it is an array */
|
2314 |
-
var aTargets = def.targets !== undefined ?
|
2315 |
-
def.targets :
|
2316 |
-
def.aTargets;
|
2317 |
-
|
2318 |
-
if ( ! $.isArray( aTargets ) )
|
2319 |
-
{
|
2320 |
-
aTargets = [ aTargets ];
|
2321 |
-
}
|
2322 |
-
|
2323 |
-
for ( j=0, jLen=aTargets.length ; j<jLen ; j++ )
|
2324 |
-
{
|
2325 |
-
if ( typeof aTargets[j] === 'number' && aTargets[j] >= 0 )
|
2326 |
-
{
|
2327 |
-
/* Add columns that we don't yet know about */
|
2328 |
-
while( columns.length <= aTargets[j] )
|
2329 |
-
{
|
2330 |
-
_fnAddColumn( oSettings );
|
2331 |
-
}
|
2332 |
-
|
2333 |
-
/* Integer, basic index */
|
2334 |
-
fn( aTargets[j], def );
|
2335 |
-
}
|
2336 |
-
else if ( typeof aTargets[j] === 'number' && aTargets[j] < 0 )
|
2337 |
-
{
|
2338 |
-
/* Negative integer, right to left column counting */
|
2339 |
-
fn( columns.length+aTargets[j], def );
|
2340 |
-
}
|
2341 |
-
else if ( typeof aTargets[j] === 'string' )
|
2342 |
-
{
|
2343 |
-
/* Class name matching on TH element */
|
2344 |
-
for ( k=0, kLen=columns.length ; k<kLen ; k++ )
|
2345 |
-
{
|
2346 |
-
if ( aTargets[j] == "_all" ||
|
2347 |
-
$(columns[k].nTh).hasClass( aTargets[j] ) )
|
2348 |
-
{
|
2349 |
-
fn( k, def );
|
2350 |
-
}
|
2351 |
-
}
|
2352 |
-
}
|
2353 |
-
}
|
2354 |
-
}
|
2355 |
-
}
|
2356 |
-
|
2357 |
-
// Statically defined columns array
|
2358 |
-
if ( aoCols )
|
2359 |
-
{
|
2360 |
-
for ( i=0, iLen=aoCols.length ; i<iLen ; i++ )
|
2361 |
-
{
|
2362 |
-
fn( i, aoCols[i] );
|
2363 |
-
}
|
2364 |
-
}
|
2365 |
-
}
|
2366 |
-
|
2367 |
-
/**
|
2368 |
-
* Add a data array to the table, creating DOM node etc. This is the parallel to
|
2369 |
-
* _fnGatherData, but for adding rows from a Javascript source, rather than a
|
2370 |
-
* DOM source.
|
2371 |
-
* @param {object} oSettings dataTables settings object
|
2372 |
-
* @param {array} aData data array to be added
|
2373 |
-
* @param {node} [nTr] TR element to add to the table - optional. If not given,
|
2374 |
-
* WFDataTables will create a row automatically
|
2375 |
-
* @param {array} [anTds] Array of TD|TH elements for the row - must be given
|
2376 |
-
* if nTr is.
|
2377 |
-
* @returns {int} >=0 if successful (index of new aoData entry), -1 if failed
|
2378 |
-
* @memberof WFDataTable#oApi
|
2379 |
-
*/
|
2380 |
-
function _fnAddData ( oSettings, aDataIn, nTr, anTds )
|
2381 |
-
{
|
2382 |
-
/* Create the object for storing information about this new row */
|
2383 |
-
var iRow = oSettings.aoData.length;
|
2384 |
-
var oData = $.extend( true, {}, WFDataTable.models.oRow, {
|
2385 |
-
src: nTr ? 'dom' : 'data',
|
2386 |
-
idx: iRow
|
2387 |
-
} );
|
2388 |
-
|
2389 |
-
oData._aData = aDataIn;
|
2390 |
-
oSettings.aoData.push( oData );
|
2391 |
-
|
2392 |
-
/* Create the cells */
|
2393 |
-
var nTd, sThisType;
|
2394 |
-
var columns = oSettings.aoColumns;
|
2395 |
-
|
2396 |
-
// Invalidate the column types as the new data needs to be revalidated
|
2397 |
-
for ( var i=0, iLen=columns.length ; i<iLen ; i++ )
|
2398 |
-
{
|
2399 |
-
columns[i].sType = null;
|
2400 |
-
}
|
2401 |
-
|
2402 |
-
/* Add to the display array */
|
2403 |
-
oSettings.aiDisplayMaster.push( iRow );
|
2404 |
-
|
2405 |
-
var id = oSettings.rowIdFn( aDataIn );
|
2406 |
-
if ( id !== undefined ) {
|
2407 |
-
oSettings.aIds[ id ] = oData;
|
2408 |
-
}
|
2409 |
-
|
2410 |
-
/* Create the DOM information, or register it if already present */
|
2411 |
-
if ( nTr || ! oSettings.oFeatures.bDeferRender )
|
2412 |
-
{
|
2413 |
-
_fnCreateTr( oSettings, iRow, nTr, anTds );
|
2414 |
-
}
|
2415 |
-
|
2416 |
-
return iRow;
|
2417 |
-
}
|
2418 |
-
|
2419 |
-
|
2420 |
-
/**
|
2421 |
-
* Add one or more TR elements to the table. Generally we'd expect to
|
2422 |
-
* use this for reading data from a DOM sourced table, but it could be
|
2423 |
-
* used for an TR element. Note that if a TR is given, it is used (i.e.
|
2424 |
-
* it is not cloned).
|
2425 |
-
* @param {object} settings dataTables settings object
|
2426 |
-
* @param {array|node|jQuery} trs The TR element(s) to add to the table
|
2427 |
-
* @returns {array} Array of indexes for the added rows
|
2428 |
-
* @memberof WFDataTable#oApi
|
2429 |
-
*/
|
2430 |
-
function _fnAddTr( settings, trs )
|
2431 |
-
{
|
2432 |
-
var row;
|
2433 |
-
|
2434 |
-
// Allow an individual node to be passed in
|
2435 |
-
if ( ! (trs instanceof $) ) {
|
2436 |
-
trs = $(trs);
|
2437 |
-
}
|
2438 |
-
|
2439 |
-
return trs.map( function (i, el) {
|
2440 |
-
row = _fnGetRowElements( settings, el );
|
2441 |
-
return _fnAddData( settings, row.data, el, row.cells );
|
2442 |
-
} );
|
2443 |
-
}
|
2444 |
-
|
2445 |
-
|
2446 |
-
/**
|
2447 |
-
* Take a TR element and convert it to an index in aoData
|
2448 |
-
* @param {object} oSettings dataTables settings object
|
2449 |
-
* @param {node} n the TR element to find
|
2450 |
-
* @returns {int} index if the node is found, null if not
|
2451 |
-
* @memberof WFDataTable#oApi
|
2452 |
-
*/
|
2453 |
-
function _fnNodeToDataIndex( oSettings, n )
|
2454 |
-
{
|
2455 |
-
return (n._DT_RowIndex!==undefined) ? n._DT_RowIndex : null;
|
2456 |
-
}
|
2457 |
-
|
2458 |
-
|
2459 |
-
/**
|
2460 |
-
* Take a TD element and convert it into a column data index (not the visible index)
|
2461 |
-
* @param {object} oSettings dataTables settings object
|
2462 |
-
* @param {int} iRow The row number the TD/TH can be found in
|
2463 |
-
* @param {node} n The TD/TH element to find
|
2464 |
-
* @returns {int} index if the node is found, -1 if not
|
2465 |
-
* @memberof WFDataTable#oApi
|
2466 |
-
*/
|
2467 |
-
function _fnNodeToColumnIndex( oSettings, iRow, n )
|
2468 |
-
{
|
2469 |
-
return $.inArray( n, oSettings.aoData[ iRow ].anCells );
|
2470 |
-
}
|
2471 |
-
|
2472 |
-
|
2473 |
-
/**
|
2474 |
-
* Get the data for a given cell from the internal cache, taking into account data mapping
|
2475 |
-
* @param {object} settings dataTables settings object
|
2476 |
-
* @param {int} rowIdx aoData row id
|
2477 |
-
* @param {int} colIdx Column index
|
2478 |
-
* @param {string} type data get type ('display', 'type' 'filter' 'sort')
|
2479 |
-
* @returns {*} Cell data
|
2480 |
-
* @memberof WFDataTable#oApi
|
2481 |
-
*/
|
2482 |
-
function _fnGetCellData( settings, rowIdx, colIdx, type )
|
2483 |
-
{
|
2484 |
-
var draw = settings.iDraw;
|
2485 |
-
var col = settings.aoColumns[colIdx];
|
2486 |
-
var rowData = settings.aoData[rowIdx]._aData;
|
2487 |
-
var defaultContent = col.sDefaultContent;
|
2488 |
-
var cellData = col.fnGetData( rowData, type, {
|
2489 |
-
settings: settings,
|
2490 |
-
row: rowIdx,
|
2491 |
-
col: colIdx
|
2492 |
-
} );
|
2493 |
-
|
2494 |
-
if ( cellData === undefined ) {
|
2495 |
-
if ( settings.iDrawError != draw && defaultContent === null ) {
|
2496 |
-
_fnLog( settings, 0, "Requested unknown parameter "+
|
2497 |
-
(typeof col.mData=='function' ? '{function}' : "'"+col.mData+"'")+
|
2498 |
-
" for row "+rowIdx+", column "+colIdx, 4 );
|
2499 |
-
settings.iDrawError = draw;
|
2500 |
-
}
|
2501 |
-
return defaultContent;
|
2502 |
-
}
|
2503 |
-
|
2504 |
-
// When the data source is null and a specific data type is requested (i.e.
|
2505 |
-
// not the original data), we can use default column data
|
2506 |
-
if ( (cellData === rowData || cellData === null) && defaultContent !== null && type !== undefined ) {
|
2507 |
-
cellData = defaultContent;
|
2508 |
-
}
|
2509 |
-
else if ( typeof cellData === 'function' ) {
|
2510 |
-
// If the data source is a function, then we run it and use the return,
|
2511 |
-
// executing in the scope of the data object (for instances)
|
2512 |
-
return cellData.call( rowData );
|
2513 |
-
}
|
2514 |
-
|
2515 |
-
if ( cellData === null && type == 'display' ) {
|
2516 |
-
return '';
|
2517 |
-
}
|
2518 |
-
return cellData;
|
2519 |
-
}
|
2520 |
-
|
2521 |
-
|
2522 |
-
/**
|
2523 |
-
* Set the value for a specific cell, into the internal data cache
|
2524 |
-
* @param {object} settings dataTables settings object
|
2525 |
-
* @param {int} rowIdx aoData row id
|
2526 |
-
* @param {int} colIdx Column index
|
2527 |
-
* @param {*} val Value to set
|
2528 |
-
* @memberof WFDataTable#oApi
|
2529 |
-
*/
|
2530 |
-
function _fnSetCellData( settings, rowIdx, colIdx, val )
|
2531 |
-
{
|
2532 |
-
var col = settings.aoColumns[colIdx];
|
2533 |
-
var rowData = settings.aoData[rowIdx]._aData;
|
2534 |
-
|
2535 |
-
col.fnSetData( rowData, val, {
|
2536 |
-
settings: settings,
|
2537 |
-
row: rowIdx,
|
2538 |
-
col: colIdx
|
2539 |
-
} );
|
2540 |
-
}
|
2541 |
-
|
2542 |
-
|
2543 |
-
// Private variable that is used to match action syntax in the data property object
|
2544 |
-
var __reArray = /\[.*?\]$/;
|
2545 |
-
var __reFn = /\(\)$/;
|
2546 |
-
|
2547 |
-
/**
|
2548 |
-
* Split string on periods, taking into account escaped periods
|
2549 |
-
* @param {string} str String to split
|
2550 |
-
* @return {array} Split string
|
2551 |
-
*/
|
2552 |
-
function _fnSplitObjNotation( str )
|
2553 |
-
{
|
2554 |
-
return $.map( str.match(/(\\.|[^\.])+/g) || [''], function ( s ) {
|
2555 |
-
return s.replace(/\\\./g, '.');
|
2556 |
-
} );
|
2557 |
-
}
|
2558 |
-
|
2559 |
-
|
2560 |
-
/**
|
2561 |
-
* Return a function that can be used to get data from a source object, taking
|
2562 |
-
* into account the ability to use nested objects as a source
|
2563 |
-
* @param {string|int|function} mSource The data source for the object
|
2564 |
-
* @returns {function} Data get function
|
2565 |
-
* @memberof WFDataTable#oApi
|
2566 |
-
*/
|
2567 |
-
function _fnGetObjectDataFn( mSource )
|
2568 |
-
{
|
2569 |
-
if ( $.isPlainObject( mSource ) )
|
2570 |
-
{
|
2571 |
-
/* Build an object of get functions, and wrap them in a single call */
|
2572 |
-
var o = {};
|
2573 |
-
$.each( mSource, function (key, val) {
|
2574 |
-
if ( val ) {
|
2575 |
-
o[key] = _fnGetObjectDataFn( val );
|
2576 |
-
}
|
2577 |
-
} );
|
2578 |
-
|
2579 |
-
return function (data, type, row, meta) {
|
2580 |
-
var t = o[type] || o._;
|
2581 |
-
return t !== undefined ?
|
2582 |
-
t(data, type, row, meta) :
|
2583 |
-
data;
|
2584 |
-
};
|
2585 |
-
}
|
2586 |
-
else if ( mSource === null )
|
2587 |
-
{
|
2588 |
-
/* Give an empty string for rendering / sorting etc */
|
2589 |
-
return function (data) { // type, row and meta also passed, but not used
|
2590 |
-
return data;
|
2591 |
-
};
|
2592 |
-
}
|
2593 |
-
else if ( typeof mSource === 'function' )
|
2594 |
-
{
|
2595 |
-
return function (data, type, row, meta) {
|
2596 |
-
return mSource( data, type, row, meta );
|
2597 |
-
};
|
2598 |
-
}
|
2599 |
-
else if ( typeof mSource === 'string' && (mSource.indexOf('.') !== -1 ||
|
2600 |
-
mSource.indexOf('[') !== -1 || mSource.indexOf('(') !== -1) )
|
2601 |
-
{
|
2602 |
-
/* If there is a . in the source string then the data source is in a
|
2603 |
-
* nested object so we loop over the data for each level to get the next
|
2604 |
-
* level down. On each loop we test for undefined, and if found immediately
|
2605 |
-
* return. This allows entire objects to be missing and sDefaultContent to
|
2606 |
-
* be used if defined, rather than throwing an error
|
2607 |
-
*/
|
2608 |
-
var fetchData = function (data, type, src) {
|
2609 |
-
var arrayNotation, funcNotation, out, innerSrc;
|
2610 |
-
|
2611 |
-
if ( src !== "" )
|
2612 |
-
{
|
2613 |
-
var a = _fnSplitObjNotation( src );
|
2614 |
-
|
2615 |
-
for ( var i=0, iLen=a.length ; i<iLen ; i++ )
|
2616 |
-
{
|
2617 |
-
// Check if we are dealing with special notation
|
2618 |
-
arrayNotation = a[i].match(__reArray);
|
2619 |
-
funcNotation = a[i].match(__reFn);
|
2620 |
-
|
2621 |
-
if ( arrayNotation )
|
2622 |
-
{
|
2623 |
-
// Array notation
|
2624 |
-
a[i] = a[i].replace(__reArray, '');
|
2625 |
-
|
2626 |
-
// Condition allows simply [] to be passed in
|
2627 |
-
if ( a[i] !== "" ) {
|
2628 |
-
data = data[ a[i] ];
|
2629 |
-
}
|
2630 |
-
out = [];
|
2631 |
-
|
2632 |
-
// Get the remainder of the nested object to get
|
2633 |
-
a.splice( 0, i+1 );
|
2634 |
-
innerSrc = a.join('.');
|
2635 |
-
|
2636 |
-
// Traverse each entry in the array getting the properties requested
|
2637 |
-
if ( $.isArray( data ) ) {
|
2638 |
-
for ( var j=0, jLen=data.length ; j<jLen ; j++ ) {
|
2639 |
-
out.push( fetchData( data[j], type, innerSrc ) );
|
2640 |
-
}
|
2641 |
-
}
|
2642 |
-
|
2643 |
-
// If a string is given in between the array notation indicators, that
|
2644 |
-
// is used to join the strings together, otherwise an array is returned
|
2645 |
-
var join = arrayNotation[0].substring(1, arrayNotation[0].length-1);
|
2646 |
-
data = (join==="") ? out : out.join(join);
|
2647 |
-
|
2648 |
-
// The inner call to fetchData has already traversed through the remainder
|
2649 |
-
// of the source requested, so we exit from the loop
|
2650 |
-
break;
|
2651 |
-
}
|
2652 |
-
else if ( funcNotation )
|
2653 |
-
{
|
2654 |
-
// Function call
|
2655 |
-
a[i] = a[i].replace(__reFn, '');
|
2656 |
-
data = data[ a[i] ]();
|
2657 |
-
continue;
|
2658 |
-
}
|
2659 |
-
|
2660 |
-
if ( data === null || data[ a[i] ] === undefined )
|
2661 |
-
{
|
2662 |
-
return undefined;
|
2663 |
-
}
|
2664 |
-
data = data[ a[i] ];
|
2665 |
-
}
|
2666 |
-
}
|
2667 |
-
|
2668 |
-
return data;
|
2669 |
-
};
|
2670 |
-
|
2671 |
-
return function (data, type) { // row and meta also passed, but not used
|
2672 |
-
return fetchData( data, type, mSource );
|
2673 |
-
};
|
2674 |
-
}
|
2675 |
-
else
|
2676 |
-
{
|
2677 |
-
/* Array or flat object mapping */
|
2678 |
-
return function (data, type) { // row and meta also passed, but not used
|
2679 |
-
return data[mSource];
|
2680 |
-
};
|
2681 |
-
}
|
2682 |
-
}
|
2683 |
-
|
2684 |
-
|
2685 |
-
/**
|
2686 |
-
* Return a function that can be used to set data from a source object, taking
|
2687 |
-
* into account the ability to use nested objects as a source
|
2688 |
-
* @param {string|int|function} mSource The data source for the object
|
2689 |
-
* @returns {function} Data set function
|
2690 |
-
* @memberof WFDataTable#oApi
|
2691 |
-
*/
|
2692 |
-
function _fnSetObjectDataFn( mSource )
|
2693 |
-
{
|
2694 |
-
if ( $.isPlainObject( mSource ) )
|
2695 |
-
{
|
2696 |
-
/* Unlike get, only the underscore (global) option is used for for
|
2697 |
-
* setting data since we don't know the type here. This is why an object
|
2698 |
-
* option is not documented for `mData` (which is read/write), but it is
|
2699 |
-
* for `mRender` which is read only.
|
2700 |
-
*/
|
2701 |
-
return _fnSetObjectDataFn( mSource._ );
|
2702 |
-
}
|
2703 |
-
else if ( mSource === null )
|
2704 |
-
{
|
2705 |
-
/* Nothing to do when the data source is null */
|
2706 |
-
return function () {};
|
2707 |
-
}
|
2708 |
-
else if ( typeof mSource === 'function' )
|
2709 |
-
{
|
2710 |
-
return function (data, val, meta) {
|
2711 |
-
mSource( data, 'set', val, meta );
|
2712 |
-
};
|
2713 |
-
}
|
2714 |
-
else if ( typeof mSource === 'string' && (mSource.indexOf('.') !== -1 ||
|
2715 |
-
mSource.indexOf('[') !== -1 || mSource.indexOf('(') !== -1) )
|
2716 |
-
{
|
2717 |
-
/* Like the get, we need to get data from a nested object */
|
2718 |
-
var setData = function (data, val, src) {
|
2719 |
-
var a = _fnSplitObjNotation( src ), b;
|
2720 |
-
var aLast = a[a.length-1];
|
2721 |
-
var arrayNotation, funcNotation, o, innerSrc;
|
2722 |
-
|
2723 |
-
for ( var i=0, iLen=a.length-1 ; i<iLen ; i++ )
|
2724 |
-
{
|
2725 |
-
// Check if we are dealing with an array notation request
|
2726 |
-
arrayNotation = a[i].match(__reArray);
|
2727 |
-
funcNotation = a[i].match(__reFn);
|
2728 |
-
|
2729 |
-
if ( arrayNotation )
|
2730 |
-
{
|
2731 |
-
a[i] = a[i].replace(__reArray, '');
|
2732 |
-
data[ a[i] ] = [];
|
2733 |
-
|
2734 |
-
// Get the remainder of the nested object to set so we can recurse
|
2735 |
-
b = a.slice();
|
2736 |
-
b.splice( 0, i+1 );
|
2737 |
-
innerSrc = b.join('.');
|
2738 |
-
|
2739 |
-
// Traverse each entry in the array setting the properties requested
|
2740 |
-
if ( $.isArray( val ) )
|
2741 |
-
{
|
2742 |
-
for ( var j=0, jLen=val.length ; j<jLen ; j++ )
|
2743 |
-
{
|
2744 |
-
o = {};
|
2745 |
-
setData( o, val[j], innerSrc );
|
2746 |
-
data[ a[i] ].push( o );
|
2747 |
-
}
|
2748 |
-
}
|
2749 |
-
else
|
2750 |
-
{
|
2751 |
-
// We've been asked to save data to an array, but it
|
2752 |
-
// isn't array data to be saved. Best that can be done
|
2753 |
-
// is to just save the value.
|
2754 |
-
data[ a[i] ] = val;
|
2755 |
-
}
|
2756 |
-
|
2757 |
-
// The inner call to setData has already traversed through the remainder
|
2758 |
-
// of the source and has set the data, thus we can exit here
|
2759 |
-
return;
|
2760 |
-
}
|
2761 |
-
else if ( funcNotation )
|
2762 |
-
{
|
2763 |
-
// Function call
|
2764 |
-
a[i] = a[i].replace(__reFn, '');
|
2765 |
-
data = data[ a[i] ]( val );
|
2766 |
-
}
|
2767 |
-
|
2768 |
-
// If the nested object doesn't currently exist - since we are
|
2769 |
-
// trying to set the value - create it
|
2770 |
-
if ( data[ a[i] ] === null || data[ a[i] ] === undefined )
|
2771 |
-
{
|
2772 |
-
data[ a[i] ] = {};
|
2773 |
-
}
|
2774 |
-
data = data[ a[i] ];
|
2775 |
-
}
|
2776 |
-
|
2777 |
-
// Last item in the input - i.e, the actual set
|
2778 |
-
if ( aLast.match(__reFn ) )
|
2779 |
-
{
|
2780 |
-
// Function call
|
2781 |
-
data = data[ aLast.replace(__reFn, '') ]( val );
|
2782 |
-
}
|
2783 |
-
else
|
2784 |
-
{
|
2785 |
-
// If array notation is used, we just want to strip it and use the property name
|
2786 |
-
// and assign the value. If it isn't used, then we get the result we want anyway
|
2787 |
-
data[ aLast.replace(__reArray, '') ] = val;
|
2788 |
-
}
|
2789 |
-
};
|
2790 |
-
|
2791 |
-
return function (data, val) { // meta is also passed in, but not used
|
2792 |
-
return setData( data, val, mSource );
|
2793 |
-
};
|
2794 |
-
}
|
2795 |
-
else
|
2796 |
-
{
|
2797 |
-
/* Array or flat object mapping */
|
2798 |
-
return function (data, val) { // meta is also passed in, but not used
|
2799 |
-
data[mSource] = val;
|
2800 |
-
};
|
2801 |
-
}
|
2802 |
-
}
|
2803 |
-
|
2804 |
-
|
2805 |
-
/**
|
2806 |
-
* Return an array with the full table data
|
2807 |
-
* @param {object} oSettings dataTables settings object
|
2808 |
-
* @returns array {array} aData Master data array
|
2809 |
-
* @memberof WFDataTable#oApi
|
2810 |
-
*/
|
2811 |
-
function _fnGetDataMaster ( settings )
|
2812 |
-
{
|
2813 |
-
return _pluck( settings.aoData, '_aData' );
|
2814 |
-
}
|
2815 |
-
|
2816 |
-
|
2817 |
-
/**
|
2818 |
-
* Nuke the table
|
2819 |
-
* @param {object} oSettings dataTables settings object
|
2820 |
-
* @memberof WFDataTable#oApi
|
2821 |
-
*/
|
2822 |
-
function _fnClearTable( settings )
|
2823 |
-
{
|
2824 |
-
settings.aoData.length = 0;
|
2825 |
-
settings.aiDisplayMaster.length = 0;
|
2826 |
-
settings.aiDisplay.length = 0;
|
2827 |
-
settings.aIds = {};
|
2828 |
-
}
|
2829 |
-
|
2830 |
-
|
2831 |
-
/**
|
2832 |
-
* Take an array of integers (index array) and remove a target integer (value - not
|
2833 |
-
* the key!)
|
2834 |
-
* @param {array} a Index array to target
|
2835 |
-
* @param {int} iTarget value to find
|
2836 |
-
* @memberof WFDataTable#oApi
|
2837 |
-
*/
|
2838 |
-
function _fnDeleteIndex( a, iTarget, splice )
|
2839 |
-
{
|
2840 |
-
var iTargetIndex = -1;
|
2841 |
-
|
2842 |
-
for ( var i=0, iLen=a.length ; i<iLen ; i++ )
|
2843 |
-
{
|
2844 |
-
if ( a[i] == iTarget )
|
2845 |
-
{
|
2846 |
-
iTargetIndex = i;
|
2847 |
-
}
|
2848 |
-
else if ( a[i] > iTarget )
|
2849 |
-
{
|
2850 |
-
a[i]--;
|
2851 |
-
}
|
2852 |
-
}
|
2853 |
-
|
2854 |
-
if ( iTargetIndex != -1 && splice === undefined )
|
2855 |
-
{
|
2856 |
-
a.splice( iTargetIndex, 1 );
|
2857 |
-
}
|
2858 |
-
}
|
2859 |
-
|
2860 |
-
|
2861 |
-
/**
|
2862 |
-
* Mark cached data as invalid such that a re-read of the data will occur when
|
2863 |
-
* the cached data is next requested. Also update from the data source object.
|
2864 |
-
*
|
2865 |
-
* @param {object} settings WFDataTables settings object
|
2866 |
-
* @param {int} rowIdx Row index to invalidate
|
2867 |
-
* @param {string} [src] Source to invalidate from: undefined, 'auto', 'dom'
|
2868 |
-
* or 'data'
|
2869 |
-
* @param {int} [colIdx] Column index to invalidate. If undefined the whole
|
2870 |
-
* row will be invalidated
|
2871 |
-
* @memberof WFDataTable#oApi
|
2872 |
-
*
|
2873 |
-
* @todo For the modularisation of v1.11 this will need to become a callback, so
|
2874 |
-
* the sort and filter methods can subscribe to it. That will required
|
2875 |
-
* initialisation options for sorting, which is why it is not already baked in
|
2876 |
-
*/
|
2877 |
-
function _fnInvalidate( settings, rowIdx, src, colIdx )
|
2878 |
-
{
|
2879 |
-
var row = settings.aoData[ rowIdx ];
|
2880 |
-
var i, ien;
|
2881 |
-
var cellWrite = function ( cell, col ) {
|
2882 |
-
// This is very frustrating, but in IE if you just write directly
|
2883 |
-
// to innerHTML, and elements that are overwritten are GC'ed,
|
2884 |
-
// even if there is a reference to them elsewhere
|
2885 |
-
while ( cell.childNodes.length ) {
|
2886 |
-
cell.removeChild( cell.firstChild );
|
2887 |
-
}
|
2888 |
-
|
2889 |
-
cell.innerHTML = _fnGetCellData( settings, rowIdx, col, 'display' );
|
2890 |
-
};
|
2891 |
-
|
2892 |
-
// Are we reading last data from DOM or the data object?
|
2893 |
-
if ( src === 'dom' || ((! src || src === 'auto') && row.src === 'dom') ) {
|
2894 |
-
// Read the data from the DOM
|
2895 |
-
row._aData = _fnGetRowElements(
|
2896 |
-
settings, row, colIdx, colIdx === undefined ? undefined : row._aData
|
2897 |
-
)
|
2898 |
-
.data;
|
2899 |
-
}
|
2900 |
-
else {
|
2901 |
-
// Reading from data object, update the DOM
|
2902 |
-
var cells = row.anCells;
|
2903 |
-
|
2904 |
-
if ( cells ) {
|
2905 |
-
if ( colIdx !== undefined ) {
|
2906 |
-
cellWrite( cells[colIdx], colIdx );
|
2907 |
-
}
|
2908 |
-
else {
|
2909 |
-
for ( i=0, ien=cells.length ; i<ien ; i++ ) {
|
2910 |
-
cellWrite( cells[i], i );
|
2911 |
-
}
|
2912 |
-
}
|
2913 |
-
}
|
2914 |
-
}
|
2915 |
-
|
2916 |
-
// For both row and cell invalidation, the cached data for sorting and
|
2917 |
-
// filtering is nulled out
|
2918 |
-
row._aSortData = null;
|
2919 |
-
row._aFilterData = null;
|
2920 |
-
|
2921 |
-
// Invalidate the type for a specific column (if given) or all columns since
|
2922 |
-
// the data might have changed
|
2923 |
-
var cols = settings.aoColumns;
|
2924 |
-
if ( colIdx !== undefined ) {
|
2925 |
-
cols[ colIdx ].sType = null;
|
2926 |
-
}
|
2927 |
-
else {
|
2928 |
-
for ( i=0, ien=cols.length ; i<ien ; i++ ) {
|
2929 |
-
cols[i].sType = null;
|
2930 |
-
}
|
2931 |
-
|
2932 |
-
// Update WFDataTables special `DT_*` attributes for the row
|
2933 |
-
_fnRowAttributes( settings, row );
|
2934 |
-
}
|
2935 |
-
}
|
2936 |
-
|
2937 |
-
|
2938 |
-
/**
|
2939 |
-
* Build a data source object from an HTML row, reading the contents of the
|
2940 |
-
* cells that are in the row.
|
2941 |
-
*
|
2942 |
-
* @param {object} settings WFDataTables settings object
|
2943 |
-
* @param {node|object} TR element from which to read data or existing row
|
2944 |
-
* object from which to re-read the data from the cells
|
2945 |
-
* @param {int} [colIdx] Optional column index
|
2946 |
-
* @param {array|object} [d] Data source object. If `colIdx` is given then this
|
2947 |
-
* parameter should also be given and will be used to write the data into.
|
2948 |
-
* Only the column in question will be written
|
2949 |
-
* @returns {object} Object with two parameters: `data` the data read, in
|
2950 |
-
* document order, and `cells` and array of nodes (they can be useful to the
|
2951 |
-
* caller, so rather than needing a second traversal to get them, just return
|
2952 |
-
* them from here).
|
2953 |
-
* @memberof WFDataTable#oApi
|
2954 |
-
*/
|
2955 |
-
function _fnGetRowElements( settings, row, colIdx, d )
|
2956 |
-
{
|
2957 |
-
var
|
2958 |
-
tds = [],
|
2959 |
-
td = row.firstChild,
|
2960 |
-
name, col, o, i=0, contents,
|
2961 |
-
columns = settings.aoColumns,
|
2962 |
-
objectRead = settings._rowReadObject;
|
2963 |
-
|
2964 |
-
// Allow the data object to be passed in, or construct
|
2965 |
-
d = d !== undefined ?
|
2966 |
-
d :
|
2967 |
-
objectRead ?
|
2968 |
-
{} :
|
2969 |
-
[];
|
2970 |
-
|
2971 |
-
var attr = function ( str, td ) {
|
2972 |
-
if ( typeof str === 'string' ) {
|
2973 |
-
var idx = str.indexOf('@');
|
2974 |
-
|
2975 |
-
if ( idx !== -1 ) {
|
2976 |
-
var attr = str.substring( idx+1 );
|
2977 |
-
var setter = _fnSetObjectDataFn( str );
|
2978 |
-
setter( d, td.getAttribute( attr ) );
|
2979 |
-
}
|
2980 |
-
}
|
2981 |
-
};
|
2982 |
-
|
2983 |
-
// Read data from a cell and store into the data object
|
2984 |
-
var cellProcess = function ( cell ) {
|
2985 |
-
if ( colIdx === undefined || colIdx === i ) {
|
2986 |
-
col = columns[i];
|
2987 |
-
contents = $.trim(cell.innerHTML);
|
2988 |
-
|
2989 |
-
if ( col && col._bAttrSrc ) {
|
2990 |
-
var setter = _fnSetObjectDataFn( col.mData._ );
|
2991 |
-
setter( d, contents );
|
2992 |
-
|
2993 |
-
attr( col.mData.sort, cell );
|
2994 |
-
attr( col.mData.type, cell );
|
2995 |
-
attr( col.mData.filter, cell );
|
2996 |
-
}
|
2997 |
-
else {
|
2998 |
-
// Depending on the `data` option for the columns the data can
|
2999 |
-
// be read to either an object or an array.
|
3000 |
-
if ( objectRead ) {
|
3001 |
-
if ( ! col._setter ) {
|
3002 |
-
// Cache the setter function
|
3003 |
-
col._setter = _fnSetObjectDataFn( col.mData );
|
3004 |
-
}
|
3005 |
-
col._setter( d, contents );
|
3006 |
-
}
|
3007 |
-
else {
|
3008 |
-
d[i] = contents;
|
3009 |
-
}
|
3010 |
-
}
|
3011 |
-
}
|
3012 |
-
|
3013 |
-
i++;
|
3014 |
-
};
|
3015 |
-
|
3016 |
-
if ( td ) {
|
3017 |
-
// `tr` element was passed in
|
3018 |
-
while ( td ) {
|
3019 |
-
name = td.nodeName.toUpperCase();
|
3020 |
-
|
3021 |
-
if ( name == "TD" || name == "TH" ) {
|
3022 |
-
cellProcess( td );
|
3023 |
-
tds.push( td );
|
3024 |
-
}
|
3025 |
-
|
3026 |
-
td = td.nextSibling;
|
3027 |
-
}
|
3028 |
-
}
|
3029 |
-
else {
|
3030 |
-
// Existing row object passed in
|
3031 |
-
tds = row.anCells;
|
3032 |
-
|
3033 |
-
for ( var j=0, jen=tds.length ; j<jen ; j++ ) {
|
3034 |
-
cellProcess( tds[j] );
|
3035 |
-
}
|
3036 |
-
}
|
3037 |
-
|
3038 |
-
// Read the ID from the DOM if present
|
3039 |
-
var rowNode = row.firstChild ? row : row.nTr;
|
3040 |
-
|
3041 |
-
if ( rowNode ) {
|
3042 |
-
var id = rowNode.getAttribute( 'id' );
|
3043 |
-
|
3044 |
-
if ( id ) {
|
3045 |
-
_fnSetObjectDataFn( settings.rowId )( d, id );
|
3046 |
-
}
|
3047 |
-
}
|
3048 |
-
|
3049 |
-
return {
|
3050 |
-
data: d,
|
3051 |
-
cells: tds
|
3052 |
-
};
|
3053 |
-
}
|
3054 |
-
/**
|
3055 |
-
* Create a new TR element (and it's TD children) for a row
|
3056 |
-
* @param {object} oSettings dataTables settings object
|
3057 |
-
* @param {int} iRow Row to consider
|
3058 |
-
* @param {node} [nTrIn] TR element to add to the table - optional. If not given,
|
3059 |
-
* WFDataTables will create a row automatically
|
3060 |
-
* @param {array} [anTds] Array of TD|TH elements for the row - must be given
|
3061 |
-
* if nTr is.
|
3062 |
-
* @memberof WFDataTable#oApi
|
3063 |
-
*/
|
3064 |
-
function _fnCreateTr ( oSettings, iRow, nTrIn, anTds )
|
3065 |
-
{
|
3066 |
-
var
|
3067 |
-
row = oSettings.aoData[iRow],
|
3068 |
-
rowData = row._aData,
|
3069 |
-
cells = [],
|
3070 |
-
nTr, nTd, oCol,
|
3071 |
-
i, iLen;
|
3072 |
-
|
3073 |
-
if ( row.nTr === null )
|
3074 |
-
{
|
3075 |
-
nTr = nTrIn || document.createElement('tr');
|
3076 |
-
|
3077 |
-
row.nTr = nTr;
|
3078 |
-
row.anCells = cells;
|
3079 |
-
|
3080 |
-
/* Use a private property on the node to allow reserve mapping from the node
|
3081 |
-
* to the aoData array for fast look up
|
3082 |
-
*/
|
3083 |
-
nTr._DT_RowIndex = iRow;
|
3084 |
-
|
3085 |
-
/* Special parameters can be given by the data source to be used on the row */
|
3086 |
-
_fnRowAttributes( oSettings, row );
|
3087 |
-
|
3088 |
-
/* Process each column */
|
3089 |
-
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
|
3090 |
-
{
|
3091 |
-
oCol = oSettings.aoColumns[i];
|
3092 |
-
|
3093 |
-
nTd = nTrIn ? anTds[i] : document.createElement( oCol.sCellType );
|
3094 |
-
nTd._DT_CellIndex = {
|
3095 |
-
row: iRow,
|
3096 |
-
column: i
|
3097 |
-
};
|
3098 |
-
|
3099 |
-
cells.push( nTd );
|
3100 |
-
|
3101 |
-
// Need to create the HTML if new, or if a rendering function is defined
|
3102 |
-
if ( (!nTrIn || oCol.mRender || oCol.mData !== i) &&
|
3103 |
-
(!$.isPlainObject(oCol.mData) || oCol.mData._ !== i+'.display')
|
3104 |
-
) {
|
3105 |
-
nTd.innerHTML = _fnGetCellData( oSettings, iRow, i, 'display' );
|
3106 |
-
}
|
3107 |
-
|
3108 |
-
/* Add user defined class */
|
3109 |
-
if ( oCol.sClass )
|
3110 |
-
{
|
3111 |
-
nTd.className += ' '+oCol.sClass;
|
3112 |
-
}
|
3113 |
-
|
3114 |
-
// Visibility - add or remove as required
|
3115 |
-
if ( oCol.bVisible && ! nTrIn )
|
3116 |
-
{
|
3117 |
-
nTr.appendChild( nTd );
|
3118 |
-
}
|
3119 |
-
else if ( ! oCol.bVisible && nTrIn )
|
3120 |
-
{
|
3121 |
-
nTd.parentNode.removeChild( nTd );
|
3122 |
-
}
|
3123 |
-
|
3124 |
-
if ( oCol.fnCreatedCell )
|
3125 |
-
{
|
3126 |
-
oCol.fnCreatedCell.call( oSettings.oInstance,
|
3127 |
-
nTd, _fnGetCellData( oSettings, iRow, i ), rowData, iRow, i
|
3128 |
-
);
|
3129 |
-
}
|
3130 |
-
}
|
3131 |
-
|
3132 |
-
_fnCallbackFire( oSettings, 'aoRowCreatedCallback', null, [nTr, rowData, iRow] );
|
3133 |
-
}
|
3134 |
-
|
3135 |
-
// Remove once webkit bug 131819 and Chromium bug 365619 have been resolved
|
3136 |
-
// and deployed
|
3137 |
-
row.nTr.setAttribute( 'role', 'row' );
|
3138 |
-
}
|
3139 |
-
|
3140 |
-
|
3141 |
-
/**
|
3142 |
-
* Add attributes to a row based on the special `DT_*` parameters in a data
|
3143 |
-
* source object.
|
3144 |
-
* @param {object} settings WFDataTables settings object
|
3145 |
-
* @param {object} WFDataTables row object for the row to be modified
|
3146 |
-
* @memberof WFDataTable#oApi
|
3147 |
-
*/
|
3148 |
-
function _fnRowAttributes( settings, row )
|
3149 |
-
{
|
3150 |
-
var tr = row.nTr;
|
3151 |
-
var data = row._aData;
|
3152 |
-
|
3153 |
-
if ( tr ) {
|
3154 |
-
var id = settings.rowIdFn( data );
|
3155 |
-
|
3156 |
-
if ( id ) {
|
3157 |
-
tr.id = id;
|
3158 |
-
}
|
3159 |
-
|
3160 |
-
if ( data.DT_RowClass ) {
|
3161 |
-
// Remove any classes added by DT_RowClass before
|
3162 |
-
var a = data.DT_RowClass.split(' ');
|
3163 |
-
row.__rowc = row.__rowc ?
|
3164 |
-
_unique( row.__rowc.concat( a ) ) :
|
3165 |
-
a;
|
3166 |
-
|
3167 |
-
$(tr)
|
3168 |
-
.removeClass( row.__rowc.join(' ') )
|
3169 |
-
.addClass( data.DT_RowClass );
|
3170 |
-
}
|
3171 |
-
|
3172 |
-
if ( data.DT_RowAttr ) {
|
3173 |
-
$(tr).attr( data.DT_RowAttr );
|
3174 |
-
}
|
3175 |
-
|
3176 |
-
if ( data.DT_RowData ) {
|
3177 |
-
$(tr).data( data.DT_RowData );
|
3178 |
-
}
|
3179 |
-
}
|
3180 |
-
}
|
3181 |
-
|
3182 |
-
|
3183 |
-
/**
|
3184 |
-
* Create the HTML header for the table
|
3185 |
-
* @param {object} oSettings dataTables settings object
|
3186 |
-
* @memberof WFDataTable#oApi
|
3187 |
-
*/
|
3188 |
-
function _fnBuildHead( oSettings )
|
3189 |
-
{
|
3190 |
-
var i, ien, cell, row, column;
|
3191 |
-
var thead = oSettings.nTHead;
|
3192 |
-
var tfoot = oSettings.nTFoot;
|
3193 |
-
var createHeader = $('th, td', thead).length === 0;
|
3194 |
-
var classes = oSettings.oClasses;
|
3195 |
-
var columns = oSettings.aoColumns;
|
3196 |
-
|
3197 |
-
if ( createHeader ) {
|
3198 |
-
row = $('<tr/>').appendTo( thead );
|
3199 |
-
}
|
3200 |
-
|
3201 |
-
for ( i=0, ien=columns.length ; i<ien ; i++ ) {
|
3202 |
-
column = columns[i];
|
3203 |
-
cell = $( column.nTh ).addClass( column.sClass );
|
3204 |
-
|
3205 |
-
if ( createHeader ) {
|
3206 |
-
cell.appendTo( row );
|
3207 |
-
}
|
3208 |
-
|
3209 |
-
// 1.11 move into sorting
|
3210 |
-
if ( oSettings.oFeatures.bSort ) {
|
3211 |
-
cell.addClass( column.sSortingClass );
|
3212 |
-
|
3213 |
-
if ( column.bSortable !== false ) {
|
3214 |
-
cell
|
3215 |
-
.attr( 'tabindex', oSettings.iTabIndex )
|
3216 |
-
.attr( 'aria-controls', oSettings.sTableId );
|
3217 |
-
|
3218 |
-
_fnSortAttachListener( oSettings, column.nTh, i );
|
3219 |
-
}
|
3220 |
-
}
|
3221 |
-
|
3222 |
-
if ( column.sTitle != cell[0].innerHTML ) {
|
3223 |
-
cell.html( column.sTitle );
|
3224 |
-
}
|
3225 |
-
|
3226 |
-
_fnRenderer( oSettings, 'header' )(
|
3227 |
-
oSettings, cell, column, classes
|
3228 |
-
);
|
3229 |
-
}
|
3230 |
-
|
3231 |
-
if ( createHeader ) {
|
3232 |
-
_fnDetectHeader( oSettings.aoHeader, thead );
|
3233 |
-
}
|
3234 |
-
|
3235 |
-
/* ARIA role for the rows */
|
3236 |
-
$(thead).find('>tr').attr('role', 'row');
|
3237 |
-
|
3238 |
-
/* Deal with the footer - add classes if required */
|
3239 |
-
$(thead).find('>tr>th, >tr>td').addClass( classes.sHeaderTH );
|
3240 |
-
$(tfoot).find('>tr>th, >tr>td').addClass( classes.sFooterTH );
|
3241 |
-
|
3242 |
-
// Cache the footer cells. Note that we only take the cells from the first
|
3243 |
-
// row in the footer. If there is more than one row the user wants to
|
3244 |
-
// interact with, they need to use the table().foot() method. Note also this
|
3245 |
-
// allows cells to be used for multiple columns using colspan
|
3246 |
-
if ( tfoot !== null ) {
|
3247 |
-
var cells = oSettings.aoFooter[0];
|
3248 |
-
|
3249 |
-
for ( i=0, ien=cells.length ; i<ien ; i++ ) {
|
3250 |
-
column = columns[i];
|
3251 |
-
column.nTf = cells[i].cell;
|
3252 |
-
|
3253 |
-
if ( column.sClass ) {
|
3254 |
-
$(column.nTf).addClass( column.sClass );
|
3255 |
-
}
|
3256 |
-
}
|
3257 |
-
}
|
3258 |
-
}
|
3259 |
-
|
3260 |
-
|
3261 |
-
/**
|
3262 |
-
* Draw the header (or footer) element based on the column visibility states. The
|
3263 |
-
* methodology here is to use the layout array from _fnDetectHeader, modified for
|
3264 |
-
* the instantaneous column visibility, to construct the new layout. The grid is
|
3265 |
-
* traversed over cell at a time in a rows x columns grid fashion, although each
|
3266 |
-
* cell insert can cover multiple elements in the grid - which is tracks using the
|
3267 |
-
* aApplied array. Cell inserts in the grid will only occur where there isn't
|
3268 |
-
* already a cell in that position.
|
3269 |
-
* @param {object} oSettings dataTables settings object
|
3270 |
-
* @param array {objects} aoSource Layout array from _fnDetectHeader
|
3271 |
-
* @param {boolean} [bIncludeHidden=false] If true then include the hidden columns in the calc,
|
3272 |
-
* @memberof WFDataTable#oApi
|
3273 |
-
*/
|
3274 |
-
function _fnDrawHead( oSettings, aoSource, bIncludeHidden )
|
3275 |
-
{
|
3276 |
-
var i, iLen, j, jLen, k, kLen, n, nLocalTr;
|
3277 |
-
var aoLocal = [];
|
3278 |
-
var aApplied = [];
|
3279 |
-
var iColumns = oSettings.aoColumns.length;
|
3280 |
-
var iRowspan, iColspan;
|
3281 |
-
|
3282 |
-
if ( ! aoSource )
|
3283 |
-
{
|
3284 |
-
return;
|
3285 |
-
}
|
3286 |
-
|
3287 |
-
if ( bIncludeHidden === undefined )
|
3288 |
-
{
|
3289 |
-
bIncludeHidden = false;
|
3290 |
-
}
|
3291 |
-
|
3292 |
-
/* Make a copy of the master layout array, but without the visible columns in it */
|
3293 |
-
for ( i=0, iLen=aoSource.length ; i<iLen ; i++ )
|
3294 |
-
{
|
3295 |
-
aoLocal[i] = aoSource[i].slice();
|
3296 |
-
aoLocal[i].nTr = aoSource[i].nTr;
|
3297 |
-
|
3298 |
-
/* Remove any columns which are currently hidden */
|
3299 |
-
for ( j=iColumns-1 ; j>=0 ; j-- )
|
3300 |
-
{
|
3301 |
-
if ( !oSettings.aoColumns[j].bVisible && !bIncludeHidden )
|
3302 |
-
{
|
3303 |
-
aoLocal[i].splice( j, 1 );
|
3304 |
-
}
|
3305 |
-
}
|
3306 |
-
|
3307 |
-
/* Prep the applied array - it needs an element for each row */
|
3308 |
-
aApplied.push( [] );
|
3309 |
-
}
|
3310 |
-
|
3311 |
-
for ( i=0, iLen=aoLocal.length ; i<iLen ; i++ )
|
3312 |
-
{
|
3313 |
-
nLocalTr = aoLocal[i].nTr;
|
3314 |
-
|
3315 |
-
/* All cells are going to be replaced, so empty out the row */
|
3316 |
-
if ( nLocalTr )
|
3317 |
-
{
|
3318 |
-
while( (n = nLocalTr.firstChild) )
|
3319 |
-
{
|
3320 |
-
nLocalTr.removeChild( n );
|
3321 |
-
}
|
3322 |
-
}
|
3323 |
-
|
3324 |
-
for ( j=0, jLen=aoLocal[i].length ; j<jLen ; j++ )
|
3325 |
-
{
|
3326 |
-
iRowspan = 1;
|
3327 |
-
iColspan = 1;
|
3328 |
-
|
3329 |
-
/* Check to see if there is already a cell (row/colspan) covering our target
|
3330 |
-
* insert point. If there is, then there is nothing to do.
|
3331 |
-
*/
|
3332 |
-
if ( aApplied[i][j] === undefined )
|
3333 |
-
{
|
3334 |
-
nLocalTr.appendChild( aoLocal[i][j].cell );
|
3335 |
-
aApplied[i][j] = 1;
|
3336 |
-
|
3337 |
-
/* Expand the cell to cover as many rows as needed */
|
3338 |
-
while ( aoLocal[i+iRowspan] !== undefined &&
|
3339 |
-
aoLocal[i][j].cell == aoLocal[i+iRowspan][j].cell )
|
3340 |
-
{
|
3341 |
-
aApplied[i+iRowspan][j] = 1;
|
3342 |
-
iRowspan++;
|
3343 |
-
}
|
3344 |
-
|
3345 |
-
/* Expand the cell to cover as many columns as needed */
|
3346 |
-
while ( aoLocal[i][j+iColspan] !== undefined &&
|
3347 |
-
aoLocal[i][j].cell == aoLocal[i][j+iColspan].cell )
|
3348 |
-
{
|
3349 |
-
/* Must update the applied array over the rows for the columns */
|
3350 |
-
for ( k=0 ; k<iRowspan ; k++ )
|
3351 |
-
{
|
3352 |
-
aApplied[i+k][j+iColspan] = 1;
|
3353 |
-
}
|
3354 |
-
iColspan++;
|
3355 |
-
}
|
3356 |
-
|
3357 |
-
/* Do the actual expansion in the DOM */
|
3358 |
-
$(aoLocal[i][j].cell)
|
3359 |
-
.attr('rowspan', iRowspan)
|
3360 |
-
.attr('colspan', iColspan);
|
3361 |
-
}
|
3362 |
-
}
|
3363 |
-
}
|
3364 |
-
}
|
3365 |
-
|
3366 |
-
|
3367 |
-
/**
|
3368 |
-
* Insert the required TR nodes into the table for display
|
3369 |
-
* @param {object} oSettings dataTables settings object
|
3370 |
-
* @memberof WFDataTable#oApi
|
3371 |
-
*/
|
3372 |
-
function _fnDraw( oSettings )
|
3373 |
-
{
|
3374 |
-
/* Provide a pre-callback function which can be used to cancel the draw is false is returned */
|
3375 |
-
var aPreDraw = _fnCallbackFire( oSettings, 'aoPreDrawCallback', 'preDraw', [oSettings] );
|
3376 |
-
if ( $.inArray( false, aPreDraw ) !== -1 )
|
3377 |
-
{
|
3378 |
-
_fnProcessingDisplay( oSettings, false );
|
3379 |
-
return;
|
3380 |
-
}
|
3381 |
-
|
3382 |
-
var i, iLen, n;
|
3383 |
-
var anRows = [];
|
3384 |
-
var iRowCount = 0;
|
3385 |
-
var asStripeClasses = oSettings.asStripeClasses;
|
3386 |
-
var iStripes = asStripeClasses.length;
|
3387 |
-
var iOpenRows = oSettings.aoOpenRows.length;
|
3388 |
-
var oLang = oSettings.oLanguage;
|
3389 |
-
var iInitDisplayStart = oSettings.iInitDisplayStart;
|
3390 |
-
var bServerSide = _fnDataSource( oSettings ) == 'ssp';
|
3391 |
-
var aiDisplay = oSettings.aiDisplay;
|
3392 |
-
|
3393 |
-
oSettings.bDrawing = true;
|
3394 |
-
|
3395 |
-
/* Check and see if we have an initial draw position from state saving */
|
3396 |
-
if ( iInitDisplayStart !== undefined && iInitDisplayStart !== -1 )
|
3397 |
-
{
|
3398 |
-
oSettings._iDisplayStart = bServerSide ?
|
3399 |
-
iInitDisplayStart :
|
3400 |
-
iInitDisplayStart >= oSettings.fnRecordsDisplay() ?
|
3401 |
-
0 :
|
3402 |
-
iInitDisplayStart;
|
3403 |
-
|
3404 |
-
oSettings.iInitDisplayStart = -1;
|
3405 |
-
}
|
3406 |
-
|
3407 |
-
var iDisplayStart = oSettings._iDisplayStart;
|
3408 |
-
var iDisplayEnd = oSettings.fnDisplayEnd();
|
3409 |
-
|
3410 |
-
/* Server-side processing draw intercept */
|
3411 |
-
if ( oSettings.bDeferLoading )
|
3412 |
-
{
|
3413 |
-
oSettings.bDeferLoading = false;
|
3414 |
-
oSettings.iDraw++;
|
3415 |
-
_fnProcessingDisplay( oSettings, false );
|
3416 |
-
}
|
3417 |
-
else if ( !bServerSide )
|
3418 |
-
{
|
3419 |
-
oSettings.iDraw++;
|
3420 |
-
}
|
3421 |
-
else if ( !oSettings.bDestroying && !_fnAjaxUpdate( oSettings ) )
|
3422 |
-
{
|
3423 |
-
return;
|
3424 |
-
}
|
3425 |
-
|
3426 |
-
if ( aiDisplay.length !== 0 )
|
3427 |
-
{
|
3428 |
-
var iStart = bServerSide ? 0 : iDisplayStart;
|
3429 |
-
var iEnd = bServerSide ? oSettings.aoData.length : iDisplayEnd;
|
3430 |
-
|
3431 |
-
for ( var j=iStart ; j<iEnd ; j++ )
|
3432 |
-
{
|
3433 |
-
var iDataIndex = aiDisplay[j];
|
3434 |
-
var aoData = oSettings.aoData[ iDataIndex ];
|
3435 |
-
if ( aoData.nTr === null )
|
3436 |
-
{
|
3437 |
-
_fnCreateTr( oSettings, iDataIndex );
|
3438 |
-
}
|
3439 |
-
|
3440 |
-
var nRow = aoData.nTr;
|
3441 |
-
|
3442 |
-
/* Remove the old striping classes and then add the new one */
|
3443 |
-
if ( iStripes !== 0 )
|
3444 |
-
{
|
3445 |
-
var sStripe = asStripeClasses[ iRowCount % iStripes ];
|
3446 |
-
if ( aoData._sRowStripe != sStripe )
|
3447 |
-
{
|
3448 |
-
$(nRow).removeClass( aoData._sRowStripe ).addClass( sStripe );
|
3449 |
-
aoData._sRowStripe = sStripe;
|
3450 |
-
}
|
3451 |
-
}
|
3452 |
-
|
3453 |
-
// Row callback functions - might want to manipulate the row
|
3454 |
-
// iRowCount and j are not currently documented. Are they at all
|
3455 |
-
// useful?
|
3456 |
-
_fnCallbackFire( oSettings, 'aoRowCallback', null,
|
3457 |
-
[nRow, aoData._aData, iRowCount, j] );
|
3458 |
-
|
3459 |
-
anRows.push( nRow );
|
3460 |
-
iRowCount++;
|
3461 |
-
}
|
3462 |
-
}
|
3463 |
-
else
|
3464 |
-
{
|
3465 |
-
/* Table is empty - create a row with an empty message in it */
|
3466 |
-
var sZero = oLang.sZeroRecords;
|
3467 |
-
if ( oSettings.iDraw == 1 && _fnDataSource( oSettings ) == 'ajax' )
|
3468 |
-
{
|
3469 |
-
sZero = oLang.sLoadingRecords;
|
3470 |
-
}
|
3471 |
-
else if ( oLang.sEmptyTable && oSettings.fnRecordsTotal() === 0 )
|
3472 |
-
{
|
3473 |
-
sZero = oLang.sEmptyTable;
|
3474 |
-
}
|
3475 |
-
|
3476 |
-
anRows[ 0 ] = $( '<tr/>', { 'class': iStripes ? asStripeClasses[0] : '' } )
|
3477 |
-
.append( $('<td />', {
|
3478 |
-
'valign': 'top',
|
3479 |
-
'colSpan': _fnVisbleColumns( oSettings ),
|
3480 |
-
'class': oSettings.oClasses.sRowEmpty
|
3481 |
-
} ).html( sZero ) )[0];
|
3482 |
-
}
|
3483 |
-
|
3484 |
-
/* Header and footer callbacks */
|
3485 |
-
_fnCallbackFire( oSettings, 'aoHeaderCallback', 'header', [ $(oSettings.nTHead).children('tr')[0],
|
3486 |
-
_fnGetDataMaster( oSettings ), iDisplayStart, iDisplayEnd, aiDisplay ] );
|
3487 |
-
|
3488 |
-
_fnCallbackFire( oSettings, 'aoFooterCallback', 'footer', [ $(oSettings.nTFoot).children('tr')[0],
|
3489 |
-
_fnGetDataMaster( oSettings ), iDisplayStart, iDisplayEnd, aiDisplay ] );
|
3490 |
-
|
3491 |
-
var body = $(oSettings.nTBody);
|
3492 |
-
|
3493 |
-
body.children().detach();
|
3494 |
-
body.append( $(anRows) );
|
3495 |
-
|
3496 |
-
/* Call all required callback functions for the end of a draw */
|
3497 |
-
_fnCallbackFire( oSettings, 'aoDrawCallback', 'draw', [oSettings] );
|
3498 |
-
|
3499 |
-
/* Draw is complete, sorting and filtering must be as well */
|
3500 |
-
oSettings.bSorted = false;
|
3501 |
-
oSettings.bFiltered = false;
|
3502 |
-
oSettings.bDrawing = false;
|
3503 |
-
}
|
3504 |
-
|
3505 |
-
|
3506 |
-
/**
|
3507 |
-
* Redraw the table - taking account of the various features which are enabled
|
3508 |
-
* @param {object} oSettings dataTables settings object
|
3509 |
-
* @param {boolean} [holdPosition] Keep the current paging position. By default
|
3510 |
-
* the paging is reset to the first page
|
3511 |
-
* @memberof WFDataTable#oApi
|
3512 |
-
*/
|
3513 |
-
function _fnReDraw( settings, holdPosition )
|
3514 |
-
{
|
3515 |
-
var
|
3516 |
-
features = settings.oFeatures,
|
3517 |
-
sort = features.bSort,
|
3518 |
-
filter = features.bFilter;
|
3519 |
-
|
3520 |
-
if ( sort ) {
|
3521 |
-
_fnSort( settings );
|
3522 |
-
}
|
3523 |
-
|
3524 |
-
if ( filter ) {
|
3525 |
-
_fnFilterComplete( settings, settings.oPreviousSearch );
|
3526 |
-
}
|
3527 |
-
else {
|
3528 |
-
// No filtering, so we want to just use the display master
|
3529 |
-
settings.aiDisplay = settings.aiDisplayMaster.slice();
|
3530 |
-
}
|
3531 |
-
|
3532 |
-
if ( holdPosition !== true ) {
|
3533 |
-
settings._iDisplayStart = 0;
|
3534 |
-
}
|
3535 |
-
|
3536 |
-
// Let any modules know about the draw hold position state (used by
|
3537 |
-
// scrolling internally)
|
3538 |
-
settings._drawHold = holdPosition;
|
3539 |
-
|
3540 |
-
_fnDraw( settings );
|
3541 |
-
|
3542 |
-
settings._drawHold = false;
|
3543 |
-
}
|
3544 |
-
|
3545 |
-
|
3546 |
-
/**
|
3547 |
-
* Add the options to the page HTML for the table
|
3548 |
-
* @param {object} oSettings dataTables settings object
|
3549 |
-
* @memberof WFDataTable#oApi
|
3550 |
-
*/
|
3551 |
-
function _fnAddOptionsHtml ( oSettings )
|
3552 |
-
{
|
3553 |
-
var classes = oSettings.oClasses;
|
3554 |
-
var table = $(oSettings.nTable);
|
3555 |
-
var holding = $('<div/>').insertBefore( table ); // Holding element for speed
|
3556 |
-
var features = oSettings.oFeatures;
|
3557 |
-
|
3558 |
-
// All WFDataTables are wrapped in a div
|
3559 |
-
var insert = $('<div/>', {
|
3560 |
-
id: oSettings.sTableId+'_wrapper',
|
3561 |
-
'class': classes.sWrapper + (oSettings.nTFoot ? '' : ' '+classes.sNoFooter)
|
3562 |
-
} );
|
3563 |
-
|
3564 |
-
oSettings.nHolding = holding[0];
|
3565 |
-
oSettings.nTableWrapper = insert[0];
|
3566 |
-
oSettings.nTableReinsertBefore = oSettings.nTable.nextSibling;
|
3567 |
-
|
3568 |
-
/* Loop over the user set positioning and place the elements as needed */
|
3569 |
-
var aDom = oSettings.sDom.split('');
|
3570 |
-
var featureNode, cOption, nNewNode, cNext, sAttr, j;
|
3571 |
-
for ( var i=0 ; i<aDom.length ; i++ )
|
3572 |
-
{
|
3573 |
-
featureNode = null;
|
3574 |
-
cOption = aDom[i];
|
3575 |
-
|
3576 |
-
if ( cOption == '<' )
|
3577 |
-
{
|
3578 |
-
/* New container div */
|
3579 |
-
nNewNode = $('<div/>')[0];
|
3580 |
-
|
3581 |
-
/* Check to see if we should append an id and/or a class name to the container */
|
3582 |
-
cNext = aDom[i+1];
|
3583 |
-
if ( cNext == "'" || cNext == '"' )
|
3584 |
-
{
|
3585 |
-
sAttr = "";
|
3586 |
-
j = 2;
|
3587 |
-
while ( aDom[i+j] != cNext )
|
3588 |
-
{
|
3589 |
-
sAttr += aDom[i+j];
|
3590 |
-
j++;
|
3591 |
-
}
|
3592 |
-
|
3593 |
-
/* Replace jQuery UI constants @todo depreciated */
|
3594 |
-
if ( sAttr == "H" )
|
3595 |
-
{
|
3596 |
-
sAttr = classes.sJUIHeader;
|
3597 |
-
}
|
3598 |
-
else if ( sAttr == "F" )
|
3599 |
-
{
|
3600 |
-
sAttr = classes.sJUIFooter;
|
3601 |
-
}
|
3602 |
-
|
3603 |
-
/* The attribute can be in the format of "#id.class", "#id" or "class" This logic
|
3604 |
-
* breaks the string into parts and applies them as needed
|
3605 |
-
*/
|
3606 |
-
if ( sAttr.indexOf('.') != -1 )
|
3607 |
-
{
|
3608 |
-
var aSplit = sAttr.split('.');
|
3609 |
-
nNewNode.id = aSplit[0].substr(1, aSplit[0].length-1);
|
3610 |
-
nNewNode.className = aSplit[1];
|
3611 |
-
}
|
3612 |
-
else if ( sAttr.charAt(0) == "#" )
|
3613 |
-
{
|
3614 |
-
nNewNode.id = sAttr.substr(1, sAttr.length-1);
|
3615 |
-
}
|
3616 |
-
else
|
3617 |
-
{
|
3618 |
-
nNewNode.className = sAttr;
|
3619 |
-
}
|
3620 |
-
|
3621 |
-
i += j; /* Move along the position array */
|
3622 |
-
}
|
3623 |
-
|
3624 |
-
insert.append( nNewNode );
|
3625 |
-
insert = $(nNewNode);
|
3626 |
-
}
|
3627 |
-
else if ( cOption == '>' )
|
3628 |
-
{
|
3629 |
-
/* End container div */
|
3630 |
-
insert = insert.parent();
|
3631 |
-
}
|
3632 |
-
// @todo Move options into their own plugins?
|
3633 |
-
else if ( cOption == 'l' && features.bPaginate && features.bLengthChange )
|
3634 |
-
{
|
3635 |
-
/* Length */
|
3636 |
-
featureNode = _fnFeatureHtmlLength( oSettings );
|
3637 |
-
}
|
3638 |
-
else if ( cOption == 'f' && features.bFilter )
|
3639 |
-
{
|
3640 |
-
/* Filter */
|
3641 |
-
featureNode = _fnFeatureHtmlFilter( oSettings );
|
3642 |
-
}
|
3643 |
-
else if ( cOption == 'r' && features.bProcessing )
|
3644 |
-
{
|
3645 |
-
/* pRocessing */
|
3646 |
-
featureNode = _fnFeatureHtmlProcessing( oSettings );
|
3647 |
-
}
|
3648 |
-
else if ( cOption == 't' )
|
3649 |
-
{
|
3650 |
-
/* Table */
|
3651 |
-
featureNode = _fnFeatureHtmlTable( oSettings );
|
3652 |
-
}
|
3653 |
-
else if ( cOption == 'i' && features.bInfo )
|
3654 |
-
{
|
3655 |
-
/* Info */
|
3656 |
-
featureNode = _fnFeatureHtmlInfo( oSettings );
|
3657 |
-
}
|
3658 |
-
else if ( cOption == 'p' && features.bPaginate )
|
3659 |
-
{
|
3660 |
-
/* Pagination */
|
3661 |
-
featureNode = _fnFeatureHtmlPaginate( oSettings );
|
3662 |
-
}
|
3663 |
-
else if ( WFDataTable.ext.feature.length !== 0 )
|
3664 |
-
{
|
3665 |
-
/* Plug-in features */
|
3666 |
-
var aoFeatures = WFDataTable.ext.feature;
|
3667 |
-
for ( var k=0, kLen=aoFeatures.length ; k<kLen ; k++ )
|
3668 |
-
{
|
3669 |
-
if ( cOption == aoFeatures[k].cFeature )
|
3670 |
-
{
|
3671 |
-
featureNode = aoFeatures[k].fnInit( oSettings );
|
3672 |
-
break;
|
3673 |
-
}
|
3674 |
-
}
|
3675 |
-
}
|
3676 |
-
|
3677 |
-
/* Add to the 2D features array */
|
3678 |
-
if ( featureNode )
|
3679 |
-
{
|
3680 |
-
var aanFeatures = oSettings.aanFeatures;
|
3681 |
-
|
3682 |
-
if ( ! aanFeatures[cOption] )
|
3683 |
-
{
|
3684 |
-
aanFeatures[cOption] = [];
|
3685 |
-
}
|
3686 |
-
|
3687 |
-
aanFeatures[cOption].push( featureNode );
|
3688 |
-
insert.append( featureNode );
|
3689 |
-
}
|
3690 |
-
}
|
3691 |
-
|
3692 |
-
/* Built our DOM structure - replace the holding div with what we want */
|
3693 |
-
holding.replaceWith( insert );
|
3694 |
-
oSettings.nHolding = null;
|
3695 |
-
}
|
3696 |
-
|
3697 |
-
|
3698 |
-
/**
|
3699 |
-
* Use the DOM source to create up an array of header cells. The idea here is to
|
3700 |
-
* create a layout grid (array) of rows x columns, which contains a reference
|
3701 |
-
* to the cell that that point in the grid (regardless of col/rowspan), such that
|
3702 |
-
* any column / row could be removed and the new grid constructed
|
3703 |
-
* @param array {object} aLayout Array to store the calculated layout in
|
3704 |
-
* @param {node} nThead The header/footer element for the table
|
3705 |
-
* @memberof WFDataTable#oApi
|
3706 |
-
*/
|
3707 |
-
function _fnDetectHeader ( aLayout, nThead )
|
3708 |
-
{
|
3709 |
-
var nTrs = $(nThead).children('tr');
|
3710 |
-
var nTr, nCell;
|
3711 |
-
var i, k, l, iLen, jLen, iColShifted, iColumn, iColspan, iRowspan;
|
3712 |
-
var bUnique;
|
3713 |
-
var fnShiftCol = function ( a, i, j ) {
|
3714 |
-
var k = a[i];
|
3715 |
-
while ( k[j] ) {
|
3716 |
-
j++;
|
3717 |
-
}
|
3718 |
-
return j;
|
3719 |
-
};
|
3720 |
-
|
3721 |
-
aLayout.splice( 0, aLayout.length );
|
3722 |
-
|
3723 |
-
/* We know how many rows there are in the layout - so prep it */
|
3724 |
-
for ( i=0, iLen=nTrs.length ; i<iLen ; i++ )
|
3725 |
-
{
|
3726 |
-
aLayout.push( [] );
|
3727 |
-
}
|
3728 |
-
|
3729 |
-
/* Calculate a layout array */
|
3730 |
-
for ( i=0, iLen=nTrs.length ; i<iLen ; i++ )
|
3731 |
-
{
|
3732 |
-
nTr = nTrs[i];
|
3733 |
-
iColumn = 0;
|
3734 |
-
|
3735 |
-
/* For every cell in the row... */
|
3736 |
-
nCell = nTr.firstChild;
|
3737 |
-
while ( nCell ) {
|
3738 |
-
if ( nCell.nodeName.toUpperCase() == "TD" ||
|
3739 |
-
nCell.nodeName.toUpperCase() == "TH" )
|
3740 |
-
{
|
3741 |
-
/* Get the col and rowspan attributes from the DOM and sanitise them */
|
3742 |
-
iColspan = nCell.getAttribute('colspan') * 1;
|
3743 |
-
iRowspan = nCell.getAttribute('rowspan') * 1;
|
3744 |
-
iColspan = (!iColspan || iColspan===0 || iColspan===1) ? 1 : iColspan;
|
3745 |
-
iRowspan = (!iRowspan || iRowspan===0 || iRowspan===1) ? 1 : iRowspan;
|
3746 |
-
|
3747 |
-
/* There might be colspan cells already in this row, so shift our target
|
3748 |
-
* accordingly
|
3749 |
-
*/
|
3750 |
-
iColShifted = fnShiftCol( aLayout, i, iColumn );
|
3751 |
-
|
3752 |
-
/* Cache calculation for unique columns */
|
3753 |
-
bUnique = iColspan === 1 ? true : false;
|
3754 |
-
|
3755 |
-
/* If there is col / rowspan, copy the information into the layout grid */
|
3756 |
-
for ( l=0 ; l<iColspan ; l++ )
|
3757 |
-
{
|
3758 |
-
for ( k=0 ; k<iRowspan ; k++ )
|
3759 |
-
{
|
3760 |
-
aLayout[i+k][iColShifted+l] = {
|
3761 |
-
"cell": nCell,
|
3762 |
-
"unique": bUnique
|
3763 |
-
};
|
3764 |
-
aLayout[i+k].nTr = nTr;
|
3765 |
-
}
|
3766 |
-
}
|
3767 |
-
}
|
3768 |
-
nCell = nCell.nextSibling;
|
3769 |
-
}
|
3770 |
-
}
|
3771 |
-
}
|
3772 |
-
|
3773 |
-
|
3774 |
-
/**
|
3775 |
-
* Get an array of unique th elements, one for each column
|
3776 |
-
* @param {object} oSettings dataTables settings object
|
3777 |
-
* @param {node} nHeader automatically detect the layout from this node - optional
|
3778 |
-
* @param {array} aLayout thead/tfoot layout from _fnDetectHeader - optional
|
3779 |
-
* @returns array {node} aReturn list of unique th's
|
3780 |
-
* @memberof WFDataTable#oApi
|
3781 |
-
*/
|
3782 |
-
function _fnGetUniqueThs ( oSettings, nHeader, aLayout )
|
3783 |
-
{
|
3784 |
-
var aReturn = [];
|
3785 |
-
if ( !aLayout )
|
3786 |
-
{
|
3787 |
-
aLayout = oSettings.aoHeader;
|
3788 |
-
if ( nHeader )
|
3789 |
-
{
|
3790 |
-
aLayout = [];
|
3791 |
-
_fnDetectHeader( aLayout, nHeader );
|
3792 |
-
}
|
3793 |
-
}
|
3794 |
-
|
3795 |
-
for ( var i=0, iLen=aLayout.length ; i<iLen ; i++ )
|
3796 |
-
{
|
3797 |
-
for ( var j=0, jLen=aLayout[i].length ; j<jLen ; j++ )
|
3798 |
-
{
|
3799 |
-
if ( aLayout[i][j].unique &&
|
3800 |
-
(!aReturn[j] || !oSettings.bSortCellsTop) )
|
3801 |
-
{
|
3802 |
-
aReturn[j] = aLayout[i][j].cell;
|
3803 |
-
}
|
3804 |
-
}
|
3805 |
-
}
|
3806 |
-
|
3807 |
-
return aReturn;
|
3808 |
-
}
|
3809 |
-
|
3810 |
-
/**
|
3811 |
-
* Create an Ajax call based on the table's settings, taking into account that
|
3812 |
-
* parameters can have multiple forms, and backwards compatibility.
|
3813 |
-
*
|
3814 |
-
* @param {object} oSettings dataTables settings object
|
3815 |
-
* @param {array} data Data to send to the server, required by
|
3816 |
-
* WFDataTables - may be augmented by developer callbacks
|
3817 |
-
* @param {function} fn Callback function to run when data is obtained
|
3818 |
-
*/
|
3819 |
-
function _fnBuildAjax( oSettings, data, fn )
|
3820 |
-
{
|
3821 |
-
// Compatibility with 1.9-, allow fnServerData and event to manipulate
|
3822 |
-
_fnCallbackFire( oSettings, 'aoServerParams', 'serverParams', [data] );
|
3823 |
-
|
3824 |
-
// Convert to object based for 1.10+ if using the old array scheme which can
|
3825 |
-
// come from server-side processing or serverParams
|
3826 |
-
if ( data && $.isArray(data) ) {
|
3827 |
-
var tmp = {};
|
3828 |
-
var rbracket = /(.*?)\[\]$/;
|
3829 |
-
|
3830 |
-
$.each( data, function (key, val) {
|
3831 |
-
var match = val.name.match(rbracket);
|
3832 |
-
|
3833 |
-
if ( match ) {
|
3834 |
-
// Support for arrays
|
3835 |
-
var name = match[0];
|
3836 |
-
|
3837 |
-
if ( ! tmp[ name ] ) {
|
3838 |
-
tmp[ name ] = [];
|
3839 |
-
}
|
3840 |
-
tmp[ name ].push( val.value );
|
3841 |
-
}
|
3842 |
-
else {
|
3843 |
-
tmp[val.name] = val.value;
|
3844 |
-
}
|
3845 |
-
} );
|
3846 |
-
data = tmp;
|
3847 |
-
}
|
3848 |
-
|
3849 |
-
var ajaxData;
|
3850 |
-
var ajax = oSettings.ajax;
|
3851 |
-
var instance = oSettings.oInstance;
|
3852 |
-
var callback = function ( json ) {
|
3853 |
-
_fnCallbackFire( oSettings, null, 'xhr', [oSettings, json, oSettings.jqXHR] );
|
3854 |
-
fn( json );
|
3855 |
-
};
|
3856 |
-
|
3857 |
-
if ( $.isPlainObject( ajax ) && ajax.data )
|
3858 |
-
{
|
3859 |
-
ajaxData = ajax.data;
|
3860 |
-
|
3861 |
-
var newData = $.isFunction( ajaxData ) ?
|
3862 |
-
ajaxData( data, oSettings ) : // fn can manipulate data or return
|
3863 |
-
ajaxData; // an object object or array to merge
|
3864 |
-
|
3865 |
-
// If the function returned something, use that alone
|
3866 |
-
data = $.isFunction( ajaxData ) && newData ?
|
3867 |
-
newData :
|
3868 |
-
$.extend( true, data, newData );
|
3869 |
-
|
3870 |
-
// Remove the data property as we've resolved it already and don't want
|
3871 |
-
// jQuery to do it again (it is restored at the end of the function)
|
3872 |
-
delete ajax.data;
|
3873 |
-
}
|
3874 |
-
|
3875 |
-
var baseAjax = {
|
3876 |
-
"data": data,
|
3877 |
-
"success": function (json) {
|
3878 |
-
var error = json.error || json.sError;
|
3879 |
-
if ( error ) {
|
3880 |
-
_fnLog( oSettings, 0, error );
|
3881 |
-
}
|
3882 |
-
|
3883 |
-
oSettings.json = json;
|
3884 |
-
callback( json );
|
3885 |
-
},
|
3886 |
-
"dataType": "json",
|
3887 |
-
"cache": false,
|
3888 |
-
"type": oSettings.sServerMethod,
|
3889 |
-
"error": function (xhr, error, thrown) {
|
3890 |
-
var ret = _fnCallbackFire( oSettings, null, 'xhr', [oSettings, null, oSettings.jqXHR] );
|
3891 |
-
|
3892 |
-
if ( $.inArray( true, ret ) === -1 ) {
|
3893 |
-
if ( error == "parsererror" ) {
|
3894 |
-
_fnLog( oSettings, 0, 'Invalid JSON response', 1 );
|
3895 |
-
}
|
3896 |
-
else if ( xhr.readyState === 4 ) {
|
3897 |
-
_fnLog( oSettings, 0, 'Ajax error', 7 );
|
3898 |
-
}
|
3899 |
-
}
|
3900 |
-
|
3901 |
-
_fnProcessingDisplay( oSettings, false );
|
3902 |
-
}
|
3903 |
-
};
|
3904 |
-
|
3905 |
-
// Store the data submitted for the API
|
3906 |
-
oSettings.oAjaxData = data;
|
3907 |
-
|
3908 |
-
// Allow plug-ins and external processes to modify the data
|
3909 |
-
_fnCallbackFire( oSettings, null, 'preXhr', [oSettings, data] );
|
3910 |
-
|
3911 |
-
if ( oSettings.fnServerData )
|
3912 |
-
{
|
3913 |
-
// WFDataTables 1.9- compatibility
|
3914 |
-
oSettings.fnServerData.call( instance,
|
3915 |
-
oSettings.sAjaxSource,
|
3916 |
-
$.map( data, function (val, key) { // Need to convert back to 1.9 trad format
|
3917 |
-
return { name: key, value: val };
|
3918 |
-
} ),
|
3919 |
-
callback,
|
3920 |
-
oSettings
|
3921 |
-
);
|
3922 |
-
}
|
3923 |
-
else if ( oSettings.sAjaxSource || typeof ajax === 'string' )
|
3924 |
-
{
|
3925 |
-
// WFDataTables 1.9- compatibility
|
3926 |
-
oSettings.jqXHR = $.ajax( $.extend( baseAjax, {
|
3927 |
-
url: ajax || oSettings.sAjaxSource
|
3928 |
-
} ) );
|
3929 |
-
}
|
3930 |
-
else if ( $.isFunction( ajax ) )
|
3931 |
-
{
|
3932 |
-
// Is a function - let the caller define what needs to be done
|
3933 |
-
oSettings.jqXHR = ajax.call( instance, data, callback, oSettings );
|
3934 |
-
}
|
3935 |
-
else
|
3936 |
-
{
|
3937 |
-
// Object to extend the base settings
|
3938 |
-
oSettings.jqXHR = $.ajax( $.extend( baseAjax, ajax ) );
|
3939 |
-
|
3940 |
-
// Restore for next time around
|
3941 |
-
ajax.data = ajaxData;
|
3942 |
-
}
|
3943 |
-
}
|
3944 |
-
|
3945 |
-
|
3946 |
-
/**
|
3947 |
-
* Update the table using an Ajax call
|
3948 |
-
* @param {object} settings dataTables settings object
|
3949 |
-
* @returns {boolean} Block the table drawing or not
|
3950 |
-
* @memberof WFDataTable#oApi
|
3951 |
-
*/
|
3952 |
-
function _fnAjaxUpdate( settings )
|
3953 |
-
{
|
3954 |
-
if ( settings.bAjaxDataGet ) {
|
3955 |
-
settings.iDraw++;
|
3956 |
-
_fnProcessingDisplay( settings, true );
|
3957 |
-
|
3958 |
-
_fnBuildAjax(
|
3959 |
-
settings,
|
3960 |
-
_fnAjaxParameters( settings ),
|
3961 |
-
function(json) {
|
3962 |
-
_fnAjaxUpdateDraw( settings, json );
|
3963 |
-
}
|
3964 |
-
);
|
3965 |
-
|
3966 |
-
return false;
|
3967 |
-
}
|
3968 |
-
return true;
|
3969 |
-
}
|
3970 |
-
|
3971 |
-
|
3972 |
-
/**
|
3973 |
-
* Build up the parameters in an object needed for a server-side processing
|
3974 |
-
* request. Note that this is basically done twice, is different ways - a modern
|
3975 |
-
* method which is used by default in WFDataTables 1.10 which uses objects and
|
3976 |
-
* arrays, or the 1.9- method with is name / value pairs. 1.9 method is used if
|
3977 |
-
* the sAjaxSource option is used in the initialisation, or the legacyAjax
|
3978 |
-
* option is set.
|
3979 |
-
* @param {object} oSettings dataTables settings object
|
3980 |
-
* @returns {bool} block the table drawing or not
|
3981 |
-
* @memberof WFDataTable#oApi
|
3982 |
-
*/
|
3983 |
-
function _fnAjaxParameters( settings )
|
3984 |
-
{
|
3985 |
-
var
|
3986 |
-
columns = settings.aoColumns,
|
3987 |
-
columnCount = columns.length,
|
3988 |
-
features = settings.oFeatures,
|
3989 |
-
preSearch = settings.oPreviousSearch,
|
3990 |
-
preColSearch = settings.aoPreSearchCols,
|
3991 |
-
i, data = [], dataProp, column, columnSearch,
|
3992 |
-
sort = _fnSortFlatten( settings ),
|
3993 |
-
displayStart = settings._iDisplayStart,
|
3994 |
-
displayLength = features.bPaginate !== false ?
|
3995 |
-
settings._iDisplayLength :
|
3996 |
-
-1;
|
3997 |
-
|
3998 |
-
var param = function ( name, value ) {
|
3999 |
-
data.push( { 'name': name, 'value': value } );
|
4000 |
-
};
|
4001 |
-
|
4002 |
-
// WFDataTables 1.9- compatible method
|
4003 |
-
param( 'sEcho', settings.iDraw );
|
4004 |
-
param( 'iColumns', columnCount );
|
4005 |
-
param( 'sColumns', _pluck( columns, 'sName' ).join(',') );
|
4006 |
-
param( 'iDisplayStart', displayStart );
|
4007 |
-
param( 'iDisplayLength', displayLength );
|
4008 |
-
|
4009 |
-
// WFDataTables 1.10+ method
|
4010 |
-
var d = {
|
4011 |
-
draw: settings.iDraw,
|
4012 |
-
columns: [],
|
4013 |
-
order: [],
|
4014 |
-
start: displayStart,
|
4015 |
-
length: displayLength,
|
4016 |
-
search: {
|
4017 |
-
value: preSearch.sSearch,
|
4018 |
-
regex: preSearch.bRegex
|
4019 |
-
}
|
4020 |
-
};
|
4021 |
-
|
4022 |
-
for ( i=0 ; i<columnCount ; i++ ) {
|
4023 |
-
column = columns[i];
|
4024 |
-
columnSearch = preColSearch[i];
|
4025 |
-
dataProp = typeof column.mData=="function" ? 'function' : column.mData ;
|
4026 |
-
|
4027 |
-
d.columns.push( {
|
4028 |
-
data: dataProp,
|
4029 |
-
name: column.sName,
|
4030 |
-
searchable: column.bSearchable,
|
4031 |
-
orderable: column.bSortable,
|
4032 |
-
search: {
|
4033 |
-
value: columnSearch.sSearch,
|
4034 |
-
regex: columnSearch.bRegex
|
4035 |
-
}
|
4036 |
-
} );
|
4037 |
-
|
4038 |
-
param( "mDataProp_"+i, dataProp );
|
4039 |
-
|
4040 |
-
if ( features.bFilter ) {
|
4041 |
-
param( 'sSearch_'+i, columnSearch.sSearch );
|
4042 |
-
param( 'bRegex_'+i, columnSearch.bRegex );
|
4043 |
-
param( 'bSearchable_'+i, column.bSearchable );
|
4044 |
-
}
|
4045 |
-
|
4046 |
-
if ( features.bSort ) {
|
4047 |
-
param( 'bSortable_'+i, column.bSortable );
|
4048 |
-
}
|
4049 |
-
}
|
4050 |
-
|
4051 |
-
if ( features.bFilter ) {
|
4052 |
-
param( 'sSearch', preSearch.sSearch );
|
4053 |
-
param( 'bRegex', preSearch.bRegex );
|
4054 |
-
}
|
4055 |
-
|
4056 |
-
if ( features.bSort ) {
|
4057 |
-
$.each( sort, function ( i, val ) {
|
4058 |
-
d.order.push( { column: val.col, dir: val.dir } );
|
4059 |
-
|
4060 |
-
param( 'iSortCol_'+i, val.col );
|
4061 |
-
param( 'sSortDir_'+i, val.dir );
|
4062 |
-
} );
|
4063 |
-
|
4064 |
-
param( 'iSortingCols', sort.length );
|
4065 |
-
}
|
4066 |
-
|
4067 |
-
// If the legacy.ajax parameter is null, then we automatically decide which
|
4068 |
-
// form to use, based on sAjaxSource
|
4069 |
-
var legacy = WFDataTable.ext.legacy.ajax;
|
4070 |
-
if ( legacy === null ) {
|
4071 |
-
return settings.sAjaxSource ? data : d;
|
4072 |
-
}
|
4073 |
-
|
4074 |
-
// Otherwise, if legacy has been specified then we use that to decide on the
|
4075 |
-
// form
|
4076 |
-
return legacy ? data : d;
|
4077 |
-
}
|
4078 |
-
|
4079 |
-
|
4080 |
-
/**
|
4081 |
-
* Data the data from the server (nuking the old) and redraw the table
|
4082 |
-
* @param {object} oSettings dataTables settings object
|
4083 |
-
* @param {object} json json data return from the server.
|
4084 |
-
* @param {string} json.sEcho Tracking flag for WFDataTables to match requests
|
4085 |
-
* @param {int} json.iTotalRecords Number of records in the data set, not accounting for filtering
|
4086 |
-
* @param {int} json.iTotalDisplayRecords Number of records in the data set, accounting for filtering
|
4087 |
-
* @param {array} json.aaData The data to display on this page
|
4088 |
-
* @param {string} [json.sColumns] Column ordering (sName, comma separated)
|
4089 |
-
* @memberof WFDataTable#oApi
|
4090 |
-
*/
|
4091 |
-
function _fnAjaxUpdateDraw ( settings, json )
|
4092 |
-
{
|
4093 |
-
// v1.10 uses camelCase variables, while 1.9 uses Hungarian notation.
|
4094 |
-
// Support both
|
4095 |
-
var compat = function ( old, modern ) {
|
4096 |
-
return json[old] !== undefined ? json[old] : json[modern];
|
4097 |
-
};
|
4098 |
-
|
4099 |
-
var data = _fnAjaxDataSrc( settings, json );
|
4100 |
-
var draw = compat( 'sEcho', 'draw' );
|
4101 |
-
var recordsTotal = compat( 'iTotalRecords', 'recordsTotal' );
|
4102 |
-
var recordsFiltered = compat( 'iTotalDisplayRecords', 'recordsFiltered' );
|
4103 |
-
|
4104 |
-
if ( draw ) {
|
4105 |
-
// Protect against out of sequence returns
|
4106 |
-
if ( draw*1 < settings.iDraw ) {
|
4107 |
-
return;
|
4108 |
-
}
|
4109 |
-
settings.iDraw = draw * 1;
|
4110 |
-
}
|
4111 |
-
|
4112 |
-
_fnClearTable( settings );
|
4113 |
-
settings._iRecordsTotal = parseInt(recordsTotal, 10);
|
4114 |
-
settings._iRecordsDisplay = parseInt(recordsFiltered, 10);
|
4115 |
-
|
4116 |
-
for ( var i=0, ien=data.length ; i<ien ; i++ ) {
|
4117 |
-
_fnAddData( settings, data[i] );
|
4118 |
-
}
|
4119 |
-
settings.aiDisplay = settings.aiDisplayMaster.slice();
|
4120 |
-
|
4121 |
-
settings.bAjaxDataGet = false;
|
4122 |
-
_fnDraw( settings );
|
4123 |
-
|
4124 |
-
if ( ! settings._bInitComplete ) {
|
4125 |
-
_fnInitComplete( settings, json );
|
4126 |
-
}
|
4127 |
-
|
4128 |
-
settings.bAjaxDataGet = true;
|
4129 |
-
_fnProcessingDisplay( settings, false );
|
4130 |
-
}
|
4131 |
-
|
4132 |
-
|
4133 |
-
/**
|
4134 |
-
* Get the data from the JSON data source to use for drawing a table. Using
|
4135 |
-
* `_fnGetObjectDataFn` allows the data to be sourced from a property of the
|
4136 |
-
* source object, or from a processing function.
|
4137 |
-
* @param {object} oSettings dataTables settings object
|
4138 |
-
* @param {object} json Data source object / array from the server
|
4139 |
-
* @return {array} Array of data to use
|
4140 |
-
*/
|
4141 |
-
function _fnAjaxDataSrc ( oSettings, json )
|
4142 |
-
{
|
4143 |
-
var dataSrc = $.isPlainObject( oSettings.ajax ) && oSettings.ajax.dataSrc !== undefined ?
|
4144 |
-
oSettings.ajax.dataSrc :
|
4145 |
-
oSettings.sAjaxDataProp; // Compatibility with 1.9-.
|
4146 |
-
|
4147 |
-
// Compatibility with 1.9-. In order to read from aaData, check if the
|
4148 |
-
// default has been changed, if not, check for aaData
|
4149 |
-
if ( dataSrc === 'data' ) {
|
4150 |
-
return json.aaData || json[dataSrc];
|
4151 |
-
}
|
4152 |
-
|
4153 |
-
return dataSrc !== "" ?
|
4154 |
-
_fnGetObjectDataFn( dataSrc )( json ) :
|
4155 |
-
json;
|
4156 |
-
}
|
4157 |
-
|
4158 |
-
/**
|
4159 |
-
* Generate the node required for filtering text
|
4160 |
-
* @returns {node} Filter control element
|
4161 |
-
* @param {object} oSettings dataTables settings object
|
4162 |
-
* @memberof WFDataTable#oApi
|
4163 |
-
*/
|
4164 |
-
function _fnFeatureHtmlFilter ( settings )
|
4165 |
-
{
|
4166 |
-
var classes = settings.oClasses;
|
4167 |
-
var tableId = settings.sTableId;
|
4168 |
-
var language = settings.oLanguage;
|
4169 |
-
var previousSearch = settings.oPreviousSearch;
|
4170 |
-
var features = settings.aanFeatures;
|
4171 |
-
var input = '<input type="search" class="'+classes.sFilterInput+'"/>';
|
4172 |
-
|
4173 |
-
var str = language.sSearch;
|
4174 |
-
str = str.match(/_INPUT_/) ?
|
4175 |
-
str.replace('_INPUT_', input) :
|
4176 |
-
str+input;
|
4177 |
-
|
4178 |
-
var filter = $('<div/>', {
|
4179 |
-
'id': ! features.f ? tableId+'_filter' : null,
|
4180 |
-
'class': classes.sFilter
|
4181 |
-
} )
|
4182 |
-
.append( $('<label/>' ).append( str ) );
|
4183 |
-
|
4184 |
-
var searchFn = function() {
|
4185 |
-
/* Update all other filter input elements for the new display */
|
4186 |
-
var n = features.f;
|
4187 |
-
var val = !this.value ? "" : this.value; // mental IE8 fix :-(
|
4188 |
-
|
4189 |
-
/* Now do the filter */
|
4190 |
-
if ( val != previousSearch.sSearch ) {
|
4191 |
-
_fnFilterComplete( settings, {
|
4192 |
-
"sSearch": val,
|
4193 |
-
"bRegex": previousSearch.bRegex,
|
4194 |
-
"bSmart": previousSearch.bSmart ,
|
4195 |
-
"bCaseInsensitive": previousSearch.bCaseInsensitive
|
4196 |
-
} );
|
4197 |
-
|
4198 |
-
// Need to redraw, without resorting
|
4199 |
-
settings._iDisplayStart = 0;
|
4200 |
-
_fnDraw( settings );
|
4201 |
-
}
|
4202 |
-
};
|
4203 |
-
|
4204 |
-
var searchDelay = settings.searchDelay !== null ?
|
4205 |
-
settings.searchDelay :
|
4206 |
-
_fnDataSource( settings ) === 'ssp' ?
|
4207 |
-
400 :
|
4208 |
-
0;
|
4209 |
-
|
4210 |
-
var jqFilter = $('input', filter)
|
4211 |
-
.val( previousSearch.sSearch )
|
4212 |
-
.attr( 'placeholder', language.sSearchPlaceholder )
|
4213 |
-
.on(
|
4214 |
-
'keyup.DT search.DT input.DT paste.DT cut.DT',
|
4215 |
-
searchDelay ?
|
4216 |
-
_fnThrottle( searchFn, searchDelay ) :
|
4217 |
-
searchFn
|
4218 |
-
)
|
4219 |
-
.on( 'keypress.DT', function(e) {
|
4220 |
-
/* Prevent form submission */
|
4221 |
-
if ( e.keyCode == 13 ) {
|
4222 |
-
return false;
|
4223 |
-
}
|
4224 |
-
} )
|
4225 |
-
.attr('aria-controls', tableId);
|
4226 |
-
|
4227 |
-
// Update the input elements whenever the table is filtered
|
4228 |
-
$(settings.nTable).on( 'search.dt.DT', function ( ev, s ) {
|
4229 |
-
if ( settings === s ) {
|
4230 |
-
// IE9 throws an 'unknown error' if document.activeElement is used
|
4231 |
-
// inside an iframe or frame...
|
4232 |
-
try {
|
4233 |
-
if ( jqFilter[0] !== document.activeElement ) {
|
4234 |
-
jqFilter.val( previousSearch.sSearch );
|
4235 |
-
}
|
4236 |
-
}
|
4237 |
-
catch ( e ) {}
|
4238 |
-
}
|
4239 |
-
} );
|
4240 |
-
|
4241 |
-
return filter[0];
|
4242 |
-
}
|
4243 |
-
|
4244 |
-
|
4245 |
-
/**
|
4246 |
-
* Filter the table using both the global filter and column based filtering
|
4247 |
-
* @param {object} oSettings dataTables settings object
|
4248 |
-
* @param {object} oSearch search information
|
4249 |
-
* @param {int} [iForce] force a research of the master array (1) or not (undefined or 0)
|
4250 |
-
* @memberof WFDataTable#oApi
|
4251 |
-
*/
|
4252 |
-
function _fnFilterComplete ( oSettings, oInput, iForce )
|
4253 |
-
{
|
4254 |
-
var oPrevSearch = oSettings.oPreviousSearch;
|
4255 |
-
var aoPrevSearch = oSettings.aoPreSearchCols;
|
4256 |
-
var fnSaveFilter = function ( oFilter ) {
|
4257 |
-
/* Save the filtering values */
|
4258 |
-
oPrevSearch.sSearch = oFilter.sSearch;
|
4259 |
-
oPrevSearch.bRegex = oFilter.bRegex;
|
4260 |
-
oPrevSearch.bSmart = oFilter.bSmart;
|
4261 |
-
oPrevSearch.bCaseInsensitive = oFilter.bCaseInsensitive;
|
4262 |
-
};
|
4263 |
-
var fnRegex = function ( o ) {
|
4264 |
-
// Backwards compatibility with the bEscapeRegex option
|
4265 |
-
return o.bEscapeRegex !== undefined ? !o.bEscapeRegex : o.bRegex;
|
4266 |
-
};
|
4267 |
-
|
4268 |
-
// Resolve any column types that are unknown due to addition or invalidation
|
4269 |
-
// @todo As per sort - can this be moved into an event handler?
|
4270 |
-
_fnColumnTypes( oSettings );
|
4271 |
-
|
4272 |
-
/* In server-side processing all filtering is done by the server, so no point hanging around here */
|
4273 |
-
if ( _fnDataSource( oSettings ) != 'ssp' )
|
4274 |
-
{
|
4275 |
-
/* Global filter */
|
4276 |
-
_fnFilter( oSettings, oInput.sSearch, iForce, fnRegex(oInput), oInput.bSmart, oInput.bCaseInsensitive );
|
4277 |
-
fnSaveFilter( oInput );
|
4278 |
-
|
4279 |
-
/* Now do the individual column filter */
|
4280 |
-
for ( var i=0 ; i<aoPrevSearch.length ; i++ )
|
4281 |
-
{
|
4282 |
-
_fnFilterColumn( oSettings, aoPrevSearch[i].sSearch, i, fnRegex(aoPrevSearch[i]),
|
4283 |
-
aoPrevSearch[i].bSmart, aoPrevSearch[i].bCaseInsensitive );
|
4284 |
-
}
|
4285 |
-
|
4286 |
-
/* Custom filtering */
|
4287 |
-
_fnFilterCustom( oSettings );
|
4288 |
-
}
|
4289 |
-
else
|
4290 |
-
{
|
4291 |
-
fnSaveFilter( oInput );
|
4292 |
-
}
|
4293 |
-
|
4294 |
-
/* Tell the draw function we have been filtering */
|
4295 |
-
oSettings.bFiltered = true;
|
4296 |
-
_fnCallbackFire( oSettings, null, 'search', [oSettings] );
|
4297 |
-
}
|
4298 |
-
|
4299 |
-
|
4300 |
-
/**
|
4301 |
-
* Apply custom filtering functions
|
4302 |
-
* @param {object} oSettings dataTables settings object
|
4303 |
-
* @memberof WFDataTable#oApi
|
4304 |
-
*/
|
4305 |
-
function _fnFilterCustom( settings )
|
4306 |
-
{
|
4307 |
-
var filters = WFDataTable.ext.search;
|
4308 |
-
var displayRows = settings.aiDisplay;
|
4309 |
-
var row, rowIdx;
|
4310 |
-
|
4311 |
-
for ( var i=0, ien=filters.length ; i<ien ; i++ ) {
|
4312 |
-
var rows = [];
|
4313 |
-
|
4314 |
-
// Loop over each row and see if it should be included
|
4315 |
-
for ( var j=0, jen=displayRows.length ; j<jen ; j++ ) {
|
4316 |
-
rowIdx = displayRows[ j ];
|
4317 |
-
row = settings.aoData[ rowIdx ];
|
4318 |
-
|
4319 |
-
if ( filters[i]( settings, row._aFilterData, rowIdx, row._aData, j ) ) {
|
4320 |
-
rows.push( rowIdx );
|
4321 |
-
}
|
4322 |
-
}
|
4323 |
-
|
4324 |
-
// So the array reference doesn't break set the results into the
|
4325 |
-
// existing array
|
4326 |
-
displayRows.length = 0;
|
4327 |
-
$.merge( displayRows, rows );
|
4328 |
-
}
|
4329 |
-
}
|
4330 |
-
|
4331 |
-
|
4332 |
-
/**
|
4333 |
-
* Filter the table on a per-column basis
|
4334 |
-
* @param {object} oSettings dataTables settings object
|
4335 |
-
* @param {string} sInput string to filter on
|
4336 |
-
* @param {int} iColumn column to filter
|
4337 |
-
* @param {bool} bRegex treat search string as a regular expression or not
|
4338 |
-
* @param {bool} bSmart use smart filtering or not
|
4339 |
-
* @param {bool} bCaseInsensitive Do case insenstive matching or not
|
4340 |
-
* @memberof WFDataTable#oApi
|
4341 |
-
*/
|
4342 |
-
function _fnFilterColumn ( settings, searchStr, colIdx, regex, smart, caseInsensitive )
|
4343 |
-
{
|
4344 |
-
if ( searchStr === '' ) {
|
4345 |
-
return;
|
4346 |
-
}
|
4347 |
-
|
4348 |
-
var data;
|
4349 |
-
var out = [];
|
4350 |
-
var display = settings.aiDisplay;
|
4351 |
-
var rpSearch = _fnFilterCreateSearch( searchStr, regex, smart, caseInsensitive );
|
4352 |
-
|
4353 |
-
for ( var i=0 ; i<display.length ; i++ ) {
|
4354 |
-
data = settings.aoData[ display[i] ]._aFilterData[ colIdx ];
|
4355 |
-
|
4356 |
-
if ( rpSearch.test( data ) ) {
|
4357 |
-
out.push( display[i] );
|
4358 |
-
}
|
4359 |
-
}
|
4360 |
-
|
4361 |
-
settings.aiDisplay = out;
|
4362 |
-
}
|
4363 |
-
|
4364 |
-
|
4365 |
-
/**
|
4366 |
-
* Filter the data table based on user input and draw the table
|
4367 |
-
* @param {object} settings dataTables settings object
|
4368 |
-
* @param {string} input string to filter on
|
4369 |
-
* @param {int} force optional - force a research of the master array (1) or not (undefined or 0)
|
4370 |
-
* @param {bool} regex treat as a regular expression or not
|
4371 |
-
* @param {bool} smart perform smart filtering or not
|
4372 |
-
* @param {bool} caseInsensitive Do case insenstive matching or not
|
4373 |
-
* @memberof WFDataTable#oApi
|
4374 |
-
*/
|
4375 |
-
function _fnFilter( settings, input, force, regex, smart, caseInsensitive )
|
4376 |
-
{
|
4377 |
-
var rpSearch = _fnFilterCreateSearch( input, regex, smart, caseInsensitive );
|
4378 |
-
var prevSearch = settings.oPreviousSearch.sSearch;
|
4379 |
-
var displayMaster = settings.aiDisplayMaster;
|
4380 |
-
var display, invalidated, i;
|
4381 |
-
var filtered = [];
|
4382 |
-
|
4383 |
-
// Need to take account of custom filtering functions - always filter
|
4384 |
-
if ( WFDataTable.ext.search.length !== 0 ) {
|
4385 |
-
force = true;
|
4386 |
-
}
|
4387 |
-
|
4388 |
-
// Check if any of the rows were invalidated
|
4389 |
-
invalidated = _fnFilterData( settings );
|
4390 |
-
|
4391 |
-
// If the input is blank - we just want the full data set
|
4392 |
-
if ( input.length <= 0 ) {
|
4393 |
-
settings.aiDisplay = displayMaster.slice();
|
4394 |
-
}
|
4395 |
-
else {
|
4396 |
-
// New search - start from the master array
|
4397 |
-
if ( invalidated ||
|
4398 |
-
force ||
|
4399 |
-
prevSearch.length > input.length ||
|
4400 |
-
input.indexOf(prevSearch) !== 0 ||
|
4401 |
-
settings.bSorted // On resort, the display master needs to be
|
4402 |
-
// re-filtered since indexes will have changed
|
4403 |
-
) {
|
4404 |
-
settings.aiDisplay = displayMaster.slice();
|
4405 |
-
}
|
4406 |
-
|
4407 |
-
// Search the display array
|
4408 |
-
display = settings.aiDisplay;
|
4409 |
-
|
4410 |
-
for ( i=0 ; i<display.length ; i++ ) {
|
4411 |
-
if ( rpSearch.test( settings.aoData[ display[i] ]._sFilterRow ) ) {
|
4412 |
-
filtered.push( display[i] );
|
4413 |
-
}
|
4414 |
-
}
|
4415 |
-
|
4416 |
-
settings.aiDisplay = filtered;
|
4417 |
-
}
|
4418 |
-
}
|
4419 |
-
|
4420 |
-
|
4421 |
-
/**
|
4422 |
-
* Build a regular expression object suitable for searching a table
|
4423 |
-
* @param {string} sSearch string to search for
|
4424 |
-
* @param {bool} bRegex treat as a regular expression or not
|
4425 |
-
* @param {bool} bSmart perform smart filtering or not
|
4426 |
-
* @param {bool} bCaseInsensitive Do case insensitive matching or not
|
4427 |
-
* @returns {RegExp} constructed object
|
4428 |
-
* @memberof WFDataTable#oApi
|
4429 |
-
*/
|
4430 |
-
function _fnFilterCreateSearch( search, regex, smart, caseInsensitive )
|
4431 |
-
{
|
4432 |
-
search = regex ?
|
4433 |
-
search :
|
4434 |
-
_fnEscapeRegex( search );
|
4435 |
-
|
4436 |
-
if ( smart ) {
|
4437 |
-
/* For smart filtering we want to allow the search to work regardless of
|
4438 |
-
* word order. We also want double quoted text to be preserved, so word
|
4439 |
-
* order is important - a la google. So this is what we want to
|
4440 |
-
* generate:
|
4441 |
-
*
|
4442 |
-
* ^(?=.*?\bone\b)(?=.*?\btwo three\b)(?=.*?\bfour\b).*$
|
4443 |
-
*/
|
4444 |
-
var a = $.map( search.match( /"[^"]+"|[^ ]+/g ) || [''], function ( word ) {
|
4445 |
-
if ( word.charAt(0) === '"' ) {
|
4446 |
-
var m = word.match( /^"(.*)"$/ );
|
4447 |
-
word = m ? m[1] : word;
|
4448 |
-
}
|
4449 |
-
|
4450 |
-
return word.replace('"', '');
|
4451 |
-
} );
|
4452 |
-
|
4453 |
-
search = '^(?=.*?'+a.join( ')(?=.*?' )+').*$';
|
4454 |
-
}
|
4455 |
-
|
4456 |
-
return new RegExp( search, caseInsensitive ? 'i' : '' );
|
4457 |
-
}
|
4458 |
-
|
4459 |
-
|
4460 |
-
/**
|
4461 |
-
* Escape a string such that it can be used in a regular expression
|
4462 |
-
* @param {string} sVal string to escape
|
4463 |
-
* @returns {string} escaped string
|
4464 |
-
* @memberof WFDataTable#oApi
|
4465 |
-
*/
|
4466 |
-
var _fnEscapeRegex = WFDataTable.util.escapeRegex;
|
4467 |
-
|
4468 |
-
var __filter_div = $('<div>')[0];
|
4469 |
-
var __filter_div_textContent = __filter_div.textContent !== undefined;
|
4470 |
-
|
4471 |
-
// Update the filtering data for each row if needed (by invalidation or first run)
|
4472 |
-
function _fnFilterData ( settings )
|
4473 |
-
{
|
4474 |
-
var columns = settings.aoColumns;
|
4475 |
-
var column;
|
4476 |
-
var i, j, ien, jen, filterData, cellData, row;
|
4477 |
-
var fomatters = WFDataTable.ext.type.search;
|
4478 |
-
var wasInvalidated = false;
|
4479 |
-
|
4480 |
-
for ( i=0, ien=settings.aoData.length ; i<ien ; i++ ) {
|
4481 |
-
row = settings.aoData[i];
|
4482 |
-
|
4483 |
-
if ( ! row._aFilterData ) {
|
4484 |
-
filterData = [];
|
4485 |
-
|
4486 |
-
for ( j=0, jen=columns.length ; j<jen ; j++ ) {
|
4487 |
-
column = columns[j];
|
4488 |
-
|
4489 |
-
if ( column.bSearchable ) {
|
4490 |
-
cellData = _fnGetCellData( settings, i, j, 'filter' );
|
4491 |
-
|
4492 |
-
if ( fomatters[ column.sType ] ) {
|
4493 |
-
cellData = fomatters[ column.sType ]( cellData );
|
4494 |
-
}
|
4495 |
-
|
4496 |
-
// Search in WFDataTables 1.10 is string based. In 1.11 this
|
4497 |
-
// should be altered to also allow strict type checking.
|
4498 |
-
if ( cellData === null ) {
|
4499 |
-
cellData = '';
|
4500 |
-
}
|
4501 |
-
|
4502 |
-
if ( typeof cellData !== 'string' && cellData.toString ) {
|
4503 |
-
cellData = cellData.toString();
|
4504 |
-
}
|
4505 |
-
}
|
4506 |
-
else {
|
4507 |
-
cellData = '';
|
4508 |
-
}
|
4509 |
-
|
4510 |
-
// If it looks like there is an HTML entity in the string,
|
4511 |
-
// attempt to decode it so sorting works as expected. Note that
|
4512 |
-
// we could use a single line of jQuery to do this, but the DOM
|
4513 |
-
// method used here is much faster http://jsperf.com/html-decode
|
4514 |
-
if ( cellData.indexOf && cellData.indexOf('&') !== -1 ) {
|
4515 |
-
__filter_div.innerHTML = cellData;
|
4516 |
-
cellData = __filter_div_textContent ?
|
4517 |
-
__filter_div.textContent :
|
4518 |
-
__filter_div.innerText;
|
4519 |
-
}
|
4520 |
-
|
4521 |
-
if ( cellData.replace ) {
|
4522 |
-
cellData = cellData.replace(/[\r\n]/g, '');
|
4523 |
-
}
|
4524 |
-
|
4525 |
-
filterData.push( cellData );
|
4526 |
-
}
|
4527 |
-
|
4528 |
-
row._aFilterData = filterData;
|
4529 |
-
row._sFilterRow = filterData.join(' ');
|
4530 |
-
wasInvalidated = true;
|
4531 |
-
}
|
4532 |
-
}
|
4533 |
-
|
4534 |
-
return wasInvalidated;
|
4535 |
-
}
|
4536 |
-
|
4537 |
-
|
4538 |
-
/**
|
4539 |
-
* Convert from the internal Hungarian notation to camelCase for external
|
4540 |
-
* interaction
|
4541 |
-
* @param {object} obj Object to convert
|
4542 |
-
* @returns {object} Inverted object
|
4543 |
-
* @memberof WFDataTable#oApi
|
4544 |
-
*/
|
4545 |
-
function _fnSearchToCamel ( obj )
|
4546 |
-
{
|
4547 |
-
return {
|
4548 |
-
search: obj.sSearch,
|
4549 |
-
smart: obj.bSmart,
|
4550 |
-
regex: obj.bRegex,
|
4551 |
-
caseInsensitive: obj.bCaseInsensitive
|
4552 |
-
};
|
4553 |
-
}
|
4554 |
-
|
4555 |
-
|
4556 |
-
|
4557 |
-
/**
|
4558 |
-
* Convert from camelCase notation to the internal Hungarian. We could use the
|
4559 |
-
* Hungarian convert function here, but this is cleaner
|
4560 |
-
* @param {object} obj Object to convert
|
4561 |
-
* @returns {object} Inverted object
|
4562 |
-
* @memberof WFDataTable#oApi
|
4563 |
-
*/
|
4564 |
-
function _fnSearchToHung ( obj )
|
4565 |
-
{
|
4566 |
-
return {
|
4567 |
-
sSearch: obj.search,
|
4568 |
-
bSmart: obj.smart,
|
4569 |
-
bRegex: obj.regex,
|
4570 |
-
bCaseInsensitive: obj.caseInsensitive
|
4571 |
-
};
|
4572 |
-
}
|
4573 |
-
|
4574 |
-
/**
|
4575 |
-
* Generate the node required for the info display
|
4576 |
-
* @param {object} oSettings dataTables settings object
|
4577 |
-
* @returns {node} Information element
|
4578 |
-
* @memberof WFDataTable#oApi
|
4579 |
-
*/
|
4580 |
-
function _fnFeatureHtmlInfo ( settings )
|
4581 |
-
{
|
4582 |
-
var
|
4583 |
-
tid = settings.sTableId,
|
4584 |
-
nodes = settings.aanFeatures.i,
|
4585 |
-
n = $('<div/>', {
|
4586 |
-
'class': settings.oClasses.sInfo,
|
4587 |
-
'id': ! nodes ? tid+'_info' : null
|
4588 |
-
} );
|
4589 |
-
|
4590 |
-
if ( ! nodes ) {
|
4591 |
-
// Update display on each draw
|
4592 |
-
settings.aoDrawCallback.push( {
|
4593 |
-
"fn": _fnUpdateInfo,
|
4594 |
-
"sName": "information"
|
4595 |
-
} );
|
4596 |
-
|
4597 |
-
n
|
4598 |
-
.attr( 'role', 'status' )
|
4599 |
-
.attr( 'aria-live', 'polite' );
|
4600 |
-
|
4601 |
-
// Table is described by our info div
|
4602 |
-
$(settings.nTable).attr( 'aria-describedby', tid+'_info' );
|
4603 |
-
}
|
4604 |
-
|
4605 |
-
return n[0];
|
4606 |
-
}
|
4607 |
-
|
4608 |
-
|
4609 |
-
/**
|
4610 |
-
* Update the information elements in the display
|
4611 |
-
* @param {object} settings dataTables settings object
|
4612 |
-
* @memberof WFDataTable#oApi
|
4613 |
-
*/
|
4614 |
-
function _fnUpdateInfo ( settings )
|
4615 |
-
{
|
4616 |
-
/* Show information about the table */
|
4617 |
-
var nodes = settings.aanFeatures.i;
|
4618 |
-
if ( nodes.length === 0 ) {
|
4619 |
-
return;
|
4620 |
-
}
|
4621 |
-
|
4622 |
-
var
|
4623 |
-
lang = settings.oLanguage,
|
4624 |
-
start = settings._iDisplayStart+1,
|
4625 |
-
end = settings.fnDisplayEnd(),
|
4626 |
-
max = settings.fnRecordsTotal(),
|
4627 |
-
total = settings.fnRecordsDisplay(),
|
4628 |
-
out = total ?
|
4629 |
-
lang.sInfo :
|
4630 |
-
lang.sInfoEmpty;
|
4631 |
-
|
4632 |
-
if ( total !== max ) {
|
4633 |
-
/* Record set after filtering */
|
4634 |
-
out += ' ' + lang.sInfoFiltered;
|
4635 |
-
}
|
4636 |
-
|
4637 |
-
// Convert the macros
|
4638 |
-
out += lang.sInfoPostFix;
|
4639 |
-
out = _fnInfoMacros( settings, out );
|
4640 |
-
|
4641 |
-
var callback = lang.fnInfoCallback;
|
4642 |
-
if ( callback !== null ) {
|
4643 |
-
out = callback.call( settings.oInstance,
|
4644 |
-
settings, start, end, max, total, out
|
4645 |
-
);
|
4646 |
-
}
|
4647 |
-
|
4648 |
-
$(nodes).html( out );
|
4649 |
-
}
|
4650 |
-
|
4651 |
-
|
4652 |
-
function _fnInfoMacros ( settings, str )
|
4653 |
-
{
|
4654 |
-
// When infinite scrolling, we are always starting at 1. _iDisplayStart is used only
|
4655 |
-
// internally
|
4656 |
-
var
|
4657 |
-
formatter = settings.fnFormatNumber,
|
4658 |
-
start = settings._iDisplayStart+1,
|
4659 |
-
len = settings._iDisplayLength,
|
4660 |
-
vis = settings.fnRecordsDisplay(),
|
4661 |
-
all = len === -1;
|
4662 |
-
|
4663 |
-
return str.
|
4664 |
-
replace(/_START_/g, formatter.call( settings, start ) ).
|
4665 |
-
replace(/_END_/g, formatter.call( settings, settings.fnDisplayEnd() ) ).
|
4666 |
-
replace(/_MAX_/g, formatter.call( settings, settings.fnRecordsTotal() ) ).
|
4667 |
-
replace(/_TOTAL_/g, formatter.call( settings, vis ) ).
|
4668 |
-
replace(/_PAGE_/g, formatter.call( settings, all ? 1 : Math.ceil( start / len ) ) ).
|
4669 |
-
replace(/_PAGES_/g, formatter.call( settings, all ? 1 : Math.ceil( vis / len ) ) );
|
4670 |
-
}
|
4671 |
-
|
4672 |
-
|
4673 |
-
|
4674 |
-
/**
|
4675 |
-
* Draw the table for the first time, adding all required features
|
4676 |
-
* @param {object} settings dataTables settings object
|
4677 |
-
* @memberof WFDataTable#oApi
|
4678 |
-
*/
|
4679 |
-
function _fnInitialise ( settings )
|
4680 |
-
{
|
4681 |
-
var i, iLen, iAjaxStart=settings.iInitDisplayStart;
|
4682 |
-
var columns = settings.aoColumns, column;
|
4683 |
-
var features = settings.oFeatures;
|
4684 |
-
var deferLoading = settings.bDeferLoading; // value modified by the draw
|
4685 |
-
|
4686 |
-
/* Ensure that the table data is fully initialised */
|
4687 |
-
if ( ! settings.bInitialised ) {
|
4688 |
-
setTimeout( function(){ _fnInitialise( settings ); }, 200 );
|
4689 |
-
return;
|
4690 |
-
}
|
4691 |
-
|
4692 |
-
/* Show the display HTML options */
|
4693 |
-
_fnAddOptionsHtml( settings );
|
4694 |
-
|
4695 |
-
/* Build and draw the header / footer for the table */
|
4696 |
-
_fnBuildHead( settings );
|
4697 |
-
_fnDrawHead( settings, settings.aoHeader );
|
4698 |
-
_fnDrawHead( settings, settings.aoFooter );
|
4699 |
-
|
4700 |
-
/* Okay to show that something is going on now */
|
4701 |
-
_fnProcessingDisplay( settings, true );
|
4702 |
-
|
4703 |
-
/* Calculate sizes for columns */
|
4704 |
-
if ( features.bAutoWidth ) {
|
4705 |
-
_fnCalculateColumnWidths( settings );
|
4706 |
-
}
|
4707 |
-
|
4708 |
-
for ( i=0, iLen=columns.length ; i<iLen ; i++ ) {
|
4709 |
-
column = columns[i];
|
4710 |
-
|
4711 |
-
if ( column.sWidth ) {
|
4712 |
-
column.nTh.style.width = _fnStringToCss( column.sWidth );
|
4713 |
-
}
|
4714 |
-
}
|
4715 |
-
|
4716 |
-
_fnCallbackFire( settings, null, 'preInit', [settings] );
|
4717 |
-
|
4718 |
-
// If there is default sorting required - let's do it. The sort function
|
4719 |
-
// will do the drawing for us. Otherwise we draw the table regardless of the
|
4720 |
-
// Ajax source - this allows the table to look initialised for Ajax sourcing
|
4721 |
-
// data (show 'loading' message possibly)
|
4722 |
-
_fnReDraw( settings );
|
4723 |
-
|
4724 |
-
// Server-side processing init complete is done by _fnAjaxUpdateDraw
|
4725 |
-
var dataSrc = _fnDataSource( settings );
|
4726 |
-
if ( dataSrc != 'ssp' || deferLoading ) {
|
4727 |
-
// if there is an ajax source load the data
|
4728 |
-
if ( dataSrc == 'ajax' ) {
|
4729 |
-
_fnBuildAjax( settings, [], function(json) {
|
4730 |
-
var aData = _fnAjaxDataSrc( settings, json );
|
4731 |
-
|
4732 |
-
// Got the data - add it to the table
|
4733 |
-
for ( i=0 ; i<aData.length ; i++ ) {
|
4734 |
-
_fnAddData( settings, aData[i] );
|
4735 |
-
}
|
4736 |
-
|
4737 |
-
// Reset the init display for cookie saving. We've already done
|
4738 |
-
// a filter, and therefore cleared it before. So we need to make
|
4739 |
-
// it appear 'fresh'
|
4740 |
-
settings.iInitDisplayStart = iAjaxStart;
|
4741 |
-
|
4742 |
-
_fnReDraw( settings );
|
4743 |
-
|
4744 |
-
_fnProcessingDisplay( settings, false );
|
4745 |
-
_fnInitComplete( settings, json );
|
4746 |
-
}, settings );
|
4747 |
-
}
|
4748 |
-
else {
|
4749 |
-
_fnProcessingDisplay( settings, false );
|
4750 |
-
_fnInitComplete( settings );
|
4751 |
-
}
|
4752 |
-
}
|
4753 |
-
}
|
4754 |
-
|
4755 |
-
|
4756 |
-
/**
|
4757 |
-
* Draw the table for the first time, adding all required features
|
4758 |
-
* @param {object} oSettings dataTables settings object
|
4759 |
-
* @param {object} [json] JSON from the server that completed the table, if using Ajax source
|
4760 |
-
* with client-side processing (optional)
|
4761 |
-
* @memberof WFDataTable#oApi
|
4762 |
-
*/
|
4763 |
-
function _fnInitComplete ( settings, json )
|
4764 |
-
{
|
4765 |
-
settings._bInitComplete = true;
|
4766 |
-
|
4767 |
-
// When data was added after the initialisation (data or Ajax) we need to
|
4768 |
-
// calculate the column sizing
|
4769 |
-
if ( json || settings.oInit.aaData ) {
|
4770 |
-
_fnAdjustColumnSizing( settings );
|
4771 |
-
}
|
4772 |
-
|
4773 |
-
_fnCallbackFire( settings, null, 'plugin-init', [settings, json] );
|
4774 |
-
_fnCallbackFire( settings, 'aoInitComplete', 'init', [settings, json] );
|
4775 |
-
}
|
4776 |
-
|
4777 |
-
|
4778 |
-
function _fnLengthChange ( settings, val )
|
4779 |
-
{
|
4780 |
-
var len = parseInt( val, 10 );
|
4781 |
-
settings._iDisplayLength = len;
|
4782 |
-
|
4783 |
-
_fnLengthOverflow( settings );
|
4784 |
-
|
4785 |
-
// Fire length change event
|
4786 |
-
_fnCallbackFire( settings, null, 'length', [settings, len] );
|
4787 |
-
}
|
4788 |
-
|
4789 |
-
|
4790 |
-
/**
|
4791 |
-
* Generate the node required for user display length changing
|
4792 |
-
* @param {object} settings dataTables settings object
|
4793 |
-
* @returns {node} Display length feature node
|
4794 |
-
* @memberof WFDataTable#oApi
|
4795 |
-
*/
|
4796 |
-
function _fnFeatureHtmlLength ( settings )
|
4797 |
-
{
|
4798 |
-
var
|
4799 |
-
classes = settings.oClasses,
|
4800 |
-
tableId = settings.sTableId,
|
4801 |
-
menu = settings.aLengthMenu,
|
4802 |
-
d2 = $.isArray( menu[0] ),
|
4803 |
-
lengths = d2 ? menu[0] : menu,
|
4804 |
-
language = d2 ? menu[1] : menu;
|
4805 |
-
|
4806 |
-
var select = $('<select/>', {
|
4807 |
-
'name': tableId+'_length',
|
4808 |
-
'aria-controls': tableId,
|
4809 |
-
'class': classes.sLengthSelect
|
4810 |
-
} );
|
4811 |
-
|
4812 |
-
for ( var i=0, ien=lengths.length ; i<ien ; i++ ) {
|
4813 |
-
select[0][ i ] = new Option( language[i], lengths[i] );
|
4814 |
-
}
|
4815 |
-
|
4816 |
-
var div = $('<div><label/></div>').addClass( classes.sLength );
|
4817 |
-
if ( ! settings.aanFeatures.l ) {
|
4818 |
-
div[0].id = tableId+'_length';
|
4819 |
-
}
|
4820 |
-
|
4821 |
-
div.children().append(
|
4822 |
-
settings.oLanguage.sLengthMenu.replace( '_MENU_', select[0].outerHTML )
|
4823 |
-
);
|
4824 |
-
|
4825 |
-
// Can't use `select` variable as user might provide their own and the
|
4826 |
-
// reference is broken by the use of outerHTML
|
4827 |
-
$('select', div)
|
4828 |
-
.val( settings._iDisplayLength )
|
4829 |
-
.on( 'change.DT', function(e) {
|
4830 |
-
_fnLengthChange( settings, $(this).val() );
|
4831 |
-
_fnDraw( settings );
|
4832 |
-
} );
|
4833 |
-
|
4834 |
-
// Update node value whenever anything changes the table's length
|
4835 |
-
$(settings.nTable).on( 'length.dt.DT', function (e, s, len) {
|
4836 |
-
if ( settings === s ) {
|
4837 |
-
$('select', div).val( len );
|
4838 |
-
}
|
4839 |
-
} );
|
4840 |
-
|
4841 |
-
return div[0];
|
4842 |
-
}
|
4843 |
-
|
4844 |
-
|
4845 |
-
|
4846 |
-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
4847 |
-
* Note that most of the paging logic is done in
|
4848 |
-
* WFDataTable.ext.pager
|
4849 |
-
*/
|
4850 |
-
|
4851 |
-
/**
|
4852 |
-
* Generate the node required for default pagination
|
4853 |
-
* @param {object} oSettings dataTables settings object
|
4854 |
-
* @returns {node} Pagination feature node
|
4855 |
-
* @memberof WFDataTable#oApi
|
4856 |
-
*/
|
4857 |
-
function _fnFeatureHtmlPaginate ( settings )
|
4858 |
-
{
|
4859 |
-
var
|
4860 |
-
type = settings.sPaginationType,
|
4861 |
-
plugin = WFDataTable.ext.pager[ type ],
|
4862 |
-
modern = typeof plugin === 'function',
|
4863 |
-
redraw = function( settings ) {
|
4864 |
-
_fnDraw( settings );
|
4865 |
-
},
|
4866 |
-
node = $('<div/>').addClass( settings.oClasses.sPaging + type )[0],
|
4867 |
-
features = settings.aanFeatures;
|
4868 |
-
|
4869 |
-
if ( ! modern ) {
|
4870 |
-
plugin.fnInit( settings, node, redraw );
|
4871 |
-
}
|
4872 |
-
|
4873 |
-
/* Add a draw callback for the pagination on first instance, to update the paging display */
|
4874 |
-
if ( ! features.p )
|
4875 |
-
{
|
4876 |
-
node.id = settings.sTableId+'_paginate';
|
4877 |
-
|
4878 |
-
settings.aoDrawCallback.push( {
|
4879 |
-
"fn": function( settings ) {
|
4880 |
-
if ( modern ) {
|
4881 |
-
var
|
4882 |
-
start = settings._iDisplayStart,
|
4883 |
-
len = settings._iDisplayLength,
|
4884 |
-
visRecords = settings.fnRecordsDisplay(),
|
4885 |
-
all = len === -1,
|
4886 |
-
page = all ? 0 : Math.ceil( start / len ),
|
4887 |
-
pages = all ? 1 : Math.ceil( visRecords / len ),
|
4888 |
-
buttons = plugin(page, pages),
|
4889 |
-
i, ien;
|
4890 |
-
|
4891 |
-
for ( i=0, ien=features.p.length ; i<ien ; i++ ) {
|
4892 |
-
_fnRenderer( settings, 'pageButton' )(
|
4893 |
-
settings, features.p[i], i, buttons, page, pages
|
4894 |
-
);
|
4895 |
-
}
|
4896 |
-
}
|
4897 |
-
else {
|
4898 |
-
plugin.fnUpdate( settings, redraw );
|
4899 |
-
}
|
4900 |
-
},
|
4901 |
-
"sName": "pagination"
|
4902 |
-
} );
|
4903 |
-
}
|
4904 |
-
|
4905 |
-
return node;
|
4906 |
-
}
|
4907 |
-
|
4908 |
-
|
4909 |
-
/**
|
4910 |
-
* Alter the display settings to change the page
|
4911 |
-
* @param {object} settings WFDataTables settings object
|
4912 |
-
* @param {string|int} action Paging action to take: "first", "previous",
|
4913 |
-
* "next" or "last" or page number to jump to (integer)
|
4914 |
-
* @param [bool] redraw Automatically draw the update or not
|
4915 |
-
* @returns {bool} true page has changed, false - no change
|
4916 |
-
* @memberof WFDataTable#oApi
|
4917 |
-
*/
|
4918 |
-
function _fnPageChange ( settings, action, redraw )
|
4919 |
-
{
|
4920 |
-
var
|
4921 |
-
start = settings._iDisplayStart,
|
4922 |
-
len = settings._iDisplayLength,
|
4923 |
-
records = settings.fnRecordsDisplay();
|
4924 |
-
|
4925 |
-
if ( records === 0 || len === -1 )
|
4926 |
-
{
|
4927 |
-
start = 0;
|
4928 |
-
}
|
4929 |
-
else if ( typeof action === "number" )
|
4930 |
-
{
|
4931 |
-
start = action * len;
|
4932 |
-
|
4933 |
-
if ( start > records )
|
4934 |
-
{
|
4935 |
-
start = 0;
|
4936 |
-
}
|
4937 |
-
}
|
4938 |
-
else if ( action == "first" )
|
4939 |
-
{
|
4940 |
-
start = 0;
|
4941 |
-
}
|
4942 |
-
else if ( action == "previous" )
|
4943 |
-
{
|
4944 |
-
start = len >= 0 ?
|
4945 |
-
start - len :
|
4946 |
-
0;
|
4947 |
-
|
4948 |
-
if ( start < 0 )
|
4949 |
-
{
|
4950 |
-
start = 0;
|
4951 |
-
}
|
4952 |
-
}
|
4953 |
-
else if ( action == "next" )
|
4954 |
-
{
|
4955 |
-
if ( start + len < records )
|
4956 |
-
{
|
4957 |
-
start += len;
|
4958 |
-
}
|
4959 |
-
}
|
4960 |
-
else if ( action == "last" )
|
4961 |
-
{
|
4962 |
-
start = Math.floor( (records-1) / len) * len;
|
4963 |
-
}
|
4964 |
-
else
|
4965 |
-
{
|
4966 |
-
_fnLog( settings, 0, "Unknown paging action: "+action, 5 );
|
4967 |
-
}
|
4968 |
-
|
4969 |
-
var changed = settings._iDisplayStart !== start;
|
4970 |
-
settings._iDisplayStart = start;
|
4971 |
-
|
4972 |
-
if ( changed ) {
|
4973 |
-
_fnCallbackFire( settings, null, 'page', [settings] );
|
4974 |
-
|
4975 |
-
if ( redraw ) {
|
4976 |
-
_fnDraw( settings );
|
4977 |
-
}
|
4978 |
-
}
|
4979 |
-
|
4980 |
-
return changed;
|
4981 |
-
}
|
4982 |
-
|
4983 |
-
|
4984 |
-
|
4985 |
-
/**
|
4986 |
-
* Generate the node required for the processing node
|
4987 |
-
* @param {object} settings dataTables settings object
|
4988 |
-
* @returns {node} Processing element
|
4989 |
-
* @memberof WFDataTable#oApi
|
4990 |
-
*/
|
4991 |
-
function _fnFeatureHtmlProcessing ( settings )
|
4992 |
-
{
|
4993 |
-
return $('<div/>', {
|
4994 |
-
'id': ! settings.aanFeatures.r ? settings.sTableId+'_processing' : null,
|
4995 |
-
'class': settings.oClasses.sProcessing
|
4996 |
-
} )
|
4997 |
-
.html( settings.oLanguage.sProcessing )
|
4998 |
-
.insertBefore( settings.nTable )[0];
|
4999 |
-
}
|
5000 |
-
|
5001 |
-
|
5002 |
-
/**
|
5003 |
-
* Display or hide the processing indicator
|
5004 |
-
* @param {object} settings dataTables settings object
|
5005 |
-
* @param {bool} show Show the processing indicator (true) or not (false)
|
5006 |
-
* @memberof WFDataTable#oApi
|
5007 |
-
*/
|
5008 |
-
function _fnProcessingDisplay ( settings, show )
|
5009 |
-
{
|
5010 |
-
if ( settings.oFeatures.bProcessing ) {
|
5011 |
-
$(settings.aanFeatures.r).css( 'display', show ? 'block' : 'none' );
|
5012 |
-
}
|
5013 |
-
|
5014 |
-
_fnCallbackFire( settings, null, 'processing', [settings, show] );
|
5015 |
-
}
|
5016 |
-
|
5017 |
-
/**
|
5018 |
-
* Add any control elements for the table - specifically scrolling
|
5019 |
-
* @param {object} settings dataTables settings object
|
5020 |
-
* @returns {node} Node to add to the DOM
|
5021 |
-
* @memberof WFDataTable#oApi
|
5022 |
-
*/
|
5023 |
-
function _fnFeatureHtmlTable ( settings )
|
5024 |
-
{
|
5025 |
-
var table = $(settings.nTable);
|
5026 |
-
|
5027 |
-
// Add the ARIA grid role to the table
|
5028 |
-
table.attr( 'role', 'grid' );
|
5029 |
-
|
5030 |
-
// Scrolling from here on in
|
5031 |
-
var scroll = settings.oScroll;
|
5032 |
-
|
5033 |
-
if ( scroll.sX === '' && scroll.sY === '' ) {
|
5034 |
-
return settings.nTable;
|
5035 |
-
}
|
5036 |
-
|
5037 |
-
var scrollX = scroll.sX;
|
5038 |
-
var scrollY = scroll.sY;
|
5039 |
-
var classes = settings.oClasses;
|
5040 |
-
var caption = table.children('caption');
|
5041 |
-
var captionSide = caption.length ? caption[0]._captionSide : null;
|
5042 |
-
var headerClone = $( table[0].cloneNode(false) );
|
5043 |
-
var footerClone = $( table[0].cloneNode(false) );
|
5044 |
-
var footer = table.children('tfoot');
|
5045 |
-
var _div = '<div/>';
|
5046 |
-
var size = function ( s ) {
|
5047 |
-
return !s ? null : _fnStringToCss( s );
|
5048 |
-
};
|
5049 |
-
|
5050 |
-
if ( ! footer.length ) {
|
5051 |
-
footer = null;
|
5052 |
-
}
|
5053 |
-
|
5054 |
-
/*
|
5055 |
-
* The HTML structure that we want to generate in this function is:
|
5056 |
-
* div - scroller
|
5057 |
-
* div - scroll head
|
5058 |
-
* div - scroll head inner
|
5059 |
-
* table - scroll head table
|
5060 |
-
* thead - thead
|
5061 |
-
* div - scroll body
|
5062 |
-
* table - table (master table)
|
5063 |
-
* thead - thead clone for sizing
|
5064 |
-
* tbody - tbody
|
5065 |
-
* div - scroll foot
|
5066 |
-
* div - scroll foot inner
|
5067 |
-
* table - scroll foot table
|
5068 |
-
* tfoot - tfoot
|
5069 |
-
*/
|
5070 |
-
var scroller = $( _div, { 'class': classes.sScrollWrapper } )
|
5071 |
-
.append(
|
5072 |
-
$(_div, { 'class': classes.sScrollHead } )
|
5073 |
-
.css( {
|
5074 |
-
overflow: 'hidden',
|
5075 |
-
position: 'relative',
|
5076 |
-
border: 0,
|
5077 |
-
width: scrollX ? size(scrollX) : '100%'
|
5078 |
-
} )
|
5079 |
-
.append(
|
5080 |
-
$(_div, { 'class': classes.sScrollHeadInner } )
|
5081 |
-
.css( {
|
5082 |
-
'box-sizing': 'content-box',
|
5083 |
-
width: scroll.sXInner || '100%'
|
5084 |
-
} )
|
5085 |
-
.append(
|
5086 |
-
headerClone
|
5087 |
-
.removeAttr('id')
|
5088 |
-
.css( 'margin-left', 0 )
|
5089 |
-
.append( captionSide === 'top' ? caption : null )
|
5090 |
-
.append(
|
5091 |
-
table.children('thead')
|
5092 |
-
)
|
5093 |
-
)
|
5094 |
-
)
|
5095 |
-
)
|
5096 |
-
.append(
|
5097 |
-
$(_div, { 'class': classes.sScrollBody } )
|
5098 |
-
.css( {
|
5099 |
-
position: 'relative',
|
5100 |
-
overflow: 'auto',
|
5101 |
-
width: size( scrollX )
|
5102 |
-
} )
|
5103 |
-
.append( table )
|
5104 |
-
);
|
5105 |
-
|
5106 |
-
if ( footer ) {
|
5107 |
-
scroller.append(
|
5108 |
-
$(_div, { 'class': classes.sScrollFoot } )
|
5109 |
-
.css( {
|
5110 |
-
overflow: 'hidden',
|
5111 |
-
border: 0,
|
5112 |
-
width: scrollX ? size(scrollX) : '100%'
|
5113 |
-
} )
|
5114 |
-
.append(
|
5115 |
-
$(_div, { 'class': classes.sScrollFootInner } )
|
5116 |
-
.append(
|
5117 |
-
footerClone
|
5118 |
-
.removeAttr('id')
|
5119 |
-
.css( 'margin-left', 0 )
|
5120 |
-
.append( captionSide === 'bottom' ? caption : null )
|
5121 |
-
.append(
|
5122 |
-
table.children('tfoot')
|
5123 |
-
)
|
5124 |
-
)
|
5125 |
-
)
|
5126 |
-
);
|
5127 |
-
}
|
5128 |
-
|
5129 |
-
var children = scroller.children();
|
5130 |
-
var scrollHead = children[0];
|
5131 |
-
var scrollBody = children[1];
|
5132 |
-
var scrollFoot = footer ? children[2] : null;
|
5133 |
-
|
5134 |
-
// When the body is scrolled, then we also want to scroll the headers
|
5135 |
-
if ( scrollX ) {
|
5136 |
-
$(scrollBody).on( 'scroll.DT', function (e) {
|
5137 |
-
var scrollLeft = this.scrollLeft;
|
5138 |
-
|
5139 |
-
scrollHead.scrollLeft = scrollLeft;
|
5140 |
-
|
5141 |
-
if ( footer ) {
|
5142 |
-
scrollFoot.scrollLeft = scrollLeft;
|
5143 |
-
}
|
5144 |
-
} );
|
5145 |
-
}
|
5146 |
-
|
5147 |
-
$(scrollBody).css(
|
5148 |
-
scrollY && scroll.bCollapse ? 'max-height' : 'height',
|
5149 |
-
scrollY
|
5150 |
-
);
|
5151 |
-
|
5152 |
-
settings.nScrollHead = scrollHead;
|
5153 |
-
settings.nScrollBody = scrollBody;
|
5154 |
-
settings.nScrollFoot = scrollFoot;
|
5155 |
-
|
5156 |
-
// On redraw - align columns
|
5157 |
-
settings.aoDrawCallback.push( {
|
5158 |
-
"fn": _fnScrollDraw,
|
5159 |
-
"sName": "scrolling"
|
5160 |
-
} );
|
5161 |
-
|
5162 |
-
return scroller[0];
|
5163 |
-
}
|
5164 |
-
|
5165 |
-
|
5166 |
-
|
5167 |
-
/**
|
5168 |
-
* Update the header, footer and body tables for resizing - i.e. column
|
5169 |
-
* alignment.
|
5170 |
-
*
|
5171 |
-
* Welcome to the most horrible function WFDataTables. The process that this
|
5172 |
-
* function follows is basically:
|
5173 |
-
* 1. Re-create the table inside the scrolling div
|
5174 |
-
* 2. Take live measurements from the DOM
|
5175 |
-
* 3. Apply the measurements to align the columns
|
5176 |
-
* 4. Clean up
|
5177 |
-
*
|
5178 |
-
* @param {object} settings dataTables settings object
|
5179 |
-
* @memberof WFDataTable#oApi
|
5180 |
-
*/
|
5181 |
-
function _fnScrollDraw ( settings )
|
5182 |
-
{
|
5183 |
-
// Given that this is such a monster function, a lot of variables are use
|
5184 |
-
// to try and keep the minimised size as small as possible
|
5185 |
-
var
|
5186 |
-
scroll = settings.oScroll,
|
5187 |
-
scrollX = scroll.sX,
|
5188 |
-
scrollXInner = scroll.sXInner,
|
5189 |
-
scrollY = scroll.sY,
|
5190 |
-
barWidth = scroll.iBarWidth,
|
5191 |
-
divHeader = $(settings.nScrollHead),
|
5192 |
-
divHeaderStyle = divHeader[0].style,
|
5193 |
-
divHeaderInner = divHeader.children('div'),
|
5194 |
-
divHeaderInnerStyle = divHeaderInner[0].style,
|
5195 |
-
divHeaderTable = divHeaderInner.children('table'),
|
5196 |
-
divBodyEl = settings.nScrollBody,
|
5197 |
-
divBody = $(divBodyEl),
|
5198 |
-
divBodyStyle = divBodyEl.style,
|
5199 |
-
divFooter = $(settings.nScrollFoot),
|
5200 |
-
divFooterInner = divFooter.children('div'),
|
5201 |
-
divFooterTable = divFooterInner.children('table'),
|
5202 |
-
header = $(settings.nTHead),
|
5203 |
-
table = $(settings.nTable),
|
5204 |
-
tableEl = table[0],
|
5205 |
-
tableStyle = tableEl.style,
|
5206 |
-
footer = settings.nTFoot ? $(settings.nTFoot) : null,
|
5207 |
-
browser = settings.oBrowser,
|
5208 |
-
ie67 = browser.bScrollOversize,
|
5209 |
-
dtHeaderCells = _pluck( settings.aoColumns, 'nTh' ),
|
5210 |
-
headerTrgEls, footerTrgEls,
|
5211 |
-
headerSrcEls, footerSrcEls,
|
5212 |
-
headerCopy, footerCopy,
|
5213 |
-
headerWidths=[], footerWidths=[],
|
5214 |
-
headerContent=[], footerContent=[],
|
5215 |
-
idx, correction, sanityWidth,
|
5216 |
-
zeroOut = function(nSizer) {
|
5217 |
-
var style = nSizer.style;
|
5218 |
-
style.paddingTop = "0";
|
5219 |
-
style.paddingBottom = "0";
|
5220 |
-
style.borderTopWidth = "0";
|
5221 |
-
style.borderBottomWidth = "0";
|
5222 |
-
style.height = 0;
|
5223 |
-
};
|
5224 |
-
|
5225 |
-
// If the scrollbar visibility has changed from the last draw, we need to
|
5226 |
-
// adjust the column sizes as the table width will have changed to account
|
5227 |
-
// for the scrollbar
|
5228 |
-
var scrollBarVis = divBodyEl.scrollHeight > divBodyEl.clientHeight;
|
5229 |
-
|
5230 |
-
if ( settings.scrollBarVis !== scrollBarVis && settings.scrollBarVis !== undefined ) {
|
5231 |
-
settings.scrollBarVis = scrollBarVis;
|
5232 |
-
_fnAdjustColumnSizing( settings );
|
5233 |
-
return; // adjust column sizing will call this function again
|
5234 |
-
}
|
5235 |
-
else {
|
5236 |
-
settings.scrollBarVis = scrollBarVis;
|
5237 |
-
}
|
5238 |
-
|
5239 |
-
/*
|
5240 |
-
* 1. Re-create the table inside the scrolling div
|
5241 |
-
*/
|
5242 |
-
|
5243 |
-
// Remove the old minimised thead and tfoot elements in the inner table
|
5244 |
-
table.children('thead, tfoot').remove();
|
5245 |
-
|
5246 |
-
if ( footer ) {
|
5247 |
-
footerCopy = footer.clone().prependTo( table );
|
5248 |
-
footerTrgEls = footer.find('tr'); // the original tfoot is in its own table and must be sized
|
5249 |
-
footerSrcEls = footerCopy.find('tr');
|
5250 |
-
}
|
5251 |
-
|
5252 |
-
// Clone the current header and footer elements and then place it into the inner table
|
5253 |
-
headerCopy = header.clone().prependTo( table );
|
5254 |
-
headerTrgEls = header.find('tr'); // original header is in its own table
|
5255 |
-
headerSrcEls = headerCopy.find('tr');
|
5256 |
-
headerCopy.find('th, td').removeAttr('tabindex');
|
5257 |
-
|
5258 |
-
|
5259 |
-
/*
|
5260 |
-
* 2. Take live measurements from the DOM - do not alter the DOM itself!
|
5261 |
-
*/
|
5262 |
-
|
5263 |
-
// Remove old sizing and apply the calculated column widths
|
5264 |
-
// Get the unique column headers in the newly created (cloned) header. We want to apply the
|
5265 |
-
// calculated sizes to this header
|
5266 |
-
if ( ! scrollX )
|
5267 |
-
{
|
5268 |
-
divBodyStyle.width = '100%';
|
5269 |
-
divHeader[0].style.width = '100%';
|
5270 |
-
}
|
5271 |
-
|
5272 |
-
$.each( _fnGetUniqueThs( settings, headerCopy ), function ( i, el ) {
|
5273 |
-
idx = _fnVisibleToColumnIndex( settings, i );
|
5274 |
-
el.style.width = settings.aoColumns[idx].sWidth;
|
5275 |
-
} );
|
5276 |
-
|
5277 |
-
if ( footer ) {
|
5278 |
-
_fnApplyToChildren( function(n) {
|
5279 |
-
n.style.width = "";
|
5280 |
-
}, footerSrcEls );
|
5281 |
-
}
|
5282 |
-
|
5283 |
-
// Size the table as a whole
|
5284 |
-
sanityWidth = table.outerWidth();
|
5285 |
-
if ( scrollX === "" ) {
|
5286 |
-
// No x scrolling
|
5287 |
-
tableStyle.width = "100%";
|
5288 |
-
|
5289 |
-
// IE7 will make the width of the table when 100% include the scrollbar
|
5290 |
-
// - which is shouldn't. When there is a scrollbar we need to take this
|
5291 |
-
// into account.
|
5292 |
-
if ( ie67 && (table.find('tbody').height() > divBodyEl.offsetHeight ||
|
5293 |
-
divBody.css('overflow-y') == "scroll")
|
5294 |
-
) {
|
5295 |
-
tableStyle.width = _fnStringToCss( table.outerWidth() - barWidth);
|
5296 |
-
}
|
5297 |
-
|
5298 |
-
// Recalculate the sanity width
|
5299 |
-
sanityWidth = table.outerWidth();
|
5300 |
-
}
|
5301 |
-
else if ( scrollXInner !== "" ) {
|
5302 |
-
// legacy x scroll inner has been given - use it
|
5303 |
-
tableStyle.width = _fnStringToCss(scrollXInner);
|
5304 |
-
|
5305 |
-
// Recalculate the sanity width
|
5306 |
-
sanityWidth = table.outerWidth();
|
5307 |
-
}
|
5308 |
-
|
5309 |
-
// Hidden header should have zero height, so remove padding and borders. Then
|
5310 |
-
// set the width based on the real headers
|
5311 |
-
|
5312 |
-
// Apply all styles in one pass
|
5313 |
-
_fnApplyToChildren( zeroOut, headerSrcEls );
|
5314 |
-
|
5315 |
-
// Read all widths in next pass
|
5316 |
-
_fnApplyToChildren( function(nSizer) {
|
5317 |
-
headerContent.push( nSizer.innerHTML );
|
5318 |
-
headerWidths.push( _fnStringToCss( $(nSizer).css('width') ) );
|
5319 |
-
}, headerSrcEls );
|
5320 |
-
|
5321 |
-
// Apply all widths in final pass
|
5322 |
-
_fnApplyToChildren( function(nToSize, i) {
|
5323 |
-
// Only apply widths to the WFDataTables detected header cells - this
|
5324 |
-
// prevents complex headers from having contradictory sizes applied
|
5325 |
-
if ( $.inArray( nToSize, dtHeaderCells ) !== -1 ) {
|
5326 |
-
nToSize.style.width = headerWidths[i];
|
5327 |
-
}
|
5328 |
-
}, headerTrgEls );
|
5329 |
-
|
5330 |
-
$(headerSrcEls).height(0);
|
5331 |
-
|
5332 |
-
/* Same again with the footer if we have one */
|
5333 |
-
if ( footer )
|
5334 |
-
{
|
5335 |
-
_fnApplyToChildren( zeroOut, footerSrcEls );
|
5336 |
-
|
5337 |
-
_fnApplyToChildren( function(nSizer) {
|
5338 |
-
footerContent.push( nSizer.innerHTML );
|
5339 |
-
footerWidths.push( _fnStringToCss( $(nSizer).css('width') ) );
|
5340 |
-
}, footerSrcEls );
|
5341 |
-
|
5342 |
-
_fnApplyToChildren( function(nToSize, i) {
|
5343 |
-
nToSize.style.width = footerWidths[i];
|
5344 |
-
}, footerTrgEls );
|
5345 |
-
|
5346 |
-
$(footerSrcEls).height(0);
|
5347 |
-
}
|
5348 |
-
|
5349 |
-
|
5350 |
-
/*
|
5351 |
-
* 3. Apply the measurements
|
5352 |
-
*/
|
5353 |
-
|
5354 |
-
// "Hide" the header and footer that we used for the sizing. We need to keep
|
5355 |
-
// the content of the cell so that the width applied to the header and body
|
5356 |
-
// both match, but we want to hide it completely. We want to also fix their
|
5357 |
-
// width to what they currently are
|
5358 |
-
_fnApplyToChildren( function(nSizer, i) {
|
5359 |
-
nSizer.innerHTML = '<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+headerContent[i]+'</div>';
|
5360 |
-
nSizer.style.width = headerWidths[i];
|
5361 |
-
}, headerSrcEls );
|
5362 |
-
|
5363 |
-
if ( footer )
|
5364 |
-
{
|
5365 |
-
_fnApplyToChildren( function(nSizer, i) {
|
5366 |
-
nSizer.innerHTML = '<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+footerContent[i]+'</div>';
|
5367 |
-
nSizer.style.width = footerWidths[i];
|
5368 |
-
}, footerSrcEls );
|
5369 |
-
}
|
5370 |
-
|
5371 |
-
// Sanity check that the table is of a sensible width. If not then we are going to get
|
5372 |
-
// misalignment - try to prevent this by not allowing the table to shrink below its min width
|
5373 |
-
if ( table.outerWidth() < sanityWidth )
|
5374 |
-
{
|
5375 |
-
// The min width depends upon if we have a vertical scrollbar visible or not */
|
5376 |
-
correction = ((divBodyEl.scrollHeight > divBodyEl.offsetHeight ||
|
5377 |
-
divBody.css('overflow-y') == "scroll")) ?
|
5378 |
-
sanityWidth+barWidth :
|
5379 |
-
sanityWidth;
|
5380 |
-
|
5381 |
-
// IE6/7 are a law unto themselves...
|
5382 |
-
if ( ie67 && (divBodyEl.scrollHeight >
|
5383 |
-
divBodyEl.offsetHeight || divBody.css('overflow-y') == "scroll")
|
5384 |
-
) {
|
5385 |
-
tableStyle.width = _fnStringToCss( correction-barWidth );
|
5386 |
-
}
|
5387 |
-
|
5388 |
-
// And give the user a warning that we've stopped the table getting too small
|
5389 |
-
if ( scrollX === "" || scrollXInner !== "" ) {
|
5390 |
-
_fnLog( settings, 1, 'Possible column misalignment', 6 );
|
5391 |
-
}
|
5392 |
-
}
|
5393 |
-
else
|
5394 |
-
{
|
5395 |
-
correction = '100%';
|
5396 |
-
}
|
5397 |
-
|
5398 |
-
// Apply to the container elements
|
5399 |
-
divBodyStyle.width = _fnStringToCss( correction );
|
5400 |
-
divHeaderStyle.width = _fnStringToCss( correction );
|
5401 |
-
|
5402 |
-
if ( footer ) {
|
5403 |
-
settings.nScrollFoot.style.width = _fnStringToCss( correction );
|
5404 |
-
}
|
5405 |
-
|
5406 |
-
|
5407 |
-
/*
|
5408 |
-
* 4. Clean up
|
5409 |
-
*/
|
5410 |
-
if ( ! scrollY ) {
|
5411 |
-
/* IE7< puts a vertical scrollbar in place (when it shouldn't be) due to subtracting
|
5412 |
-
* the scrollbar height from the visible display, rather than adding it on. We need to
|
5413 |
-
* set the height in order to sort this. Don't want to do it in any other browsers.
|
5414 |
-
*/
|
5415 |
-
if ( ie67 ) {
|
5416 |
-
divBodyStyle.height = _fnStringToCss( tableEl.offsetHeight+barWidth );
|
5417 |
-
}
|
5418 |
-
}
|
5419 |
-
|
5420 |
-
/* Finally set the width's of the header and footer tables */
|
5421 |
-
var iOuterWidth = table.outerWidth();
|
5422 |
-
divHeaderTable[0].style.width = _fnStringToCss( iOuterWidth );
|
5423 |
-
divHeaderInnerStyle.width = _fnStringToCss( iOuterWidth );
|
5424 |
-
|
5425 |
-
// Figure out if there are scrollbar present - if so then we need a the header and footer to
|
5426 |
-
// provide a bit more space to allow "overflow" scrolling (i.e. past the scrollbar)
|
5427 |
-
var bScrolling = table.height() > divBodyEl.clientHeight || divBody.css('overflow-y') == "scroll";
|
5428 |
-
var padding = 'padding' + (browser.bScrollbarLeft ? 'Left' : 'Right' );
|
5429 |
-
divHeaderInnerStyle[ padding ] = bScrolling ? barWidth+"px" : "0px";
|
5430 |
-
|
5431 |
-
if ( footer ) {
|
5432 |
-
divFooterTable[0].style.width = _fnStringToCss( iOuterWidth );
|
5433 |
-
divFooterInner[0].style.width = _fnStringToCss( iOuterWidth );
|
5434 |
-
divFooterInner[0].style[padding] = bScrolling ? barWidth+"px" : "0px";
|
5435 |
-
}
|
5436 |
-
|
5437 |
-
// Correct DOM ordering for colgroup - comes before the thead
|
5438 |
-
table.children('colgroup').insertBefore( table.children('thead') );
|
5439 |
-
|
5440 |
-
/* Adjust the position of the header in case we loose the y-scrollbar */
|
5441 |
-
divBody.scroll();
|
5442 |
-
|
5443 |
-
// If sorting or filtering has occurred, jump the scrolling back to the top
|
5444 |
-
// only if we aren't holding the position
|
5445 |
-
if ( (settings.bSorted || settings.bFiltered) && ! settings._drawHold ) {
|
5446 |
-
divBodyEl.scrollTop = 0;
|
5447 |
-
}
|
5448 |
-
}
|
5449 |
-
|
5450 |
-
|
5451 |
-
|
5452 |
-
/**
|
5453 |
-
* Apply a given function to the display child nodes of an element array (typically
|
5454 |
-
* TD children of TR rows
|
5455 |
-
* @param {function} fn Method to apply to the objects
|
5456 |
-
* @param array {nodes} an1 List of elements to look through for display children
|
5457 |
-
* @param array {nodes} an2 Another list (identical structure to the first) - optional
|
5458 |
-
* @memberof WFDataTable#oApi
|
5459 |
-
*/
|
5460 |
-
function _fnApplyToChildren( fn, an1, an2 )
|
5461 |
-
{
|
5462 |
-
var index=0, i=0, iLen=an1.length;
|
5463 |
-
var nNode1, nNode2;
|
5464 |
-
|
5465 |
-
while ( i < iLen ) {
|
5466 |
-
nNode1 = an1[i].firstChild;
|
5467 |
-
nNode2 = an2 ? an2[i].firstChild : null;
|
5468 |
-
|
5469 |
-
while ( nNode1 ) {
|
5470 |
-
if ( nNode1.nodeType === 1 ) {
|
5471 |
-
if ( an2 ) {
|
5472 |
-
fn( nNode1, nNode2, index );
|
5473 |
-
}
|
5474 |
-
else {
|
5475 |
-
fn( nNode1, index );
|
5476 |
-
}
|
5477 |
-
|
5478 |
-
index++;
|
5479 |
-
}
|
5480 |
-
|
5481 |
-
nNode1 = nNode1.nextSibling;
|
5482 |
-
nNode2 = an2 ? nNode2.nextSibling : null;
|
5483 |
-
}
|
5484 |
-
|
5485 |
-
i++;
|
5486 |
-
}
|
5487 |
-
}
|
5488 |
-
|
5489 |
-
|
5490 |
-
|
5491 |
-
var __re_html_remove = /<.*?>/g;
|
5492 |
-
|
5493 |
-
|
5494 |
-
/**
|
5495 |
-
* Calculate the width of columns for the table
|
5496 |
-
* @param {object} oSettings dataTables settings object
|
5497 |
-
* @memberof WFDataTable#oApi
|
5498 |
-
*/
|
5499 |
-
function _fnCalculateColumnWidths ( oSettings )
|
5500 |
-
{
|
5501 |
-
var
|
5502 |
-
table = oSettings.nTable,
|
5503 |
-
columns = oSettings.aoColumns,
|
5504 |
-
scroll = oSettings.oScroll,
|
5505 |
-
scrollY = scroll.sY,
|
5506 |
-
scrollX = scroll.sX,
|
5507 |
-
scrollXInner = scroll.sXInner,
|
5508 |
-
columnCount = columns.length,
|
5509 |
-
visibleColumns = _fnGetColumns( oSettings, 'bVisible' ),
|
5510 |
-
headerCells = $('th', oSettings.nTHead),
|
5511 |
-
tableWidthAttr = table.getAttribute('width'), // from DOM element
|
5512 |
-
tableContainer = table.parentNode,
|
5513 |
-
userInputs = false,
|
5514 |
-
i, column, columnIdx, width, outerWidth,
|
5515 |
-
browser = oSettings.oBrowser,
|
5516 |
-
ie67 = browser.bScrollOversize;
|
5517 |
-
|
5518 |
-
var styleWidth = table.style.width;
|
5519 |
-
if ( styleWidth && styleWidth.indexOf('%') !== -1 ) {
|
5520 |
-
tableWidthAttr = styleWidth;
|
5521 |
-
}
|
5522 |
-
|
5523 |
-
/* Convert any user input sizes into pixel sizes */
|
5524 |
-
for ( i=0 ; i<visibleColumns.length ; i++ ) {
|
5525 |
-
column = columns[ visibleColumns[i] ];
|
5526 |
-
|
5527 |
-
if ( column.sWidth !== null ) {
|
5528 |
-
column.sWidth = _fnConvertToWidth( column.sWidthOrig, tableContainer );
|
5529 |
-
|
5530 |
-
userInputs = true;
|
5531 |
-
}
|
5532 |
-
}
|
5533 |
-
|
5534 |
-
/* If the number of columns in the DOM equals the number that we have to
|
5535 |
-
* process in WFDataTables, then we can use the offsets that are created by
|
5536 |
-
* the web- browser. No custom sizes can be set in order for this to happen,
|
5537 |
-
* nor scrolling used
|
5538 |
-
*/
|
5539 |
-
if ( ie67 || ! userInputs && ! scrollX && ! scrollY &&
|
5540 |
-
columnCount == _fnVisbleColumns( oSettings ) &&
|
5541 |
-
columnCount == headerCells.length
|
5542 |
-
) {
|
5543 |
-
for ( i=0 ; i<columnCount ; i++ ) {
|
5544 |
-
var colIdx = _fnVisibleToColumnIndex( oSettings, i );
|
5545 |
-
|
5546 |
-
if ( colIdx !== null ) {
|
5547 |
-
columns[ colIdx ].sWidth = _fnStringToCss( headerCells.eq(i).width() );
|
5548 |
-
}
|
5549 |
-
}
|
5550 |
-
}
|
5551 |
-
else
|
5552 |
-
{
|
5553 |
-
// Otherwise construct a single row, worst case, table with the widest
|
5554 |
-
// node in the data, assign any user defined widths, then insert it into
|
5555 |
-
// the DOM and allow the browser to do all the hard work of calculating
|
5556 |
-
// table widths
|
5557 |
-
var tmpTable = $(table).clone() // don't use cloneNode - IE8 will remove events on the main table
|
5558 |
-
.css( 'visibility', 'hidden' )
|
5559 |
-
.removeAttr( 'id' );
|
5560 |
-
|
5561 |
-
// Clean up the table body
|
5562 |
-
tmpTable.find('tbody tr').remove();
|
5563 |
-
var tr = $('<tr/>').appendTo( tmpTable.find('tbody') );
|
5564 |
-
|
5565 |
-
// Clone the table header and footer - we can't use the header / footer
|
5566 |
-
// from the cloned table, since if scrolling is active, the table's
|
5567 |
-
// real header and footer are contained in different table tags
|
5568 |
-
tmpTable.find('thead, tfoot').remove();
|
5569 |
-
tmpTable
|
5570 |
-
.append( $(oSettings.nTHead).clone() )
|
5571 |
-
.append( $(oSettings.nTFoot).clone() );
|
5572 |
-
|
5573 |
-
// Remove any assigned widths from the footer (from scrolling)
|
5574 |
-
tmpTable.find('tfoot th, tfoot td').css('width', '');
|
5575 |
-
|
5576 |
-
// Apply custom sizing to the cloned header
|
5577 |
-
headerCells = _fnGetUniqueThs( oSettings, tmpTable.find('thead')[0] );
|
5578 |
-
|
5579 |
-
for ( i=0 ; i<visibleColumns.length ; i++ ) {
|
5580 |
-
column = columns[ visibleColumns[i] ];
|
5581 |
-
|
5582 |
-
headerCells[i].style.width = column.sWidthOrig !== null && column.sWidthOrig !== '' ?
|
5583 |
-
_fnStringToCss( column.sWidthOrig ) :
|
5584 |
-
'';
|
5585 |
-
|
5586 |
-
// For scrollX we need to force the column width otherwise the
|
5587 |
-
// browser will collapse it. If this width is smaller than the
|
5588 |
-
// width the column requires, then it will have no effect
|
5589 |
-
if ( column.sWidthOrig && scrollX ) {
|
5590 |
-
$( headerCells[i] ).append( $('<div/>').css( {
|
5591 |
-
width: column.sWidthOrig,
|
5592 |
-
margin: 0,
|
5593 |
-
padding: 0,
|
5594 |
-
border: 0,
|
5595 |
-
height: 1
|
5596 |
-
} ) );
|
5597 |
-
}
|
5598 |
-
}
|
5599 |
-
|
5600 |
-
// Find the widest cell for each column and put it into the table
|
5601 |
-
if ( oSettings.aoData.length ) {
|
5602 |
-
for ( i=0 ; i<visibleColumns.length ; i++ ) {
|
5603 |
-
columnIdx = visibleColumns[i];
|
5604 |
-
column = columns[ columnIdx ];
|
5605 |
-
|
5606 |
-
$( _fnGetWidestNode( oSettings, columnIdx ) )
|
5607 |
-
.clone( false )
|
5608 |
-
.append( column.sContentPadding )
|
5609 |
-
.appendTo( tr );
|
5610 |
-
}
|
5611 |
-
}
|
5612 |
-
|
5613 |
-
// Tidy the temporary table - remove name attributes so there aren't
|
5614 |
-
// duplicated in the dom (radio elements for example)
|
5615 |
-
$('[name]', tmpTable).removeAttr('name');
|
5616 |
-
|
5617 |
-
// Table has been built, attach to the document so we can work with it.
|
5618 |
-
// A holding element is used, positioned at the top of the container
|
5619 |
-
// with minimal height, so it has no effect on if the container scrolls
|
5620 |
-
// or not. Otherwise it might trigger scrolling when it actually isn't
|
5621 |
-
// needed
|
5622 |
-
var holder = $('<div/>').css( scrollX || scrollY ?
|
5623 |
-
{
|
5624 |
-
position: 'absolute',
|
5625 |
-
top: 0,
|
5626 |
-
left: 0,
|
5627 |
-
height: 1,
|
5628 |
-
right: 0,
|
5629 |
-
overflow: 'hidden'
|
5630 |
-
} :
|
5631 |
-
{}
|
5632 |
-
)
|
5633 |
-
.append( tmpTable )
|
5634 |
-
.appendTo( tableContainer );
|
5635 |
-
|
5636 |
-
// When scrolling (X or Y) we want to set the width of the table as
|
5637 |
-
// appropriate. However, when not scrolling leave the table width as it
|
5638 |
-
// is. This results in slightly different, but I think correct behaviour
|
5639 |
-
if ( scrollX && scrollXInner ) {
|
5640 |
-
tmpTable.width( scrollXInner );
|
5641 |
-
}
|
5642 |
-
else if ( scrollX ) {
|
5643 |
-
tmpTable.css( 'width', 'auto' );
|
5644 |
-
tmpTable.removeAttr('width');
|
5645 |
-
|
5646 |
-
// If there is no width attribute or style, then allow the table to
|
5647 |
-
// collapse
|
5648 |
-
if ( tmpTable.width() < tableContainer.clientWidth && tableWidthAttr ) {
|
5649 |
-
tmpTable.width( tableContainer.clientWidth );
|
5650 |
-
}
|
5651 |
-
}
|
5652 |
-
else if ( scrollY ) {
|
5653 |
-
tmpTable.width( tableContainer.clientWidth );
|
5654 |
-
}
|
5655 |
-
else if ( tableWidthAttr ) {
|
5656 |
-
tmpTable.width( tableWidthAttr );
|
5657 |
-
}
|
5658 |
-
|
5659 |
-
// Get the width of each column in the constructed table - we need to
|
5660 |
-
// know the inner width (so it can be assigned to the other table's
|
5661 |
-
// cells) and the outer width so we can calculate the full width of the
|
5662 |
-
// table. This is safe since WFDataTables requires a unique cell for each
|
5663 |
-
// column, but if ever a header can span multiple columns, this will
|
5664 |
-
// need to be modified.
|
5665 |
-
var total = 0;
|
5666 |
-
for ( i=0 ; i<visibleColumns.length ; i++ ) {
|
5667 |
-
var cell = $(headerCells[i]);
|
5668 |
-
var border = cell.outerWidth() - cell.width();
|
5669 |
-
|
5670 |
-
// Use getBounding... where possible (not IE8-) because it can give
|
5671 |
-
// sub-pixel accuracy, which we then want to round up!
|
5672 |
-
var bounding = browser.bBounding ?
|
5673 |
-
Math.ceil( headerCells[i].getBoundingClientRect().width ) :
|
5674 |
-
cell.outerWidth();
|
5675 |
-
|
5676 |
-
// Total is tracked to remove any sub-pixel errors as the outerWidth
|
5677 |
-
// of the table might not equal the total given here (IE!).
|
5678 |
-
total += bounding;
|
5679 |
-
|
5680 |
-
// Width for each column to use
|
5681 |
-
columns[ visibleColumns[i] ].sWidth = _fnStringToCss( bounding - border );
|
5682 |
-
}
|
5683 |
-
|
5684 |
-
table.style.width = _fnStringToCss( total );
|
5685 |
-
|
5686 |
-
// Finished with the table - ditch it
|
5687 |
-
holder.remove();
|
5688 |
-
}
|
5689 |
-
|
5690 |
-
// If there is a width attr, we want to attach an event listener which
|
5691 |
-
// allows the table sizing to automatically adjust when the window is
|
5692 |
-
// resized. Use the width attr rather than CSS, since we can't know if the
|
5693 |
-
// CSS is a relative value or absolute - DOM read is always px.
|
5694 |
-
if ( tableWidthAttr ) {
|
5695 |
-
table.style.width = _fnStringToCss( tableWidthAttr );
|
5696 |
-
}
|
5697 |
-
|
5698 |
-
if ( (tableWidthAttr || scrollX) && ! oSettings._reszEvt ) {
|
5699 |
-
var bindResize = function () {
|
5700 |
-
$(window).on('resize.DT-'+oSettings.sInstance, _fnThrottle( function () {
|
5701 |
-
_fnAdjustColumnSizing( oSettings );
|
5702 |
-
} ) );
|
5703 |
-
};
|
5704 |
-
|
5705 |
-
// IE6/7 will crash if we bind a resize event handler on page load.
|
5706 |
-
// To be removed in 1.11 which drops IE6/7 support
|
5707 |
-
if ( ie67 ) {
|
5708 |
-
setTimeout( bindResize, 1000 );
|
5709 |
-
}
|
5710 |
-
else {
|
5711 |
-
bindResize();
|
5712 |
-
}
|
5713 |
-
|
5714 |
-
oSettings._reszEvt = true;
|
5715 |
-
}
|
5716 |
-
}
|
5717 |
-
|
5718 |
-
|
5719 |
-
/**
|
5720 |
-
* Throttle the calls to a function. Arguments and context are maintained for
|
5721 |
-
* the throttled function
|
5722 |
-
* @param {function} fn Function to be called
|
5723 |
-
* @param {int} [freq=200] call frequency in mS
|
5724 |
-
* @returns {function} wrapped function
|
5725 |
-
* @memberof WFDataTable#oApi
|
5726 |
-
*/
|
5727 |
-
var _fnThrottle = WFDataTable.util.throttle;
|
5728 |
-
|
5729 |
-
|
5730 |
-
/**
|
5731 |
-
* Convert a CSS unit width to pixels (e.g. 2em)
|
5732 |
-
* @param {string} width width to be converted
|
5733 |
-
* @param {node} parent parent to get the with for (required for relative widths) - optional
|
5734 |
-
* @returns {int} width in pixels
|
5735 |
-
* @memberof WFDataTable#oApi
|
5736 |
-
*/
|
5737 |
-
function _fnConvertToWidth ( width, parent )
|
5738 |
-
{
|
5739 |
-
if ( ! width ) {
|
5740 |
-
return 0;
|
5741 |
-
}
|
5742 |
-
|
5743 |
-
var n = $('<div/>')
|
5744 |
-
.css( 'width', _fnStringToCss( width ) )
|
5745 |
-
.appendTo( parent || document.body );
|
5746 |
-
|
5747 |
-
var val = n[0].offsetWidth;
|
5748 |
-
n.remove();
|
5749 |
-
|
5750 |
-
return val;
|
5751 |
-
}
|
5752 |
-
|
5753 |
-
|
5754 |
-
/**
|
5755 |
-
* Get the widest node
|
5756 |
-
* @param {object} settings dataTables settings object
|
5757 |
-
* @param {int} colIdx column of interest
|
5758 |
-
* @returns {node} widest table node
|
5759 |
-
* @memberof WFDataTable#oApi
|
5760 |
-
*/
|
5761 |
-
function _fnGetWidestNode( settings, colIdx )
|
5762 |
-
{
|
5763 |
-
var idx = _fnGetMaxLenString( settings, colIdx );
|
5764 |
-
if ( idx < 0 ) {
|
5765 |
-
return null;
|
5766 |
-
}
|
5767 |
-
|
5768 |
-
var data = settings.aoData[ idx ];
|
5769 |
-
return ! data.nTr ? // Might not have been created when deferred rendering
|
5770 |
-
$('<td/>').html( _fnGetCellData( settings, idx, colIdx, 'display' ) )[0] :
|
5771 |
-
data.anCells[ colIdx ];
|
5772 |
-
}
|
5773 |
-
|
5774 |
-
|
5775 |
-
/**
|
5776 |
-
* Get the maximum strlen for each data column
|
5777 |
-
* @param {object} settings dataTables settings object
|
5778 |
-
* @param {int} colIdx column of interest
|
5779 |
-
* @returns {string} max string length for each column
|
5780 |
-
* @memberof WFDataTable#oApi
|
5781 |
-
*/
|
5782 |
-
function _fnGetMaxLenString( settings, colIdx )
|
5783 |
-
{
|
5784 |
-
var s, max=-1, maxIdx = -1;
|
5785 |
-
|
5786 |
-
for ( var i=0, ien=settings.aoData.length ; i<ien ; i++ ) {
|
5787 |
-
s = _fnGetCellData( settings, i, colIdx, 'display' )+'';
|
5788 |
-
s = s.replace( __re_html_remove, '' );
|
5789 |
-
s = s.replace( / /g, ' ' );
|
5790 |
-
|
5791 |
-
if ( s.length > max ) {
|
5792 |
-
max = s.length;
|
5793 |
-
maxIdx = i;
|
5794 |
-
}
|
5795 |
-
}
|
5796 |
-
|
5797 |
-
return maxIdx;
|
5798 |
-
}
|
5799 |
-
|
5800 |
-
|
5801 |
-
/**
|
5802 |
-
* Append a CSS unit (only if required) to a string
|
5803 |
-
* @param {string} value to css-ify
|
5804 |
-
* @returns {string} value with css unit
|
5805 |
-
* @memberof WFDataTable#oApi
|
5806 |
-
*/
|
5807 |
-
function _fnStringToCss( s )
|
5808 |
-
{
|
5809 |
-
if ( s === null ) {
|
5810 |
-
return '0px';
|
5811 |
-
}
|
5812 |
-
|
5813 |
-
if ( typeof s == 'number' ) {
|
5814 |
-
return s < 0 ?
|
5815 |
-
'0px' :
|
5816 |
-
s+'px';
|
5817 |
-
}
|
5818 |
-
|
5819 |
-
// Check it has a unit character already
|
5820 |
-
return s.match(/\d$/) ?
|
5821 |
-
s+'px' :
|
5822 |
-
s;
|
5823 |
-
}
|
5824 |
-
|
5825 |
-
|
5826 |
-
|
5827 |
-
function _fnSortFlatten ( settings )
|
5828 |
-
{
|
5829 |
-
var
|
5830 |
-
i, iLen, k, kLen,
|
5831 |
-
aSort = [],
|
5832 |
-
aiOrig = [],
|
5833 |
-
aoColumns = settings.aoColumns,
|
5834 |
-
aDataSort, iCol, sType, srcCol,
|
5835 |
-
fixed = settings.aaSortingFixed,
|
5836 |
-
fixedObj = $.isPlainObject( fixed ),
|
5837 |
-
nestedSort = [],
|
5838 |
-
add = function ( a ) {
|
5839 |
-
if ( a.length && ! $.isArray( a[0] ) ) {
|
5840 |
-
// 1D array
|
5841 |
-
nestedSort.push( a );
|
5842 |
-
}
|
5843 |
-
else {
|
5844 |
-
// 2D array
|
5845 |
-
$.merge( nestedSort, a );
|
5846 |
-
}
|
5847 |
-
};
|
5848 |
-
|
5849 |
-
// Build the sort array, with pre-fix and post-fix options if they have been
|
5850 |
-
// specified
|
5851 |
-
if ( $.isArray( fixed ) ) {
|
5852 |
-
add( fixed );
|
5853 |
-
}
|
5854 |
-
|
5855 |
-
if ( fixedObj && fixed.pre ) {
|
5856 |
-
add( fixed.pre );
|
5857 |
-
}
|
5858 |
-
|
5859 |
-
add( settings.aaSorting );
|
5860 |
-
|
5861 |
-
if (fixedObj && fixed.post ) {
|
5862 |
-
add( fixed.post );
|
5863 |
-
}
|
5864 |
-
|
5865 |
-
for ( i=0 ; i<nestedSort.length ; i++ )
|
5866 |
-
{
|
5867 |
-
srcCol = nestedSort[i][0];
|
5868 |
-
aDataSort = aoColumns[ srcCol ].aDataSort;
|
5869 |
-
|
5870 |
-
for ( k=0, kLen=aDataSort.length ; k<kLen ; k++ )
|
5871 |
-
{
|
5872 |
-
iCol = aDataSort[k];
|
5873 |
-
sType = aoColumns[ iCol ].sType || 'string';
|
5874 |
-
|
5875 |
-
if ( nestedSort[i]._idx === undefined ) {
|
5876 |
-
nestedSort[i]._idx = $.inArray( nestedSort[i][1], aoColumns[iCol].asSorting );
|
5877 |
-
}
|
5878 |
-
|
5879 |
-
aSort.push( {
|
5880 |
-
src: srcCol,
|
5881 |
-
col: iCol,
|
5882 |
-
dir: nestedSort[i][1],
|
5883 |
-
index: nestedSort[i]._idx,
|
5884 |
-
type: sType,
|
5885 |
-
formatter: WFDataTable.ext.type.order[ sType+"-pre" ]
|
5886 |
-
} );
|
5887 |
-
}
|
5888 |
-
}
|
5889 |
-
|
5890 |
-
return aSort;
|
5891 |
-
}
|
5892 |
-
|
5893 |
-
/**
|
5894 |
-
* Change the order of the table
|
5895 |
-
* @param {object} oSettings dataTables settings object
|
5896 |
-
* @memberof WFDataTable#oApi
|
5897 |
-
* @todo This really needs split up!
|
5898 |
-
*/
|
5899 |
-
function _fnSort ( oSettings )
|
5900 |
-
{
|
5901 |
-
var
|
5902 |
-
i, ien, iLen, j, jLen, k, kLen,
|
5903 |
-
sDataType, nTh,
|
5904 |
-
aiOrig = [],
|
5905 |
-
oExtSort = WFDataTable.ext.type.order,
|
5906 |
-
aoData = oSettings.aoData,
|
5907 |
-
aoColumns = oSettings.aoColumns,
|
5908 |
-
aDataSort, data, iCol, sType, oSort,
|
5909 |
-
formatters = 0,
|
5910 |
-
sortCol,
|
5911 |
-
displayMaster = oSettings.aiDisplayMaster,
|
5912 |
-
aSort;
|
5913 |
-
|
5914 |
-
// Resolve any column types that are unknown due to addition or invalidation
|
5915 |
-
// @todo Can this be moved into a 'data-ready' handler which is called when
|
5916 |
-
// data is going to be used in the table?
|
5917 |
-
_fnColumnTypes( oSettings );
|
5918 |
-
|
5919 |
-
aSort = _fnSortFlatten( oSettings );
|
5920 |
-
|
5921 |
-
for ( i=0, ien=aSort.length ; i<ien ; i++ ) {
|
5922 |
-
sortCol = aSort[i];
|
5923 |
-
|
5924 |
-
// Track if we can use the fast sort algorithm
|
5925 |
-
if ( sortCol.formatter ) {
|
5926 |
-
formatters++;
|
5927 |
-
}
|
5928 |
-
|
5929 |
-
// Load the data needed for the sort, for each cell
|
5930 |
-
_fnSortData( oSettings, sortCol.col );
|
5931 |
-
}
|
5932 |
-
|
5933 |
-
/* No sorting required if server-side or no sorting array */
|
5934 |
-
if ( _fnDataSource( oSettings ) != 'ssp' && aSort.length !== 0 )
|
5935 |
-
{
|
5936 |
-
// Create a value - key array of the current row positions such that we can use their
|
5937 |
-
// current position during the sort, if values match, in order to perform stable sorting
|
5938 |
-
for ( i=0, iLen=displayMaster.length ; i<iLen ; i++ ) {
|
5939 |
-
aiOrig[ displayMaster[i] ] = i;
|
5940 |
-
}
|
5941 |
-
|
5942 |
-
/* Do the sort - here we want multi-column sorting based on a given data source (column)
|
5943 |
-
* and sorting function (from oSort) in a certain direction. It's reasonably complex to
|
5944 |
-
* follow on it's own, but this is what we want (example two column sorting):
|
5945 |
-
* fnLocalSorting = function(a,b){
|
5946 |
-
* var iTest;
|
5947 |
-
* iTest = oSort['string-asc']('data11', 'data12');
|
5948 |
-
* if (iTest !== 0)
|
5949 |
-
* return iTest;
|
5950 |
-
* iTest = oSort['numeric-desc']('data21', 'data22');
|
5951 |
-
* if (iTest !== 0)
|
5952 |
-
* return iTest;
|
5953 |
-
* return oSort['numeric-asc']( aiOrig[a], aiOrig[b] );
|
5954 |
-
* }
|
5955 |
-
* Basically we have a test for each sorting column, if the data in that column is equal,
|
5956 |
-
* test the next column. If all columns match, then we use a numeric sort on the row
|
5957 |
-
* positions in the original data array to provide a stable sort.
|
5958 |
-
*
|
5959 |
-
* Note - I know it seems excessive to have two sorting methods, but the first is around
|
5960 |
-
* 15% faster, so the second is only maintained for backwards compatibility with sorting
|
5961 |
-
* methods which do not have a pre-sort formatting function.
|
5962 |
-
*/
|
5963 |
-
if ( formatters === aSort.length ) {
|
5964 |
-
// All sort types have formatting functions
|
5965 |
-
displayMaster.sort( function ( a, b ) {
|
5966 |
-
var
|
5967 |
-
x, y, k, test, sort,
|
5968 |
-
len=aSort.length,
|
5969 |
-
dataA = aoData[a]._aSortData,
|
5970 |
-
dataB = aoData[b]._aSortData;
|
5971 |
-
|
5972 |
-
for ( k=0 ; k<len ; k++ ) {
|
5973 |
-
sort = aSort[k];
|
5974 |
-
|
5975 |
-
x = dataA[ sort.col ];
|
5976 |
-
y = dataB[ sort.col ];
|
5977 |
-
|
5978 |
-
test = x<y ? -1 : x>y ? 1 : 0;
|
5979 |
-
if ( test !== 0 ) {
|
5980 |
-
return sort.dir === 'asc' ? test : -test;
|
5981 |
-
}
|
5982 |
-
}
|
5983 |
-
|
5984 |
-
x = aiOrig[a];
|
5985 |
-
y = aiOrig[b];
|
5986 |
-
return x<y ? -1 : x>y ? 1 : 0;
|
5987 |
-
} );
|
5988 |
-
}
|
5989 |
-
else {
|
5990 |
-
// Depreciated - remove in 1.11 (providing a plug-in option)
|
5991 |
-
// Not all sort types have formatting methods, so we have to call their sorting
|
5992 |
-
// methods.
|
5993 |
-
displayMaster.sort( function ( a, b ) {
|
5994 |
-
var
|
5995 |
-
x, y, k, l, test, sort, fn,
|
5996 |
-
len=aSort.length,
|
5997 |
-
dataA = aoData[a]._aSortData,
|
5998 |
-
dataB = aoData[b]._aSortData;
|
5999 |
-
|
6000 |
-
for ( k=0 ; k<len ; k++ ) {
|
6001 |
-
sort = aSort[k];
|
6002 |
-
|
6003 |
-
x = dataA[ sort.col ];
|
6004 |
-
y = dataB[ sort.col ];
|
6005 |
-
|
6006 |
-
fn = oExtSort[ sort.type+"-"+sort.dir ] || oExtSort[ "string-"+sort.dir ];
|
6007 |
-
test = fn( x, y );
|
6008 |
-
if ( test !== 0 ) {
|
6009 |
-
return test;
|
6010 |
-
}
|
6011 |
-
}
|
6012 |
-
|
6013 |
-
x = aiOrig[a];
|
6014 |
-
y = aiOrig[b];
|
6015 |
-
return x<y ? -1 : x>y ? 1 : 0;
|
6016 |
-
} );
|
6017 |
-
}
|
6018 |
-
}
|
6019 |
-
|
6020 |
-
/* Tell the draw function that we have sorted the data */
|
6021 |
-
oSettings.bSorted = true;
|
6022 |
-
}
|
6023 |
-
|
6024 |
-
|
6025 |
-
function _fnSortAria ( settings )
|
6026 |
-
{
|
6027 |
-
var label;
|
6028 |
-
var nextSort;
|
6029 |
-
var columns = settings.aoColumns;
|
6030 |
-
var aSort = _fnSortFlatten( settings );
|
6031 |
-
var oAria = settings.oLanguage.oAria;
|
6032 |
-
|
6033 |
-
// ARIA attributes - need to loop all columns, to update all (removing old
|
6034 |
-
// attributes as needed)
|
6035 |
-
for ( var i=0, iLen=columns.length ; i<iLen ; i++ )
|
6036 |
-
{
|
6037 |
-
var col = columns[i];
|
6038 |
-
var asSorting = col.asSorting;
|
6039 |
-
var sTitle = col.sTitle.replace( /<.*?>/g, "" );
|
6040 |
-
var th = col.nTh;
|
6041 |
-
|
6042 |
-
// IE7 is throwing an error when setting these properties with jQuery's
|
6043 |
-
// attr() and removeAttr() methods...
|
6044 |
-
th.removeAttribute('aria-sort');
|
6045 |
-
|
6046 |
-
/* In ARIA only the first sorting column can be marked as sorting - no multi-sort option */
|
6047 |
-
if ( col.bSortable ) {
|
6048 |
-
if ( aSort.length > 0 && aSort[0].col == i ) {
|
6049 |
-
th.setAttribute('aria-sort', aSort[0].dir=="asc" ? "ascending" : "descending" );
|
6050 |
-
nextSort = asSorting[ aSort[0].index+1 ] || asSorting[0];
|
6051 |
-
}
|
6052 |
-
else {
|
6053 |
-
nextSort = asSorting[0];
|
6054 |
-
}
|
6055 |
-
|
6056 |
-
label = sTitle + ( nextSort === "asc" ?
|
6057 |
-
oAria.sSortAscending :
|
6058 |
-
oAria.sSortDescending
|
6059 |
-
);
|
6060 |
-
}
|
6061 |
-
else {
|
6062 |
-
label = sTitle;
|
6063 |
-
}
|
6064 |
-
|
6065 |
-
th.setAttribute('aria-label', label);
|
6066 |
-
}
|
6067 |
-
}
|
6068 |
-
|
6069 |
-
|
6070 |
-
/**
|
6071 |
-
* Function to run on user sort request
|
6072 |
-
* @param {object} settings dataTables settings object
|
6073 |
-
* @param {node} attachTo node to attach the handler to
|
6074 |
-
* @param {int} colIdx column sorting index
|
6075 |
-
* @param {boolean} [append=false] Append the requested sort to the existing
|
6076 |
-
* sort if true (i.e. multi-column sort)
|
6077 |
-
* @param {function} [callback] callback function
|
6078 |
-
* @memberof WFDataTable#oApi
|
6079 |
-
*/
|
6080 |
-
function _fnSortListener ( settings, colIdx, append, callback )
|
6081 |
-
{
|
6082 |
-
var col = settings.aoColumns[ colIdx ];
|
6083 |
-
var sorting = settings.aaSorting;
|
6084 |
-
var asSorting = col.asSorting;
|
6085 |
-
var nextSortIdx;
|
6086 |
-
var next = function ( a, overflow ) {
|
6087 |
-
var idx = a._idx;
|
6088 |
-
if ( idx === undefined ) {
|
6089 |
-
idx = $.inArray( a[1], asSorting );
|
6090 |
-
}
|
6091 |
-
|
6092 |
-
return idx+1 < asSorting.length ?
|
6093 |
-
idx+1 :
|
6094 |
-
overflow ?
|
6095 |
-
null :
|
6096 |
-
0;
|
6097 |
-
};
|
6098 |
-
|
6099 |
-
// Convert to 2D array if needed
|
6100 |
-
if ( typeof sorting[0] === 'number' ) {
|
6101 |
-
sorting = settings.aaSorting = [ sorting ];
|
6102 |
-
}
|
6103 |
-
|
6104 |
-
// If appending the sort then we are multi-column sorting
|
6105 |
-
if ( append && settings.oFeatures.bSortMulti ) {
|
6106 |
-
// Are we already doing some kind of sort on this column?
|
6107 |
-
var sortIdx = $.inArray( colIdx, _pluck(sorting, '0') );
|
6108 |
-
|
6109 |
-
if ( sortIdx !== -1 ) {
|
6110 |
-
// Yes, modify the sort
|
6111 |
-
nextSortIdx = next( sorting[sortIdx], true );
|
6112 |
-
|
6113 |
-
if ( nextSortIdx === null && sorting.length === 1 ) {
|
6114 |
-
nextSortIdx = 0; // can't remove sorting completely
|
6115 |
-
}
|
6116 |
-
|
6117 |
-
if ( nextSortIdx === null ) {
|
6118 |
-
sorting.splice( sortIdx, 1 );
|
6119 |
-
}
|
6120 |
-
else {
|
6121 |
-
sorting[sortIdx][1] = asSorting[ nextSortIdx ];
|
6122 |
-
sorting[sortIdx]._idx = nextSortIdx;
|
6123 |
-
}
|
6124 |
-
}
|
6125 |
-
else {
|
6126 |
-
// No sort on this column yet
|
6127 |
-
sorting.push( [ colIdx, asSorting[0], 0 ] );
|
6128 |
-
sorting[sorting.length-1]._idx = 0;
|
6129 |
-
}
|
6130 |
-
}
|
6131 |
-
else if ( sorting.length && sorting[0][0] == colIdx ) {
|
6132 |
-
// Single column - already sorting on this column, modify the sort
|
6133 |
-
nextSortIdx = next( sorting[0] );
|
6134 |
-
|
6135 |
-
sorting.length = 1;
|
6136 |
-
sorting[0][1] = asSorting[ nextSortIdx ];
|
6137 |
-
sorting[0]._idx = nextSortIdx;
|
6138 |
-
}
|
6139 |
-
else {
|
6140 |
-
// Single column - sort only on this column
|
6141 |
-
sorting.length = 0;
|
6142 |
-
sorting.push( [ colIdx, asSorting[0] ] );
|
6143 |
-
sorting[0]._idx = 0;
|
6144 |
-
}
|
6145 |
-
|
6146 |
-
// Run the sort by calling a full redraw
|
6147 |
-
_fnReDraw( settings );
|
6148 |
-
|
6149 |
-
// callback used for async user interaction
|
6150 |
-
if ( typeof callback == 'function' ) {
|
6151 |
-
callback( settings );
|
6152 |
-
}
|
6153 |
-
}
|
6154 |
-
|
6155 |
-
|
6156 |
-
/**
|
6157 |
-
* Attach a sort handler (click) to a node
|
6158 |
-
* @param {object} settings dataTables settings object
|
6159 |
-
* @param {node} attachTo node to attach the handler to
|
6160 |
-
* @param {int} colIdx column sorting index
|
6161 |
-
* @param {function} [callback] callback function
|
6162 |
-
* @memberof WFDataTable#oApi
|
6163 |
-
*/
|
6164 |
-
function _fnSortAttachListener ( settings, attachTo, colIdx, callback )
|
6165 |
-
{
|
6166 |
-
var col = settings.aoColumns[ colIdx ];
|
6167 |
-
|
6168 |
-
_fnBindAction( attachTo, {}, function (e) {
|
6169 |
-
/* If the column is not sortable - don't to anything */
|
6170 |
-
if ( col.bSortable === false ) {
|
6171 |
-
return;
|
6172 |
-
}
|
6173 |
-
|
6174 |
-
// If processing is enabled use a timeout to allow the processing
|
6175 |
-
// display to be shown - otherwise to it synchronously
|
6176 |
-
if ( settings.oFeatures.bProcessing ) {
|
6177 |
-
_fnProcessingDisplay( settings, true );
|
6178 |
-
|
6179 |
-
setTimeout( function() {
|
6180 |
-
_fnSortListener( settings, colIdx, e.shiftKey, callback );
|
6181 |
-
|
6182 |
-
// In server-side processing, the draw callback will remove the
|
6183 |
-
// processing display
|
6184 |
-
if ( _fnDataSource( settings ) !== 'ssp' ) {
|
6185 |
-
_fnProcessingDisplay( settings, false );
|
6186 |
-
}
|
6187 |
-
}, 0 );
|
6188 |
-
}
|
6189 |
-
else {
|
6190 |
-
_fnSortListener( settings, colIdx, e.shiftKey, callback );
|
6191 |
-
}
|
6192 |
-
} );
|
6193 |
-
}
|
6194 |
-
|
6195 |
-
|
6196 |
-
/**
|
6197 |
-
* Set the sorting classes on table's body, Note: it is safe to call this function
|
6198 |
-
* when bSort and bSortClasses are false
|
6199 |
-
* @param {object} oSettings dataTables settings object
|
6200 |
-
* @memberof WFDataTable#oApi
|
6201 |
-
*/
|
6202 |
-
function _fnSortingClasses( settings )
|
6203 |
-
{
|
6204 |
-
var oldSort = settings.aLastSort;
|
6205 |
-
var sortClass = settings.oClasses.sSortColumn;
|
6206 |
-
var sort = _fnSortFlatten( settings );
|
6207 |
-
var features = settings.oFeatures;
|
6208 |
-
var i, ien, colIdx;
|
6209 |
-
|
6210 |
-
if ( features.bSort && features.bSortClasses ) {
|
6211 |
-
// Remove old sorting classes
|
6212 |
-
for ( i=0, ien=oldSort.length ; i<ien ; i++ ) {
|
6213 |
-
colIdx = oldSort[i].src;
|
6214 |
-
|
6215 |
-
// Remove column sorting
|
6216 |
-
$( _pluck( settings.aoData, 'anCells', colIdx ) )
|
6217 |
-
.removeClass( sortClass + (i<2 ? i+1 : 3) );
|
6218 |
-
}
|
6219 |
-
|
6220 |
-
// Add new column sorting
|
6221 |
-
for ( i=0, ien=sort.length ; i<ien ; i++ ) {
|
6222 |
-
colIdx = sort[i].src;
|
6223 |
-
|
6224 |
-
$( _pluck( settings.aoData, 'anCells', colIdx ) )
|
6225 |
-
.addClass( sortClass + (i<2 ? i+1 : 3) );
|
6226 |
-
}
|
6227 |
-
}
|
6228 |
-
|
6229 |
-
settings.aLastSort = sort;
|
6230 |
-
}
|
6231 |
-
|
6232 |
-
|
6233 |
-
// Get the data to sort a column, be it from cache, fresh (populating the
|
6234 |
-
// cache), or from a sort formatter
|
6235 |
-
function _fnSortData( settings, idx )
|
6236 |
-
{
|
6237 |
-
// Custom sorting function - provided by the sort data type
|
6238 |
-
var column = settings.aoColumns[ idx ];
|
6239 |
-
var customSort = WFDataTable.ext.order[ column.sSortDataType ];
|
6240 |
-
var customData;
|
6241 |
-
|
6242 |
-
if ( customSort ) {
|
6243 |
-
customData = customSort.call( settings.oInstance, settings, idx,
|
6244 |
-
_fnColumnIndexToVisible( settings, idx )
|
6245 |
-
);
|
6246 |
-
}
|
6247 |
-
|
6248 |
-
// Use / populate cache
|
6249 |
-
var row, cellData;
|
6250 |
-
var formatter = WFDataTable.ext.type.order[ column.sType+"-pre" ];
|
6251 |
-
|
6252 |
-
for ( var i=0, ien=settings.aoData.length ; i<ien ; i++ ) {
|
6253 |
-
row = settings.aoData[i];
|
6254 |
-
|
6255 |
-
if ( ! row._aSortData ) {
|
6256 |
-
row._aSortData = [];
|
6257 |
-
}
|
6258 |
-
|
6259 |
-
if ( ! row._aSortData[idx] || customSort ) {
|
6260 |
-
cellData = customSort ?
|
6261 |
-
customData[i] : // If there was a custom sort function, use data from there
|
6262 |
-
_fnGetCellData( settings, i, idx, 'sort' );
|
6263 |
-
|
6264 |
-
row._aSortData[ idx ] = formatter ?
|
6265 |
-
formatter( cellData ) :
|
6266 |
-
cellData;
|
6267 |
-
}
|
6268 |
-
}
|
6269 |
-
}
|
6270 |
-
|
6271 |
-
|
6272 |
-
|
6273 |
-
/**
|
6274 |
-
* Save the state of a table
|
6275 |
-
* @param {object} oSettings dataTables settings object
|
6276 |
-
* @memberof WFDataTable#oApi
|
6277 |
-
*/
|
6278 |
-
function _fnSaveState ( settings )
|
6279 |
-
{
|
6280 |
-
if ( !settings.oFeatures.bStateSave || settings.bDestroying )
|
6281 |
-
{
|
6282 |
-
return;
|
6283 |
-
}
|
6284 |
-
|
6285 |
-
/* Store the interesting variables */
|
6286 |
-
var state = {
|
6287 |
-
time: +new Date(),
|
6288 |
-
start: settings._iDisplayStart,
|
6289 |
-
length: settings._iDisplayLength,
|
6290 |
-
order: $.extend( true, [], settings.aaSorting ),
|
6291 |
-
search: _fnSearchToCamel( settings.oPreviousSearch ),
|
6292 |
-
columns: $.map( settings.aoColumns, function ( col, i ) {
|
6293 |
-
return {
|
6294 |
-
visible: col.bVisible,
|
6295 |
-
search: _fnSearchToCamel( settings.aoPreSearchCols[i] )
|
6296 |
-
};
|
6297 |
-
} )
|
6298 |
-
};
|
6299 |
-
|
6300 |
-
_fnCallbackFire( settings, "aoStateSaveParams", 'stateSaveParams', [settings, state] );
|
6301 |
-
|
6302 |
-
settings.oSavedState = state;
|
6303 |
-
settings.fnStateSaveCallback.call( settings.oInstance, settings, state );
|
6304 |
-
}
|
6305 |
-
|
6306 |
-
|
6307 |
-
/**
|
6308 |
-
* Attempt to load a saved table state
|
6309 |
-
* @param {object} oSettings dataTables settings object
|
6310 |
-
* @param {object} oInit WFDataTables init object so we can override settings
|
6311 |
-
* @param {function} callback Callback to execute when the state has been loaded
|
6312 |
-
* @memberof WFDataTable#oApi
|
6313 |
-
*/
|
6314 |
-
function _fnLoadState ( settings, oInit, callback )
|
6315 |
-
{
|
6316 |
-
var i, ien;
|
6317 |
-
var columns = settings.aoColumns;
|
6318 |
-
var loaded = function ( s ) {
|
6319 |
-
if ( ! s || ! s.time ) {
|
6320 |
-
callback();
|
6321 |
-
return;
|
6322 |
-
}
|
6323 |
-
|
6324 |
-
// Allow custom and plug-in manipulation functions to alter the saved data set and
|
6325 |
-
// cancelling of loading by returning false
|
6326 |
-
var abStateLoad = _fnCallbackFire( settings, 'aoStateLoadParams', 'stateLoadParams', [settings, state] );
|
6327 |
-
if ( $.inArray( false, abStateLoad ) !== -1 ) {
|
6328 |
-
callback();
|
6329 |
-
return;
|
6330 |
-
}
|
6331 |
-
|
6332 |
-
// Reject old data
|
6333 |
-
var duration = settings.iStateDuration;
|
6334 |
-
if ( duration > 0 && s.time < +new Date() - (duration*1000) ) {
|
6335 |
-
callback();
|
6336 |
-
return;
|
6337 |
-
}
|
6338 |
-
|
6339 |
-
// Number of columns have changed - all bets are off, no restore of settings
|
6340 |
-
if ( s.columns && columns.length !== s.columns.length ) {
|
6341 |
-
callback();
|
6342 |
-
return;
|
6343 |
-
}
|
6344 |
-
|
6345 |
-
// Store the saved state so it might be accessed at any time
|
6346 |
-
settings.oLoadedState = $.extend( true, {}, state );
|
6347 |
-
|
6348 |
-
// Restore key features - todo - for 1.11 this needs to be done by
|
6349 |
-
// subscribed events
|
6350 |
-
if ( s.start !== undefined ) {
|
6351 |
-
settings._iDisplayStart = s.start;
|
6352 |
-
settings.iInitDisplayStart = s.start;
|
6353 |
-
}
|
6354 |
-
if ( s.length !== undefined ) {
|
6355 |
-
settings._iDisplayLength = s.length;
|
6356 |
-
}
|
6357 |
-
|
6358 |
-
// Order
|
6359 |
-
if ( s.order !== undefined ) {
|
6360 |
-
settings.aaSorting = [];
|
6361 |
-
$.each( s.order, function ( i, col ) {
|
6362 |
-
settings.aaSorting.push( col[0] >= columns.length ?
|
6363 |
-
[ 0, col[1] ] :
|
6364 |
-
col
|
6365 |
-
);
|
6366 |
-
} );
|
6367 |
-
}
|
6368 |
-
|
6369 |
-
// Search
|
6370 |
-
if ( s.search !== undefined ) {
|
6371 |
-
$.extend( settings.oPreviousSearch, _fnSearchToHung( s.search ) );
|
6372 |
-
}
|
6373 |
-
|
6374 |
-
// Columns
|
6375 |
-
//
|
6376 |
-
if ( s.columns ) {
|
6377 |
-
for ( i=0, ien=s.columns.length ; i<ien ; i++ ) {
|
6378 |
-
var col = s.columns[i];
|
6379 |
-
|
6380 |
-
// Visibility
|
6381 |
-
if ( col.visible !== undefined ) {
|
6382 |
-
columns[i].bVisible = col.visible;
|
6383 |
-
}
|
6384 |
-
|
6385 |
-
// Search
|
6386 |
-
if ( col.search !== undefined ) {
|
6387 |
-
$.extend( settings.aoPreSearchCols[i], _fnSearchToHung( col.search ) );
|
6388 |
-
}
|
6389 |
-
}
|
6390 |
-
}
|
6391 |
-
|
6392 |
-
_fnCallbackFire( settings, 'aoStateLoaded', 'stateLoaded', [settings, state] );
|
6393 |
-
callback();
|
6394 |
-
}
|
6395 |
-
|
6396 |
-
if ( ! settings.oFeatures.bStateSave ) {
|
6397 |
-
callback();
|
6398 |
-
return;
|
6399 |
-
}
|
6400 |
-
|
6401 |
-
var state = settings.fnStateLoadCallback.call( settings.oInstance, settings, loaded );
|
6402 |
-
|
6403 |
-
if ( state !== undefined ) {
|
6404 |
-
loaded( state );
|
6405 |
-
}
|
6406 |
-
// otherwise, wait for the loaded callback to be executed
|
6407 |
-
}
|
6408 |
-
|
6409 |
-
|
6410 |
-
/**
|
6411 |
-
* Return the settings object for a particular table
|
6412 |
-
* @param {node} table table we are using as a dataTable
|
6413 |
-
* @returns {object} Settings object - or null if not found
|
6414 |
-
* @memberof WFDataTable#oApi
|
6415 |
-
*/
|
6416 |
-
function _fnSettingsFromNode ( table )
|
6417 |
-
{
|
6418 |
-
var settings = WFDataTable.settings;
|
6419 |
-
var idx = $.inArray( table, _pluck( settings, 'nTable' ) );
|
6420 |
-
|
6421 |
-
return idx !== -1 ?
|
6422 |
-
settings[ idx ] :
|
6423 |
-
null;
|
6424 |
-
}
|
6425 |
-
|
6426 |
-
|
6427 |
-
/**
|
6428 |
-
* Log an error message
|
6429 |
-
* @param {object} settings dataTables settings object
|
6430 |
-
* @param {int} level log error messages, or display them to the user
|
6431 |
-
* @param {string} msg error message
|
6432 |
-
* @param {int} tn Technical note id to get more information about the error.
|
6433 |
-
* @memberof WFDataTable#oApi
|
6434 |
-
*/
|
6435 |
-
function _fnLog( settings, level, msg, tn )
|
6436 |
-
{
|
6437 |
-
msg = 'WFDataTables warning: '+
|
6438 |
-
(settings ? 'table id='+settings.sTableId+' - ' : '')+msg;
|
6439 |
-
|
6440 |
-
if ( tn ) {
|
6441 |
-
msg += '. For more information about this error, please see '+
|
6442 |
-
'http://datatables.net/tn/'+tn;
|
6443 |
-
}
|
6444 |
-
|
6445 |
-
if ( ! level ) {
|
6446 |
-
// Backwards compatibility pre 1.10
|
6447 |
-
var ext = WFDataTable.ext;
|
6448 |
-
var type = ext.sErrMode || ext.errMode;
|
6449 |
-
|
6450 |
-
if ( settings ) {
|
6451 |
-
_fnCallbackFire( settings, null, 'error', [ settings, tn, msg ] );
|
6452 |
-
}
|
6453 |
-
|
6454 |
-
if ( type == 'alert' ) {
|
6455 |
-
alert( msg );
|
6456 |
-
}
|
6457 |
-
else if ( type == 'throw' ) {
|
6458 |
-
throw new Error(msg);
|
6459 |
-
}
|
6460 |
-
else if ( typeof type == 'function' ) {
|
6461 |
-
type( settings, tn, msg );
|
6462 |
-
}
|
6463 |
-
}
|
6464 |
-
else if ( window.console && console.log ) {
|
6465 |
-
console.log( msg );
|
6466 |
-
}
|
6467 |
-
}
|
6468 |
-
|
6469 |
-
|
6470 |
-
/**
|
6471 |
-
* See if a property is defined on one object, if so assign it to the other object
|
6472 |
-
* @param {object} ret target object
|
6473 |
-
* @param {object} src source object
|
6474 |
-
* @param {string} name property
|
6475 |
-
* @param {string} [mappedName] name to map too - optional, name used if not given
|
6476 |
-
* @memberof WFDataTable#oApi
|
6477 |
-
*/
|
6478 |
-
function _fnMap( ret, src, name, mappedName )
|
6479 |
-
{
|
6480 |
-
if ( $.isArray( name ) ) {
|
6481 |
-
$.each( name, function (i, val) {
|
6482 |
-
if ( $.isArray( val ) ) {
|
6483 |
-
_fnMap( ret, src, val[0], val[1] );
|
6484 |
-
}
|
6485 |
-
else {
|
6486 |
-
_fnMap( ret, src, val );
|
6487 |
-
}
|
6488 |
-
} );
|
6489 |
-
|
6490 |
-
return;
|
6491 |
-
}
|
6492 |
-
|
6493 |
-
if ( mappedName === undefined ) {
|
6494 |
-
mappedName = name;
|
6495 |
-
}
|
6496 |
-
|
6497 |
-
if ( src[name] !== undefined ) {
|
6498 |
-
ret[mappedName] = src[name];
|
6499 |
-
}
|
6500 |
-
}
|
6501 |
-
|
6502 |
-
|
6503 |
-
/**
|
6504 |
-
* Extend objects - very similar to jQuery.extend, but deep copy objects, and
|
6505 |
-
* shallow copy arrays. The reason we need to do this, is that we don't want to
|
6506 |
-
* deep copy array init values (such as aaSorting) since the dev wouldn't be
|
6507 |
-
* able to override them, but we do want to deep copy arrays.
|
6508 |
-
* @param {object} out Object to extend
|
6509 |
-
* @param {object} extender Object from which the properties will be applied to
|
6510 |
-
* out
|
6511 |
-
* @param {boolean} breakRefs If true, then arrays will be sliced to take an
|
6512 |
-
* independent copy with the exception of the `data` or `aaData` parameters
|
6513 |
-
* if they are present. This is so you can pass in a collection to
|
6514 |
-
* WFDataTables and have that used as your data source without breaking the
|
6515 |
-
* references
|
6516 |
-
* @returns {object} out Reference, just for convenience - out === the return.
|
6517 |
-
* @memberof WFDataTable#oApi
|
6518 |
-
* @todo This doesn't take account of arrays inside the deep copied objects.
|
6519 |
-
*/
|
6520 |
-
function _fnExtend( out, extender, breakRefs )
|
6521 |
-
{
|
6522 |
-
var val;
|
6523 |
-
|
6524 |
-
for ( var prop in extender ) {
|
6525 |
-
if ( extender.hasOwnProperty(prop) ) {
|
6526 |
-
val = extender[prop];
|
6527 |
-
|
6528 |
-
if ( $.isPlainObject( val ) ) {
|
6529 |
-
if ( ! $.isPlainObject( out[prop] ) ) {
|
6530 |
-
out[prop] = {};
|
6531 |
-
}
|
6532 |
-
$.extend( true, out[prop], val );
|
6533 |
-
}
|
6534 |
-
else if ( breakRefs && prop !== 'data' && prop !== 'aaData' && $.isArray(val) ) {
|
6535 |
-
out[prop] = val.slice();
|
6536 |
-
}
|
6537 |
-
else {
|
6538 |
-
out[prop] = val;
|
6539 |
-
}
|
6540 |
-
}
|
6541 |
-
}
|
6542 |
-
|
6543 |
-
return out;
|
6544 |
-
}
|
6545 |
-
|
6546 |
-
|
6547 |
-
/**
|
6548 |
-
* Bind an event handers to allow a click or return key to activate the callback.
|
6549 |
-
* This is good for accessibility since a return on the keyboard will have the
|
6550 |
-
* same effect as a click, if the element has focus.
|
6551 |
-
* @param {element} n Element to bind the action to
|
6552 |
-
* @param {object} oData Data object to pass to the triggered function
|
6553 |
-
* @param {function} fn Callback function for when the event is triggered
|
6554 |
-
* @memberof WFDataTable#oApi
|
6555 |
-
*/
|
6556 |
-
function _fnBindAction( n, oData, fn )
|
6557 |
-
{
|
6558 |
-
$(n)
|
6559 |
-
.on( 'click.DT', oData, function (e) {
|
6560 |
-
n.blur(); // Remove focus outline for mouse users
|
6561 |
-
fn(e);
|
6562 |
-
} )
|
6563 |
-
.on( 'keypress.DT', oData, function (e){
|
6564 |
-
if ( e.which === 13 ) {
|
6565 |
-
e.preventDefault();
|
6566 |
-
fn(e);
|
6567 |
-
}
|
6568 |
-
} )
|
6569 |
-
.on( 'selectstart.DT', function () {
|
6570 |
-
/* Take the brutal approach to cancelling text selection */
|
6571 |
-
return false;
|
6572 |
-
} );
|
6573 |
-
}
|
6574 |
-
|
6575 |
-
|
6576 |
-
/**
|
6577 |
-
* Register a callback function. Easily allows a callback function to be added to
|
6578 |
-
* an array store of callback functions that can then all be called together.
|
6579 |
-
* @param {object} oSettings dataTables settings object
|
6580 |
-
* @param {string} sStore Name of the array storage for the callbacks in oSettings
|
6581 |
-
* @param {function} fn Function to be called back
|
6582 |
-
* @param {string} sName Identifying name for the callback (i.e. a label)
|
6583 |
-
* @memberof WFDataTable#oApi
|
6584 |
-
*/
|
6585 |
-
function _fnCallbackReg( oSettings, sStore, fn, sName )
|
6586 |
-
{
|
6587 |
-
if ( fn )
|
6588 |
-
{
|
6589 |
-
oSettings[sStore].push( {
|
6590 |
-
"fn": fn,
|
6591 |
-
"sName": sName
|
6592 |
-
} );
|
6593 |
-
}
|
6594 |
-
}
|
6595 |
-
|
6596 |
-
|
6597 |
-
/**
|
6598 |
-
* Fire callback functions and trigger events. Note that the loop over the
|
6599 |
-
* callback array store is done backwards! Further note that you do not want to
|
6600 |
-
* fire off triggers in time sensitive applications (for example cell creation)
|
6601 |
-
* as its slow.
|
6602 |
-
* @param {object} settings dataTables settings object
|
6603 |
-
* @param {string} callbackArr Name of the array storage for the callbacks in
|
6604 |
-
* oSettings
|
6605 |
-
* @param {string} eventName Name of the jQuery custom event to trigger. If
|
6606 |
-
* null no trigger is fired
|
6607 |
-
* @param {array} args Array of arguments to pass to the callback function /
|
6608 |
-
* trigger
|
6609 |
-
* @memberof WFDataTable#oApi
|
6610 |
-
*/
|
6611 |
-
function _fnCallbackFire( settings, callbackArr, eventName, args )
|
6612 |
-
{
|
6613 |
-
var ret = [];
|
6614 |
-
|
6615 |
-
if ( callbackArr ) {
|
6616 |
-
ret = $.map( settings[callbackArr].slice().reverse(), function (val, i) {
|
6617 |
-
return val.fn.apply( settings.oInstance, args );
|
6618 |
-
} );
|
6619 |
-
}
|
6620 |
-
|
6621 |
-
if ( eventName !== null ) {
|
6622 |
-
var e = $.Event( eventName+'.dt' );
|
6623 |
-
|
6624 |
-
$(settings.nTable).trigger( e, args );
|
6625 |
-
|
6626 |
-
ret.push( e.result );
|
6627 |
-
}
|
6628 |
-
|
6629 |
-
return ret;
|
6630 |
-
}
|
6631 |
-
|
6632 |
-
|
6633 |
-
function _fnLengthOverflow ( settings )
|
6634 |
-
{
|
6635 |
-
var
|
6636 |
-
start = settings._iDisplayStart,
|
6637 |
-
end = settings.fnDisplayEnd(),
|
6638 |
-
len = settings._iDisplayLength;
|
6639 |
-
|
6640 |
-
/* If we have space to show extra rows (backing up from the end point - then do so */
|
6641 |
-
if ( start >= end )
|
6642 |
-
{
|
6643 |
-
start = end - len;
|
6644 |
-
}
|
6645 |
-
|
6646 |
-
// Keep the start record on the current page
|
6647 |
-
start -= (start % len);
|
6648 |
-
|
6649 |
-
if ( len === -1 || start < 0 )
|
6650 |
-
{
|
6651 |
-
start = 0;
|
6652 |
-
}
|
6653 |
-
|
6654 |
-
settings._iDisplayStart = start;
|
6655 |
-
}
|
6656 |
-
|
6657 |
-
|
6658 |
-
function _fnRenderer( settings, type )
|
6659 |
-
{
|
6660 |
-
var renderer = settings.renderer;
|
6661 |
-
var host = WFDataTable.ext.renderer[type];
|
6662 |
-
|
6663 |
-
if ( $.isPlainObject( renderer ) && renderer[type] ) {
|
6664 |
-
// Specific renderer for this type. If available use it, otherwise use
|
6665 |
-
// the default.
|
6666 |
-
return host[renderer[type]] || host._;
|
6667 |
-
}
|
6668 |
-
else if ( typeof renderer === 'string' ) {
|
6669 |
-
// Common renderer - if there is one available for this type use it,
|
6670 |
-
// otherwise use the default
|
6671 |
-
return host[renderer] || host._;
|
6672 |
-
}
|
6673 |
-
|
6674 |
-
// Use the default
|
6675 |
-
return host._;
|
6676 |
-
}
|
6677 |
-
|
6678 |
-
|
6679 |
-
/**
|
6680 |
-
* Detect the data source being used for the table. Used to simplify the code
|
6681 |
-
* a little (ajax) and to make it compress a little smaller.
|
6682 |
-
*
|
6683 |
-
* @param {object} settings dataTables settings object
|
6684 |
-
* @returns {string} Data source
|
6685 |
-
* @memberof WFDataTable#oApi
|
6686 |
-
*/
|
6687 |
-
function _fnDataSource ( settings )
|
6688 |
-
{
|
6689 |
-
if ( settings.oFeatures.bServerSide ) {
|
6690 |
-
return 'ssp';
|
6691 |
-
}
|
6692 |
-
else if ( settings.ajax || settings.sAjaxSource ) {
|
6693 |
-
return 'ajax';
|
6694 |
-
}
|
6695 |
-
return 'dom';
|
6696 |
-
}
|
6697 |
-
|
6698 |
-
|
6699 |
-
|
6700 |
-
|
6701 |
-
/**
|
6702 |
-
* Computed structure of the WFDataTables API, defined by the options passed to
|
6703 |
-
* `WFDataTable.Api.register()` when building the API.
|
6704 |
-
*
|
6705 |
-
* The structure is built in order to speed creation and extension of the Api
|
6706 |
-
* objects since the extensions are effectively pre-parsed.
|
6707 |
-
*
|
6708 |
-
* The array is an array of objects with the following structure, where this
|
6709 |
-
* base array represents the Api prototype base:
|
6710 |
-
*
|
6711 |
-
* [
|
6712 |
-
* {
|
6713 |
-
* name: 'data' -- string - Property name
|
6714 |
-
* val: function () {}, -- function - Api method (or undefined if just an object
|
6715 |
-
* methodExt: [ ... ], -- array - Array of Api object definitions to extend the method result
|
6716 |
-
* propExt: [ ... ] -- array - Array of Api object definitions to extend the property
|
6717 |
-
* },
|
6718 |
-
* {
|
6719 |
-
* name: 'row'
|
6720 |
-
* val: {},
|
6721 |
-
* methodExt: [ ... ],
|
6722 |
-
* propExt: [
|
6723 |
-
* {
|
6724 |
-
* name: 'data'
|
6725 |
-
* val: function () {},
|
6726 |
-
* methodExt: [ ... ],
|
6727 |
-
* propExt: [ ... ]
|
6728 |
-
* },
|
6729 |
-
* ...
|
6730 |
-
* ]
|
6731 |
-
* }
|
6732 |
-
* ]
|
6733 |
-
*
|
6734 |
-
* @type {Array}
|
6735 |
-
* @ignore
|
6736 |
-
*/
|
6737 |
-
var __apiStruct = [];
|
6738 |
-
|
6739 |
-
|
6740 |
-
/**
|
6741 |
-
* `Array.prototype` reference.
|
6742 |
-
*
|
6743 |
-
* @type object
|
6744 |
-
* @ignore
|
6745 |
-
*/
|
6746 |
-
var __arrayProto = Array.prototype;
|
6747 |
-
|
6748 |
-
|
6749 |
-
/**
|
6750 |
-
* Abstraction for `context` parameter of the `Api` constructor to allow it to
|
6751 |
-
* take several different forms for ease of use.
|
6752 |
-
*
|
6753 |
-
* Each of the input parameter types will be converted to a WFDataTables settings
|
6754 |
-
* object where possible.
|
6755 |
-
*
|
6756 |
-
* @param {string|node|jQuery|object} mixed WFDataTable identifier. Can be one
|
6757 |
-
* of:
|
6758 |
-
*
|
6759 |
-
* * `string` - jQuery selector. Any WFDataTables' matching the given selector
|
6760 |
-
* with be found and used.
|
6761 |
-
* * `node` - `TABLE` node which has already been formed into a WFDataTable.
|
6762 |
-
* * `jQuery` - A jQuery object of `TABLE` nodes.
|
6763 |
-
* * `object` - WFDataTables settings object
|
6764 |
-
* * `WFDataTables.Api` - API instance
|
6765 |
-
* @return {array|null} Matching WFDataTables settings objects. `null` or
|
6766 |
-
* `undefined` is returned if no matching WFDataTable is found.
|
6767 |
-
* @ignore
|
6768 |
-
*/
|
6769 |
-
var _toSettings = function ( mixed )
|
6770 |
-
{
|
6771 |
-
var idx, jq;
|
6772 |
-
var settings = WFDataTable.settings;
|
6773 |
-
var tables = $.map( settings, function (el, i) {
|
6774 |
-
return el.nTable;
|
6775 |
-
} );
|
6776 |
-
|
6777 |
-
if ( ! mixed ) {
|
6778 |
-
return [];
|
6779 |
-
}
|
6780 |
-
else if ( mixed.nTable && mixed.oApi ) {
|
6781 |
-
// WFDataTables settings object
|
6782 |
-
return [ mixed ];
|
6783 |
-
}
|
6784 |
-
else if ( mixed.nodeName && mixed.nodeName.toLowerCase() === 'table' ) {
|
6785 |
-
// Table node
|
6786 |
-
idx = $.inArray( mixed, tables );
|
6787 |
-
return idx !== -1 ? [ settings[idx] ] : null;
|
6788 |
-
}
|
6789 |
-
else if ( mixed && typeof mixed.settings === 'function' ) {
|
6790 |
-
return mixed.settings().toArray();
|
6791 |
-
}
|
6792 |
-
else if ( typeof mixed === 'string' ) {
|
6793 |
-
// jQuery selector
|
6794 |
-
jq = $(mixed);
|
6795 |
-
}
|
6796 |
-
else if ( mixed instanceof $ ) {
|
6797 |
-
// jQuery object (also WFDataTables instance)
|
6798 |
-
jq = mixed;
|
6799 |
-
}
|
6800 |
-
|
6801 |
-
if ( jq ) {
|
6802 |
-
return jq.map( function(i) {
|
6803 |
-
idx = $.inArray( this, tables );
|
6804 |
-
return idx !== -1 ? settings[idx] : null;
|
6805 |
-
} ).toArray();
|
6806 |
-
}
|
6807 |
-
};
|
6808 |
-
|
6809 |
-
|
6810 |
-
/**
|
6811 |
-
* WFDataTables API class - used to control and interface with one or more
|
6812 |
-
* WFDataTables enhanced tables.
|
6813 |
-
*
|
6814 |
-
* The API class is heavily based on jQuery, presenting a chainable interface
|
6815 |
-
* that you can use to interact with tables. Each instance of the API class has
|
6816 |
-
* a "context" - i.e. the tables that it will operate on. This could be a single
|
6817 |
-
* table, all tables on a page or a sub-set thereof.
|
6818 |
-
*
|
6819 |
-
* Additionally the API is designed to allow you to easily work with the data in
|
6820 |
-
* the tables, retrieving and manipulating it as required. This is done by
|
6821 |
-
* presenting the API class as an array like interface. The contents of the
|
6822 |
-
* array depend upon the actions requested by each method (for example
|
6823 |
-
* `rows().nodes()` will return an array of nodes, while `rows().data()` will
|
6824 |
-
* return an array of objects or arrays depending upon your table's
|
6825 |
-
* configuration). The API object has a number of array like methods (`push`,
|
6826 |
-
* `pop`, `reverse` etc) as well as additional helper methods (`each`, `pluck`,
|
6827 |
-
* `unique` etc) to assist your working with the data held in a table.
|
6828 |
-
*
|
6829 |
-
* Most methods (those which return an Api instance) are chainable, which means
|
6830 |
-
* the return from a method call also has all of the methods available that the
|
6831 |
-
* top level object had. For example, these two calls are equivalent:
|
6832 |
-
*
|
6833 |
-
* // Not chained
|
6834 |
-
* api.row.add( {...} );
|
6835 |
-
* api.draw();
|
6836 |
-
*
|
6837 |
-
* // Chained
|
6838 |
-
* api.row.add( {...} ).draw();
|
6839 |
-
*
|
6840 |
-
* @class WFDataTable.Api
|
6841 |
-
* @param {array|object|string|jQuery} context WFDataTable identifier. This is
|
6842 |
-
* used to define which WFDataTables enhanced tables this API will operate on.
|
6843 |
-
* Can be one of:
|
6844 |
-
*
|
6845 |
-
* * `string` - jQuery selector. Any WFDataTables' matching the given selector
|
6846 |
-
* with be found and used.
|
6847 |
-
* * `node` - `TABLE` node which has already been formed into a WFDataTable.
|
6848 |
-
* * `jQuery` - A jQuery object of `TABLE` nodes.
|
6849 |
-
* * `object` - WFDataTables settings object
|
6850 |
-
* @param {array} [data] Data to initialise the Api instance with.
|
6851 |
-
*
|
6852 |
-
* @example
|
6853 |
-
* // Direct initialisation during WFDataTables construction
|
6854 |
-
* var api = $('#example').WFDataTable();
|
6855 |
-
*
|
6856 |
-
* @example
|
6857 |
-
* // Initialisation using a WFDataTables jQuery object
|
6858 |
-
* var api = $('#example').wfDataTable().api();
|
6859 |
-
*
|
6860 |
-
* @example
|
6861 |
-
* // Initialisation as a constructor
|
6862 |
-
* var api = new $.fn.WFDataTable.Api( 'table.wfDataTable' );
|
6863 |
-
*/
|
6864 |
-
_Api = function ( context, data )
|
6865 |
-
{
|
6866 |
-
if ( ! (this instanceof _Api) ) {
|
6867 |
-
return new _Api( context, data );
|
6868 |
-
}
|
6869 |
-
|
6870 |
-
var settings = [];
|
6871 |
-
var ctxSettings = function ( o ) {
|
6872 |
-
var a = _toSettings( o );
|
6873 |
-
if ( a ) {
|
6874 |
-
settings = settings.concat( a );
|
6875 |
-
}
|
6876 |
-
};
|
6877 |
-
|
6878 |
-
if ( $.isArray( context ) ) {
|
6879 |
-
for ( var i=0, ien=context.length ; i<ien ; i++ ) {
|
6880 |
-
ctxSettings( context[i] );
|
6881 |
-
}
|
6882 |
-
}
|
6883 |
-
else {
|
6884 |
-
ctxSettings( context );
|
6885 |
-
}
|
6886 |
-
|
6887 |
-
// Remove duplicates
|
6888 |
-
this.context = _unique( settings );
|
6889 |
-
|
6890 |
-
// Initial data
|
6891 |
-
if ( data ) {
|
6892 |
-
$.merge( this, data );
|
6893 |
-
}
|
6894 |
-
|
6895 |
-
// selector
|
6896 |
-
this.selector = {
|
6897 |
-
rows: null,
|
6898 |
-
cols: null,
|
6899 |
-
opts: null
|
6900 |
-
};
|
6901 |
-
|
6902 |
-
_Api.extend( this, this, __apiStruct );
|
6903 |
-
};
|
6904 |
-
|
6905 |
-
WFDataTable.Api = _Api;
|
6906 |
-
|
6907 |
-
// Don't destroy the existing prototype, just extend it. Required for jQuery 2's
|
6908 |
-
// isPlainObject.
|
6909 |
-
$.extend( _Api.prototype, {
|
6910 |
-
any: function ()
|
6911 |
-
{
|
6912 |
-
return this.count() !== 0;
|
6913 |
-
},
|
6914 |
-
|
6915 |
-
|
6916 |
-
concat: __arrayProto.concat,
|
6917 |
-
|
6918 |
-
|
6919 |
-
context: [], // array of table settings objects
|
6920 |
-
|
6921 |
-
|
6922 |
-
count: function ()
|
6923 |
-
{
|
6924 |
-
return this.flatten().length;
|
6925 |
-
},
|
6926 |
-
|
6927 |
-
|
6928 |
-
each: function ( fn )
|
6929 |
-
{
|
6930 |
-
for ( var i=0, ien=this.length ; i<ien; i++ ) {
|
6931 |
-
fn.call( this, this[i], i, this );
|
6932 |
-
}
|
6933 |
-
|
6934 |
-
return this;
|
6935 |
-
},
|
6936 |
-
|
6937 |
-
|
6938 |
-
eq: function ( idx )
|
6939 |
-
{
|
6940 |
-
var ctx = this.context;
|
6941 |
-
|
6942 |
-
return ctx.length > idx ?
|
6943 |
-
new _Api( ctx[idx], this[idx] ) :
|
6944 |
-
null;
|
6945 |
-
},
|
6946 |
-
|
6947 |
-
|
6948 |
-
filter: function ( fn )
|
6949 |
-
{
|
6950 |
-
var a = [];
|
6951 |
-
|
6952 |
-
if ( __arrayProto.filter ) {
|
6953 |
-
a = __arrayProto.filter.call( this, fn, this );
|
6954 |
-
}
|
6955 |
-
else {
|
6956 |
-
// Compatibility for browsers without EMCA-252-5 (JS 1.6)
|
6957 |
-
for ( var i=0, ien=this.length ; i<ien ; i++ ) {
|
6958 |
-
if ( fn.call( this, this[i], i, this ) ) {
|
6959 |
-
a.push( this[i] );
|
6960 |
-
}
|
6961 |
-
}
|
6962 |
-
}
|
6963 |
-
|
6964 |
-
return new _Api( this.context, a );
|
6965 |
-
},
|
6966 |
-
|
6967 |
-
|
6968 |
-
flatten: function ()
|
6969 |
-
{
|
6970 |
-
var a = [];
|
6971 |
-
return new _Api( this.context, a.concat.apply( a, this.toArray() ) );
|
6972 |
-
},
|
6973 |
-
|
6974 |
-
|
6975 |
-
join: __arrayProto.join,
|
6976 |
-
|
6977 |
-
|
6978 |
-
indexOf: __arrayProto.indexOf || function (obj, start)
|
6979 |
-
{
|
6980 |
-
for ( var i=(start || 0), ien=this.length ; i<ien ; i++ ) {
|
6981 |
-
if ( this[i] === obj ) {
|
6982 |
-
return i;
|
6983 |
-
}
|
6984 |
-
}
|
6985 |
-
return -1;
|
6986 |
-
},
|
6987 |
-
|
6988 |
-
iterator: function ( flatten, type, fn, alwaysNew ) {
|
6989 |
-
var
|
6990 |
-
a = [], ret,
|
6991 |
-
i, ien, j, jen,
|
6992 |
-
context = this.context,
|
6993 |
-
rows, items, item,
|
6994 |
-
selector = this.selector;
|
6995 |
-
|
6996 |
-
// Argument shifting
|
6997 |
-
if ( typeof flatten === 'string' ) {
|
6998 |
-
alwaysNew = fn;
|
6999 |
-
fn = type;
|
7000 |
-
type = flatten;
|
7001 |
-
flatten = false;
|
7002 |
-
}
|
7003 |
-
|
7004 |
-
for ( i=0, ien=context.length ; i<ien ; i++ ) {
|
7005 |
-
var apiInst = new _Api( context[i] );
|
7006 |
-
|
7007 |
-
if ( type === 'table' ) {
|
7008 |
-
ret = fn.call( apiInst, context[i], i );
|
7009 |
-
|
7010 |
-
if ( ret !== undefined ) {
|
7011 |
-
a.push( ret );
|
7012 |
-
}
|
7013 |
-
}
|
7014 |
-
else if ( type === 'columns' || type === 'rows' ) {
|
7015 |
-
// this has same length as context - one entry for each table
|
7016 |
-
ret = fn.call( apiInst, context[i], this[i], i );
|
7017 |
-
|
7018 |
-
if ( ret !== undefined ) {
|
7019 |
-
a.push( ret );
|
7020 |
-
}
|
7021 |
-
}
|
7022 |
-
else if ( type === 'column' || type === 'column-rows' || type === 'row' || type === 'cell' ) {
|
7023 |
-
// columns and rows share the same structure.
|
7024 |
-
// 'this' is an array of column indexes for each context
|
7025 |
-
items = this[i];
|
7026 |
-
|
7027 |
-
if ( type === 'column-rows' ) {
|
7028 |
-
rows = _selector_row_indexes( context[i], selector.opts );
|
7029 |
-
}
|
7030 |
-
|
7031 |
-
for ( j=0, jen=items.length ; j<jen ; j++ ) {
|
7032 |
-
item = items[j];
|
7033 |
-
|
7034 |
-
if ( type === 'cell' ) {
|
7035 |
-
ret = fn.call( apiInst, context[i], item.row, item.column, i, j );
|
7036 |
-
}
|
7037 |
-
else {
|
7038 |
-
ret = fn.call( apiInst, context[i], item, i, j, rows );
|
7039 |
-
}
|
7040 |
-
|
7041 |
-
if ( ret !== undefined ) {
|
7042 |
-
a.push( ret );
|
7043 |
-
}
|
7044 |
-
}
|
7045 |
-
}
|
7046 |
-
}
|
7047 |
-
|
7048 |
-
if ( a.length || alwaysNew ) {
|
7049 |
-
var api = new _Api( context, flatten ? a.concat.apply( [], a ) : a );
|
7050 |
-
var apiSelector = api.selector;
|
7051 |
-
apiSelector.rows = selector.rows;
|
7052 |
-
apiSelector.cols = selector.cols;
|
7053 |
-
apiSelector.opts = selector.opts;
|
7054 |
-
return api;
|
7055 |
-
}
|
7056 |
-
return this;
|
7057 |
-
},
|
7058 |
-
|
7059 |
-
|
7060 |
-
lastIndexOf: __arrayProto.lastIndexOf || function (obj, start)
|
7061 |
-
{
|
7062 |
-
// Bit cheeky...
|
7063 |
-
return this.indexOf.apply( this.toArray.reverse(), arguments );
|
7064 |
-
},
|
7065 |
-
|
7066 |
-
|
7067 |
-
length: 0,
|
7068 |
-
|
7069 |
-
|
7070 |
-
map: function ( fn )
|
7071 |
-
{
|
7072 |
-
var a = [];
|
7073 |
-
|
7074 |
-
if ( __arrayProto.map ) {
|
7075 |
-
a = __arrayProto.map.call( this, fn, this );
|
7076 |
-
}
|
7077 |
-
else {
|
7078 |
-
// Compatibility for browsers without EMCA-252-5 (JS 1.6)
|
7079 |
-
for ( var i=0, ien=this.length ; i<ien ; i++ ) {
|
7080 |
-
a.push( fn.call( this, this[i], i ) );
|
7081 |
-
}
|
7082 |
-
}
|
7083 |
-
|
7084 |
-
return new _Api( this.context, a );
|
7085 |
-
},
|
7086 |
-
|
7087 |
-
|
7088 |
-
pluck: function ( prop )
|
7089 |
-
{
|
7090 |
-
return this.map( function ( el ) {
|
7091 |
-
return el[ prop ];
|
7092 |
-
} );
|
7093 |
-
},
|
7094 |
-
|
7095 |
-
pop: __arrayProto.pop,
|
7096 |
-
|
7097 |
-
|
7098 |
-
push: __arrayProto.push,
|
7099 |
-
|
7100 |
-
|
7101 |
-
// Does not return an API instance
|
7102 |
-
reduce: __arrayProto.reduce || function ( fn, init )
|
7103 |
-
{
|
7104 |
-
return _fnReduce( this, fn, init, 0, this.length, 1 );
|
7105 |
-
},
|
7106 |
-
|
7107 |
-
|
7108 |
-
reduceRight: __arrayProto.reduceRight || function ( fn, init )
|
7109 |
-
{
|
7110 |
-
return _fnReduce( this, fn, init, this.length-1, -1, -1 );
|
7111 |
-
},
|
7112 |
-
|
7113 |
-
|
7114 |
-
reverse: __arrayProto.reverse,
|
7115 |
-
|
7116 |
-
|
7117 |
-
// Object with rows, columns and opts
|
7118 |
-
selector: null,
|
7119 |
-
|
7120 |
-
|
7121 |
-
shift: __arrayProto.shift,
|
7122 |
-
|
7123 |
-
|
7124 |
-
sort: __arrayProto.sort, // ? name - order?
|
7125 |
-
|
7126 |
-
|
7127 |
-
splice: __arrayProto.splice,
|
7128 |
-
|
7129 |
-
|
7130 |
-
toArray: function ()
|
7131 |
-
{
|
7132 |
-
return __arrayProto.slice.call( this );
|
7133 |
-
},
|
7134 |
-
|
7135 |
-
|
7136 |
-
to$: function ()
|
7137 |
-
{
|
7138 |
-
return $( this );
|
7139 |
-
},
|
7140 |
-
|
7141 |
-
|
7142 |
-
toJQuery: function ()
|
7143 |
-
{
|
7144 |
-
return $( this );
|
7145 |
-
},
|
7146 |
-
|
7147 |
-
|
7148 |
-
unique: function ()
|
7149 |
-
{
|
7150 |
-
return new _Api( this.context, _unique(this) );
|
7151 |
-
},
|
7152 |
-
|
7153 |
-
|
7154 |
-
unshift: __arrayProto.unshift
|
7155 |
-
} );
|
7156 |
-
|
7157 |
-
|
7158 |
-
_Api.extend = function ( scope, obj, ext )
|
7159 |
-
{
|
7160 |
-
// Only extend API instances and static properties of the API
|
7161 |
-
if ( ! ext.length || ! obj || ( ! (obj instanceof _Api) && ! obj.__dt_wrapper ) ) {
|
7162 |
-
return;
|
7163 |
-
}
|
7164 |
-
|
7165 |
-
var
|
7166 |
-
i, ien,
|
7167 |
-
j, jen,
|
7168 |
-
struct, inner,
|
7169 |
-
methodScoping = function ( scope, fn, struc ) {
|
7170 |
-
return function () {
|
7171 |
-
var ret = fn.apply( scope, arguments );
|
7172 |
-
|
7173 |
-
// Method extension
|
7174 |
-
_Api.extend( ret, ret, struc.methodExt );
|
7175 |
-
return ret;
|
7176 |
-
};
|
7177 |
-
};
|
7178 |
-
|
7179 |
-
for ( i=0, ien=ext.length ; i<ien ; i++ ) {
|
7180 |
-
struct = ext[i];
|
7181 |
-
|
7182 |
-
// Value
|
7183 |
-
obj[ struct.name ] = typeof struct.val === 'function' ?
|
7184 |
-
methodScoping( scope, struct.val, struct ) :
|
7185 |
-
$.isPlainObject( struct.val ) ?
|
7186 |
-
{} :
|
7187 |
-
struct.val;
|
7188 |
-
|
7189 |
-
obj[ struct.name ].__dt_wrapper = true;
|
7190 |
-
|
7191 |
-
// Property extension
|
7192 |
-
_Api.extend( scope, obj[ struct.name ], struct.propExt );
|
7193 |
-
}
|
7194 |
-
};
|
7195 |
-
|
7196 |
-
|
7197 |
-
// @todo - Is there need for an augment function?
|
7198 |
-
// _Api.augment = function ( inst, name )
|
7199 |
-
// {
|
7200 |
-
// // Find src object in the structure from the name
|
7201 |
-
// var parts = name.split('.');
|
7202 |
-
|
7203 |
-
// _Api.extend( inst, obj );
|
7204 |
-
// };
|
7205 |
-
|
7206 |
-
|
7207 |
-
// [
|
7208 |
-
// {
|
7209 |
-
// name: 'data' -- string - Property name
|
7210 |
-
// val: function () {}, -- function - Api method (or undefined if just an object
|
7211 |
-
// methodExt: [ ... ], -- array - Array of Api object definitions to extend the method result
|
7212 |
-
// propExt: [ ... ] -- array - Array of Api object definitions to extend the property
|
7213 |
-
// },
|
7214 |
-
// {
|
7215 |
-
// name: 'row'
|
7216 |
-
// val: {},
|
7217 |
-
// methodExt: [ ... ],
|
7218 |
-
// propExt: [
|
7219 |
-
// {
|
7220 |
-
// name: 'data'
|
7221 |
-
// val: function () {},
|
7222 |
-
// methodExt: [ ... ],
|
7223 |
-
// propExt: [ ... ]
|
7224 |
-
// },
|
7225 |
-
// ...
|
7226 |
-
// ]
|
7227 |
-
// }
|
7228 |
-
// ]
|
7229 |
-
|
7230 |
-
_Api.register = _api_register = function ( name, val )
|
7231 |
-
{
|
7232 |
-
if ( $.isArray( name ) ) {
|
7233 |
-
for ( var j=0, jen=name.length ; j<jen ; j++ ) {
|
7234 |
-
_Api.register( name[j], val );
|
7235 |
-
}
|
7236 |
-
return;
|
7237 |
-
}
|
7238 |
-
|
7239 |
-
var
|
7240 |
-
i, ien,
|
7241 |
-
heir = name.split('.'),
|
7242 |
-
struct = __apiStruct,
|
7243 |
-
key, method;
|
7244 |
-
|
7245 |
-
var find = function ( src, name ) {
|
7246 |
-
for ( var i=0, ien=src.length ; i<ien ; i++ ) {
|
7247 |
-
if ( src[i].name === name ) {
|
7248 |
-
return src[i];
|
7249 |
-
}
|
7250 |
-
}
|
7251 |
-
return null;
|
7252 |
-
};
|
7253 |
-
|
7254 |
-
for ( i=0, ien=heir.length ; i<ien ; i++ ) {
|
7255 |
-
method = heir[i].indexOf('()') !== -1;
|
7256 |
-
key = method ?
|
7257 |
-
heir[i].replace('()', '') :
|
7258 |
-
heir[i];
|
7259 |
-
|
7260 |
-
var src = find( struct, key );
|
7261 |
-
if ( ! src ) {
|
7262 |
-
src = {
|
7263 |
-
name: key,
|
7264 |
-
val: {},
|
7265 |
-
methodExt: [],
|
7266 |
-
propExt: []
|
7267 |
-
};
|
7268 |
-
struct.push( src );
|
7269 |
-
}
|
7270 |
-
|
7271 |
-
if ( i === ien-1 ) {
|
7272 |
-
src.val = val;
|
7273 |
-
}
|
7274 |
-
else {
|
7275 |
-
struct = method ?
|
7276 |
-
src.methodExt :
|
7277 |
-
src.propExt;
|
7278 |
-
}
|
7279 |
-
}
|
7280 |
-
};
|
7281 |
-
|
7282 |
-
|
7283 |
-
_Api.registerPlural = _api_registerPlural = function ( pluralName, singularName, val ) {
|
7284 |
-
_Api.register( pluralName, val );
|
7285 |
-
|
7286 |
-
_Api.register( singularName, function () {
|
7287 |
-
var ret = val.apply( this, arguments );
|
7288 |
-
|
7289 |
-
if ( ret === this ) {
|
7290 |
-
// Returned item is the API instance that was passed in, return it
|
7291 |
-
return this;
|
7292 |
-
}
|
7293 |
-
else if ( ret instanceof _Api ) {
|
7294 |
-
// New API instance returned, want the value from the first item
|
7295 |
-
// in the returned array for the singular result.
|
7296 |
-
return ret.length ?
|
7297 |
-
$.isArray( ret[0] ) ?
|
7298 |
-
new _Api( ret.context, ret[0] ) : // Array results are 'enhanced'
|
7299 |
-
ret[0] :
|
7300 |
-
undefined;
|
7301 |
-
}
|
7302 |
-
|
7303 |
-
// Non-API return - just fire it back
|
7304 |
-
return ret;
|
7305 |
-
} );
|
7306 |
-
};
|
7307 |
-
|
7308 |
-
|
7309 |
-
/**
|
7310 |
-
* Selector for HTML tables. Apply the given selector to the give array of
|
7311 |
-
* WFDataTables settings objects.
|
7312 |
-
*
|
7313 |
-
* @param {string|integer} [selector] jQuery selector string or integer
|
7314 |
-
* @param {array} Array of WFDataTables settings objects to be filtered
|
7315 |
-
* @return {array}
|
7316 |
-
* @ignore
|
7317 |
-
*/
|
7318 |
-
var __table_selector = function ( selector, a )
|
7319 |
-
{
|
7320 |
-
// Integer is used to pick out a table by index
|
7321 |
-
if ( typeof selector === 'number' ) {
|
7322 |
-
return [ a[ selector ] ];
|
7323 |
-
}
|
7324 |
-
|
7325 |
-
// Perform a jQuery selector on the table nodes
|
7326 |
-
var nodes = $.map( a, function (el, i) {
|
7327 |
-
return el.nTable;
|
7328 |
-
} );
|
7329 |
-
|
7330 |
-
return $(nodes)
|
7331 |
-
.filter( selector )
|
7332 |
-
.map( function (i) {
|
7333 |
-
// Need to translate back from the table node to the settings
|
7334 |
-
var idx = $.inArray( this, nodes );
|
7335 |
-
return a[ idx ];
|
7336 |
-
} )
|
7337 |
-
.toArray();
|
7338 |
-
};
|
7339 |
-
|
7340 |
-
|
7341 |
-
|
7342 |
-
/**
|
7343 |
-
* Context selector for the API's context (i.e. the tables the API instance
|
7344 |
-
* refers to.
|
7345 |
-
*
|
7346 |
-
* @name WFDataTable.Api#tables
|
7347 |
-
* @param {string|integer} [selector] Selector to pick which tables the iterator
|
7348 |
-
* should operate on. If not given, all tables in the current context are
|
7349 |
-
* used. This can be given as a jQuery selector (for example `':gt(0)'`) to
|
7350 |
-
* select multiple tables or as an integer to select a single table.
|
7351 |
-
* @returns {WFDataTable.Api} Returns a new API instance if a selector is given.
|
7352 |
-
*/
|
7353 |
-
_api_register( 'tables()', function ( selector ) {
|
7354 |
-
// A new instance is created if there was a selector specified
|
7355 |
-
return selector ?
|
7356 |
-
new _Api( __table_selector( selector, this.context ) ) :
|
7357 |
-
this;
|
7358 |
-
} );
|
7359 |
-
|
7360 |
-
|
7361 |
-
_api_register( 'table()', function ( selector ) {
|
7362 |
-
var tables = this.tables( selector );
|
7363 |
-
var ctx = tables.context;
|
7364 |
-
|
7365 |
-
// Truncate to the first matched table
|
7366 |
-
return ctx.length ?
|
7367 |
-
new _Api( ctx[0] ) :
|
7368 |
-
tables;
|
7369 |
-
} );
|
7370 |
-
|
7371 |
-
|
7372 |
-
_api_registerPlural( 'tables().nodes()', 'table().node()' , function () {
|
7373 |
-
return this.iterator( 'table', function ( ctx ) {
|
7374 |
-
return ctx.nTable;
|
7375 |
-
}, 1 );
|
7376 |
-
} );
|
7377 |
-
|
7378 |
-
|
7379 |
-
_api_registerPlural( 'tables().body()', 'table().body()' , function () {
|
7380 |
-
return this.iterator( 'table', function ( ctx ) {
|
7381 |
-
return ctx.nTBody;
|
7382 |
-
}, 1 );
|
7383 |
-
} );
|
7384 |
-
|
7385 |
-
|
7386 |
-
_api_registerPlural( 'tables().header()', 'table().header()' , function () {
|
7387 |
-
return this.iterator( 'table', function ( ctx ) {
|
7388 |
-
return ctx.nTHead;
|
7389 |
-
}, 1 );
|
7390 |
-
} );
|
7391 |
-
|
7392 |
-
|
7393 |
-
_api_registerPlural( 'tables().footer()', 'table().footer()' , function () {
|
7394 |
-
return this.iterator( 'table', function ( ctx ) {
|
7395 |
-
return ctx.nTFoot;
|
7396 |
-
}, 1 );
|
7397 |
-
} );
|
7398 |
-
|
7399 |
-
|
7400 |
-
_api_registerPlural( 'tables().containers()', 'table().container()' , function () {
|
7401 |
-
return this.iterator( 'table', function ( ctx ) {
|
7402 |
-
return ctx.nTableWrapper;
|
7403 |
-
}, 1 );
|
7404 |
-
} );
|
7405 |
-
|
7406 |
-
|
7407 |
-
|
7408 |
-
/**
|
7409 |
-
* Redraw the tables in the current context.
|
7410 |
-
*/
|
7411 |
-
_api_register( 'draw()', function ( paging ) {
|
7412 |
-
return this.iterator( 'table', function ( settings ) {
|
7413 |
-
if ( paging === 'page' ) {
|
7414 |
-
_fnDraw( settings );
|
7415 |
-
}
|
7416 |
-
else {
|
7417 |
-
if ( typeof paging === 'string' ) {
|
7418 |
-
paging = paging === 'full-hold' ?
|
7419 |
-
false :
|
7420 |
-
true;
|
7421 |
-
}
|
7422 |
-
|
7423 |
-
_fnReDraw( settings, paging===false );
|
7424 |
-
}
|
7425 |
-
} );
|
7426 |
-
} );
|
7427 |
-
|
7428 |
-
|
7429 |
-
|
7430 |
-
/**
|
7431 |
-
* Get the current page index.
|
7432 |
-
*
|
7433 |
-
* @return {integer} Current page index (zero based)
|
7434 |
-
*//**
|
7435 |
-
* Set the current page.
|
7436 |
-
*
|
7437 |
-
* Note that if you attempt to show a page which does not exist, WFDataTables will
|
7438 |
-
* not throw an error, but rather reset the paging.
|
7439 |
-
*
|
7440 |
-
* @param {integer|string} action The paging action to take. This can be one of:
|
7441 |
-
* * `integer` - The page index to jump to
|
7442 |
-
* * `string` - An action to take:
|
7443 |
-
* * `first` - Jump to first page.
|
7444 |
-
* * `next` - Jump to the next page
|
7445 |
-
* * `previous` - Jump to previous page
|
7446 |
-
* * `last` - Jump to the last page.
|
7447 |
-
* @returns {WFDataTables.Api} this
|
7448 |
-
*/
|
7449 |
-
_api_register( 'page()', function ( action ) {
|
7450 |
-
if ( action === undefined ) {
|
7451 |
-
return this.page.info().page; // not an expensive call
|
7452 |
-
}
|
7453 |
-
|
7454 |
-
// else, have an action to take on all tables
|
7455 |
-
return this.iterator( 'table', function ( settings ) {
|
7456 |
-
_fnPageChange( settings, action );
|
7457 |
-
} );
|
7458 |
-
} );
|
7459 |
-
|
7460 |
-
|
7461 |
-
/**
|
7462 |
-
* Paging information for the first table in the current context.
|
7463 |
-
*
|
7464 |
-
* If you require paging information for another table, use the `table()` method
|
7465 |
-
* with a suitable selector.
|
7466 |
-
*
|
7467 |
-
* @return {object} Object with the following properties set:
|
7468 |
-
* * `page` - Current page index (zero based - i.e. the first page is `0`)
|
7469 |
-
* * `pages` - Total number of pages
|
7470 |
-
* * `start` - Display index for the first record shown on the current page
|
7471 |
-
* * `end` - Display index for the last record shown on the current page
|
7472 |
-
* * `length` - Display length (number of records). Note that generally `start
|
7473 |
-
* + length = end`, but this is not always true, for example if there are
|
7474 |
-
* only 2 records to show on the final page, with a length of 10.
|
7475 |
-
* * `recordsTotal` - Full data set length
|
7476 |
-
* * `recordsDisplay` - Data set length once the current filtering criterion
|
7477 |
-
* are applied.
|
7478 |
-
*/
|
7479 |
-
_api_register( 'page.info()', function ( action ) {
|
7480 |
-
if ( this.context.length === 0 ) {
|
7481 |
-
return undefined;
|
7482 |
-
}
|
7483 |
-
|
7484 |
-
var
|
7485 |
-
settings = this.context[0],
|
7486 |
-
start = settings._iDisplayStart,
|
7487 |
-
len = settings.oFeatures.bPaginate ? settings._iDisplayLength : -1,
|
7488 |
-
visRecords = settings.fnRecordsDisplay(),
|
7489 |
-
all = len === -1;
|
7490 |
-
|
7491 |
-
return {
|
7492 |
-
"page": all ? 0 : Math.floor( start / len ),
|
7493 |
-
"pages": all ? 1 : Math.ceil( visRecords / len ),
|
7494 |
-
"start": start,
|
7495 |
-
"end": settings.fnDisplayEnd(),
|
7496 |
-
"length": len,
|
7497 |
-
"recordsTotal": settings.fnRecordsTotal(),
|
7498 |
-
"recordsDisplay": visRecords,
|
7499 |
-
"serverSide": _fnDataSource( settings ) === 'ssp'
|
7500 |
-
};
|
7501 |
-
} );
|
7502 |
-
|
7503 |
-
|
7504 |
-
/**
|
7505 |
-
* Get the current page length.
|
7506 |
-
*
|
7507 |
-
* @return {integer} Current page length. Note `-1` indicates that all records
|
7508 |
-
* are to be shown.
|
7509 |
-
*//**
|
7510 |
-
* Set the current page length.
|
7511 |
-
*
|
7512 |
-
* @param {integer} Page length to set. Use `-1` to show all records.
|
7513 |
-
* @returns {WFDataTables.Api} this
|
7514 |
-
*/
|
7515 |
-
_api_register( 'page.len()', function ( len ) {
|
7516 |
-
// Note that we can't call this function 'length()' because `length`
|
7517 |
-
// is a Javascript property of functions which defines how many arguments
|
7518 |
-
// the function expects.
|
7519 |
-
if ( len === undefined ) {
|
7520 |
-
return this.context.length !== 0 ?
|
7521 |
-
this.context[0]._iDisplayLength :
|
7522 |
-
undefined;
|
7523 |
-
}
|
7524 |
-
|
7525 |
-
// else, set the page length
|
7526 |
-
return this.iterator( 'table', function ( settings ) {
|
7527 |
-
_fnLengthChange( settings, len );
|
7528 |
-
} );
|
7529 |
-
} );
|
7530 |
-
|
7531 |
-
|
7532 |
-
|
7533 |
-
var __reload = function ( settings, holdPosition, callback ) {
|
7534 |
-
// Use the draw event to trigger a callback
|
7535 |
-
if ( callback ) {
|
7536 |
-
var api = new _Api( settings );
|
7537 |
-
|
7538 |
-
api.one( 'draw', function () {
|
7539 |
-
callback( api.ajax.json() );
|
7540 |
-
} );
|
7541 |
-
}
|
7542 |
-
|
7543 |
-
if ( _fnDataSource( settings ) == 'ssp' ) {
|
7544 |
-
_fnReDraw( settings, holdPosition );
|
7545 |
-
}
|
7546 |
-
else {
|
7547 |
-
_fnProcessingDisplay( settings, true );
|
7548 |
-
|
7549 |
-
// Cancel an existing request
|
7550 |
-
var xhr = settings.jqXHR;
|
7551 |
-
if ( xhr && xhr.readyState !== 4 ) {
|
7552 |
-
xhr.abort();
|
7553 |
-
}
|
7554 |
-
|
7555 |
-
// Trigger xhr
|
7556 |
-
_fnBuildAjax( settings, [], function( json ) {
|
7557 |
-
_fnClearTable( settings );
|
7558 |
-
|
7559 |
-
var data = _fnAjaxDataSrc( settings, json );
|
7560 |
-
for ( var i=0, ien=data.length ; i<ien ; i++ ) {
|
7561 |
-
_fnAddData( settings, data[i] );
|
7562 |
-
}
|
7563 |
-
|
7564 |
-
_fnReDraw( settings, holdPosition );
|
7565 |
-
_fnProcessingDisplay( settings, false );
|
7566 |
-
} );
|
7567 |
-
}
|
7568 |
-
};
|
7569 |
-
|
7570 |
-
|
7571 |
-
/**
|
7572 |
-
* Get the JSON response from the last Ajax request that WFDataTables made to the
|
7573 |
-
* server. Note that this returns the JSON from the first table in the current
|
7574 |
-
* context.
|
7575 |
-
*
|
7576 |
-
* @return {object} JSON received from the server.
|
7577 |
-
*/
|
7578 |
-
_api_register( 'ajax.json()', function () {
|
7579 |
-
var ctx = this.context;
|
7580 |
-
|
7581 |
-
if ( ctx.length > 0 ) {
|
7582 |
-
return ctx[0].json;
|
7583 |
-
}
|
7584 |
-
|
7585 |
-
// else return undefined;
|
7586 |
-
} );
|
7587 |
-
|
7588 |
-
|
7589 |
-
/**
|
7590 |
-
* Get the data submitted in the last Ajax request
|
7591 |
-
*/
|
7592 |
-
_api_register( 'ajax.params()', function () {
|
7593 |
-
var ctx = this.context;
|
7594 |
-
|
7595 |
-
if ( ctx.length > 0 ) {
|
7596 |
-
return ctx[0].oAjaxData;
|
7597 |
-
}
|
7598 |
-
|
7599 |
-
// else return undefined;
|
7600 |
-
} );
|
7601 |
-
|
7602 |
-
|
7603 |
-
/**
|
7604 |
-
* Reload tables from the Ajax data source. Note that this function will
|
7605 |
-
* automatically re-draw the table when the remote data has been loaded.
|
7606 |
-
*
|
7607 |
-
* @param {boolean} [reset=true] Reset (default) or hold the current paging
|
7608 |
-
* position. A full re-sort and re-filter is performed when this method is
|
7609 |
-
* called, which is why the pagination reset is the default action.
|
7610 |
-
* @returns {WFDataTables.Api} this
|
7611 |
-
*/
|
7612 |
-
_api_register( 'ajax.reload()', function ( callback, resetPaging ) {
|
7613 |
-
return this.iterator( 'table', function (settings) {
|
7614 |
-
__reload( settings, resetPaging===false, callback );
|
7615 |
-
} );
|
7616 |
-
} );
|
7617 |
-
|
7618 |
-
|
7619 |
-
/**
|
7620 |
-
* Get the current Ajax URL. Note that this returns the URL from the first
|
7621 |
-
* table in the current context.
|
7622 |
-
*
|
7623 |
-
* @return {string} Current Ajax source URL
|
7624 |
-
*//**
|
7625 |
-
* Set the Ajax URL. Note that this will set the URL for all tables in the
|
7626 |
-
* current context.
|
7627 |
-
*
|
7628 |
-
* @param {string} url URL to set.
|
7629 |
-
* @returns {WFDataTables.Api} this
|
7630 |
-
*/
|
7631 |
-
_api_register( 'ajax.url()', function ( url ) {
|
7632 |
-
var ctx = this.context;
|
7633 |
-
|
7634 |
-
if ( url === undefined ) {
|
7635 |
-
// get
|
7636 |
-
if ( ctx.length === 0 ) {
|
7637 |
-
return undefined;
|
7638 |
-
}
|
7639 |
-
ctx = ctx[0];
|
7640 |
-
|
7641 |
-
return ctx.ajax ?
|
7642 |
-
$.isPlainObject( ctx.ajax ) ?
|
7643 |
-
ctx.ajax.url :
|
7644 |
-
ctx.ajax :
|
7645 |
-
ctx.sAjaxSource;
|
7646 |
-
}
|
7647 |
-
|
7648 |
-
// set
|
7649 |
-
return this.iterator( 'table', function ( settings ) {
|
7650 |
-
if ( $.isPlainObject( settings.ajax ) ) {
|
7651 |
-
settings.ajax.url = url;
|
7652 |
-
}
|
7653 |
-
else {
|
7654 |
-
settings.ajax = url;
|
7655 |
-
}
|
7656 |
-
// No need to consider sAjaxSource here since WFDataTables gives priority
|
7657 |
-
// to `ajax` over `sAjaxSource`. So setting `ajax` here, renders any
|
7658 |
-
// value of `sAjaxSource` redundant.
|
7659 |
-
} );
|
7660 |
-
} );
|
7661 |
-
|
7662 |
-
|
7663 |
-
/**
|
7664 |
-
* Load data from the newly set Ajax URL. Note that this method is only
|
7665 |
-
* available when `ajax.url()` is used to set a URL. Additionally, this method
|
7666 |
-
* has the same effect as calling `ajax.reload()` but is provided for
|
7667 |
-
* convenience when setting a new URL. Like `ajax.reload()` it will
|
7668 |
-
* automatically redraw the table once the remote data has been loaded.
|
7669 |
-
*
|
7670 |
-
* @returns {WFDataTables.Api} this
|
7671 |
-
*/
|
7672 |
-
_api_register( 'ajax.url().load()', function ( callback, resetPaging ) {
|
7673 |
-
// Same as a reload, but makes sense to present it for easy access after a
|
7674 |
-
// url change
|
7675 |
-
return this.iterator( 'table', function ( ctx ) {
|
7676 |
-
__reload( ctx, resetPaging===false, callback );
|
7677 |
-
} );
|
7678 |
-
} );
|
7679 |
-
|
7680 |
-
|
7681 |
-
|
7682 |
-
|
7683 |
-
var _selector_run = function ( type, selector, selectFn, settings, opts )
|
7684 |
-
{
|
7685 |
-
var
|
7686 |
-
out = [], res,
|
7687 |
-
a, i, ien, j, jen,
|
7688 |
-
selectorType = typeof selector;
|
7689 |
-
|
7690 |
-
// Can't just check for isArray here, as an API or jQuery instance might be
|
7691 |
-
// given with their array like look
|
7692 |
-
if ( ! selector || selectorType === 'string' || selectorType === 'function' || selector.length === undefined ) {
|
7693 |
-
selector = [ selector ];
|
7694 |
-
}
|
7695 |
-
|
7696 |
-
for ( i=0, ien=selector.length ; i<ien ; i++ ) {
|
7697 |
-
// Only split on simple strings - complex expressions will be jQuery selectors
|
7698 |
-
a = selector[i] && selector[i].split && ! selector[i].match(/[\[\(:]/) ?
|
7699 |
-
selector[i].split(',') :
|
7700 |
-
[ selector[i] ];
|
7701 |
-
|
7702 |
-
for ( j=0, jen=a.length ; j<jen ; j++ ) {
|
7703 |
-
res = selectFn( typeof a[j] === 'string' ? $.trim(a[j]) : a[j] );
|
7704 |
-
|
7705 |
-
if ( res && res.length ) {
|
7706 |
-
out = out.concat( res );
|
7707 |
-
}
|
7708 |
-
}
|
7709 |
-
}
|
7710 |
-
|
7711 |
-
// selector extensions
|
7712 |
-
var ext = _ext.selector[ type ];
|
7713 |
-
if ( ext.length ) {
|
7714 |
-
for ( i=0, ien=ext.length ; i<ien ; i++ ) {
|
7715 |
-
out = ext[i]( settings, opts, out );
|
7716 |
-
}
|
7717 |
-
}
|
7718 |
-
|
7719 |
-
return _unique( out );
|
7720 |
-
};
|
7721 |
-
|
7722 |
-
|
7723 |
-
var _selector_opts = function ( opts )
|
7724 |
-
{
|
7725 |
-
if ( ! opts ) {
|
7726 |
-
opts = {};
|
7727 |
-
}
|
7728 |
-
|
7729 |
-
// Backwards compatibility for 1.9- which used the terminology filter rather
|
7730 |
-
// than search
|
7731 |
-
if ( opts.filter && opts.search === undefined ) {
|
7732 |
-
opts.search = opts.filter;
|
7733 |
-
}
|
7734 |
-
|
7735 |
-
return $.extend( {
|
7736 |
-
search: 'none',
|
7737 |
-
order: 'current',
|
7738 |
-
page: 'all'
|
7739 |
-
}, opts );
|
7740 |
-
};
|
7741 |
-
|
7742 |
-
|
7743 |
-
var _selector_first = function ( inst )
|
7744 |
-
{
|
7745 |
-
// Reduce the API instance to the first item found
|
7746 |
-
for ( var i=0, ien=inst.length ; i<ien ; i++ ) {
|
7747 |
-
if ( inst[i].length > 0 ) {
|
7748 |
-
// Assign the first element to the first item in the instance
|
7749 |
-
// and truncate the instance and context
|
7750 |
-
inst[0] = inst[i];
|
7751 |
-
inst[0].length = 1;
|
7752 |
-
inst.length = 1;
|
7753 |
-
inst.context = [ inst.context[i] ];
|
7754 |
-
|
7755 |
-
return inst;
|
7756 |
-
}
|
7757 |
-
}
|
7758 |
-
|
7759 |
-
// Not found - return an empty instance
|
7760 |
-
inst.length = 0;
|
7761 |
-
return inst;
|
7762 |
-
};
|
7763 |
-
|
7764 |
-
|
7765 |
-
var _selector_row_indexes = function ( settings, opts )
|
7766 |
-
{
|
7767 |
-
var
|
7768 |
-
i, ien, tmp, a=[],
|
7769 |
-
displayFiltered = settings.aiDisplay,
|
7770 |
-
displayMaster = settings.aiDisplayMaster;
|
7771 |
-
|
7772 |
-
var
|
7773 |
-
search = opts.search, // none, applied, removed
|
7774 |
-
order = opts.order, // applied, current, index (original - compatibility with 1.9)
|
7775 |
-
page = opts.page; // all, current
|
7776 |
-
|
7777 |
-
if ( _fnDataSource( settings ) == 'ssp' ) {
|
7778 |
-
// In server-side processing mode, most options are irrelevant since
|
7779 |
-
// rows not shown don't exist and the index order is the applied order
|
7780 |
-
// Removed is a special case - for consistency just return an empty
|
7781 |
-
// array
|
7782 |
-
return search === 'removed' ?
|
7783 |
-
[] :
|
7784 |
-
_range( 0, displayMaster.length );
|
7785 |
-
}
|
7786 |
-
else if ( page == 'current' ) {
|
7787 |
-
// Current page implies that order=current and fitler=applied, since it is
|
7788 |
-
// fairly senseless otherwise, regardless of what order and search actually
|
7789 |
-
// are
|
7790 |
-
for ( i=settings._iDisplayStart, ien=settings.fnDisplayEnd() ; i<ien ; i++ ) {
|
7791 |
-
a.push( displayFiltered[i] );
|
7792 |
-
}
|
7793 |
-
}
|
7794 |
-
else if ( order == 'current' || order == 'applied' ) {
|
7795 |
-
a = search == 'none' ?
|
7796 |
-
displayMaster.slice() : // no search
|
7797 |
-
search == 'applied' ?
|
7798 |
-
displayFiltered.slice() : // applied search
|
7799 |
-
$.map( displayMaster, function (el, i) { // removed search
|
7800 |
-
return $.inArray( el, displayFiltered ) === -1 ? el : null;
|
7801 |
-
} );
|
7802 |
-
}
|
7803 |
-
else if ( order == 'index' || order == 'original' ) {
|
7804 |
-
for ( i=0, ien=settings.aoData.length ; i<ien ; i++ ) {
|
7805 |
-
if ( search == 'none' ) {
|
7806 |
-
a.push( i );
|
7807 |
-
}
|
7808 |
-
else { // applied | removed
|
7809 |
-
tmp = $.inArray( i, displayFiltered );
|
7810 |
-
|
7811 |
-
if ((tmp === -1 && search == 'removed') ||
|
7812 |
-
(tmp >= 0 && search == 'applied') )
|
7813 |
-
{
|
7814 |
-
a.push( i );
|
7815 |
-
}
|
7816 |
-
}
|
7817 |
-
}
|
7818 |
-
}
|
7819 |
-
|
7820 |
-
return a;
|
7821 |
-
};
|
7822 |
-
|
7823 |
-
|
7824 |
-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
7825 |
-
* Rows
|
7826 |
-
*
|
7827 |
-
* {} - no selector - use all available rows
|
7828 |
-
* {integer} - row aoData index
|
7829 |
-
* {node} - TR node
|
7830 |
-
* {string} - jQuery selector to apply to the TR elements
|
7831 |
-
* {array} - jQuery array of nodes, or simply an array of TR nodes
|
7832 |
-
*
|
7833 |
-
*/
|
7834 |
-
|
7835 |
-
|
7836 |
-
var __row_selector = function ( settings, selector, opts )
|
7837 |
-
{
|
7838 |
-
var rows;
|
7839 |
-
var run = function ( sel ) {
|
7840 |
-
var selInt = _intVal( sel );
|
7841 |
-
var i, ien;
|
7842 |
-
|
7843 |
-
// Short cut - selector is a number and no options provided (default is
|
7844 |
-
// all records, so no need to check if the index is in there, since it
|
7845 |
-
// must be - dev error if the index doesn't exist).
|
7846 |
-
if ( selInt !== null && ! opts ) {
|
7847 |
-
return [ selInt ];
|
7848 |
-
}
|
7849 |
-
|
7850 |
-
if ( ! rows ) {
|
7851 |
-
rows = _selector_row_indexes( settings, opts );
|
7852 |
-
}
|
7853 |
-
|
7854 |
-
if ( selInt !== null && $.inArray( selInt, rows ) !== -1 ) {
|
7855 |
-
// Selector - integer
|
7856 |
-
return [ selInt ];
|
7857 |
-
}
|
7858 |
-
else if ( sel === null || sel === undefined || sel === '' ) {
|
7859 |
-
// Selector - none
|
7860 |
-
return rows;
|
7861 |
-
}
|
7862 |
-
|
7863 |
-
// Selector - function
|
7864 |
-
if ( typeof sel === 'function' ) {
|
7865 |
-
return $.map( rows, function (idx) {
|
7866 |
-
var row = settings.aoData[ idx ];
|
7867 |
-
return sel( idx, row._aData, row.nTr ) ? idx : null;
|
7868 |
-
} );
|
7869 |
-
}
|
7870 |
-
|
7871 |
-
// Get nodes in the order from the `rows` array with null values removed
|
7872 |
-
var nodes = _removeEmpty(
|
7873 |
-
_pluck_order( settings.aoData, rows, 'nTr' )
|
7874 |
-
);
|
7875 |
-
|
7876 |
-
// Selector - node
|
7877 |
-
if ( sel.nodeName ) {
|
7878 |
-
if ( sel._DT_RowIndex !== undefined ) {
|
7879 |
-
return [ sel._DT_RowIndex ]; // Property added by DT for fast lookup
|
7880 |
-
}
|
7881 |
-
else if ( sel._DT_CellIndex ) {
|
7882 |
-
return [ sel._DT_CellIndex.row ];
|
7883 |
-
}
|
7884 |
-
else {
|
7885 |
-
var host = $(sel).closest('*[data-dt-row]');
|
7886 |
-
return host.length ?
|
7887 |
-
[ host.data('dt-row') ] :
|
7888 |
-
[];
|
7889 |
-
}
|
7890 |
-
}
|
7891 |
-
|
7892 |
-
// ID selector. Want to always be able to select rows by id, regardless
|
7893 |
-
// of if the tr element has been created or not, so can't rely upon
|
7894 |
-
// jQuery here - hence a custom implementation. This does not match
|
7895 |
-
// Sizzle's fast selector or HTML4 - in HTML5 the ID can be anything,
|
7896 |
-
// but to select it using a CSS selector engine (like Sizzle or
|
7897 |
-
// querySelect) it would need to need to be escaped for some characters.
|
7898 |
-
// WFDataTables simplifies this for row selectors since you can select
|
7899 |
-
// only a row. A # indicates an id any anything that follows is the id -
|
7900 |
-
// unescaped.
|
7901 |
-
if ( typeof sel === 'string' && sel.charAt(0) === '#' ) {
|
7902 |
-
// get row index from id
|
7903 |
-
var rowObj = settings.aIds[ sel.replace( /^#/, '' ) ];
|
7904 |
-
if ( rowObj !== undefined ) {
|
7905 |
-
return [ rowObj.idx ];
|
7906 |
-
}
|
7907 |
-
|
7908 |
-
// need to fall through to jQuery in case there is DOM id that
|
7909 |
-
// matches
|
7910 |
-
}
|
7911 |
-
|
7912 |
-
// Selector - jQuery selector string, array of nodes or jQuery object/
|
7913 |
-
// As jQuery's .filter() allows jQuery objects to be passed in filter,
|
7914 |
-
// it also allows arrays, so this will cope with all three options
|
7915 |
-
return $(nodes)
|
7916 |
-
.filter( sel )
|
7917 |
-
.map( function () {
|
7918 |
-
return this._DT_RowIndex;
|
7919 |
-
} )
|
7920 |
-
.toArray();
|
7921 |
-
};
|
7922 |
-
|
7923 |
-
return _selector_run( 'row', selector, run, settings, opts );
|
7924 |
-
};
|
7925 |
-
|
7926 |
-
|
7927 |
-
_api_register( 'rows()', function ( selector, opts ) {
|
7928 |
-
// argument shifting
|
7929 |
-
if ( selector === undefined ) {
|
7930 |
-
selector = '';
|
7931 |
-
}
|
7932 |
-
else if ( $.isPlainObject( selector ) ) {
|
7933 |
-
opts = selector;
|
7934 |
-
selector = '';
|
7935 |
-
}
|
7936 |
-
|
7937 |
-
opts = _selector_opts( opts );
|
7938 |
-
|
7939 |
-
var inst = this.iterator( 'table', function ( settings ) {
|
7940 |
-
return __row_selector( settings, selector, opts );
|
7941 |
-
}, 1 );
|
7942 |
-
|
7943 |
-
// Want argument shifting here and in __row_selector?
|
7944 |
-
inst.selector.rows = selector;
|
7945 |
-
inst.selector.opts = opts;
|
7946 |
-
|
7947 |
-
return inst;
|
7948 |
-
} );
|
7949 |
-
|
7950 |
-
_api_register( 'rows().nodes()', function () {
|
7951 |
-
return this.iterator( 'row', function ( settings, row ) {
|
7952 |
-
return settings.aoData[ row ].nTr || undefined;
|
7953 |
-
}, 1 );
|
7954 |
-
} );
|
7955 |
-
|
7956 |
-
_api_register( 'rows().data()', function () {
|
7957 |
-
return this.iterator( true, 'rows', function ( settings, rows ) {
|
7958 |
-
return _pluck_order( settings.aoData, rows, '_aData' );
|
7959 |
-
}, 1 );
|
7960 |
-
} );
|
7961 |
-
|
7962 |
-
_api_registerPlural( 'rows().cache()', 'row().cache()', function ( type ) {
|
7963 |
-
return this.iterator( 'row', function ( settings, row ) {
|
7964 |
-
var r = settings.aoData[ row ];
|
7965 |
-
return type === 'search' ? r._aFilterData : r._aSortData;
|
7966 |
-
}, 1 );
|
7967 |
-
} );
|
7968 |
-
|
7969 |
-
_api_registerPlural( 'rows().invalidate()', 'row().invalidate()', function ( src ) {
|
7970 |
-
return this.iterator( 'row', function ( settings, row ) {
|
7971 |
-
_fnInvalidate( settings, row, src );
|
7972 |
-
} );
|
7973 |
-
} );
|
7974 |
-
|
7975 |
-
_api_registerPlural( 'rows().indexes()', 'row().index()', function () {
|
7976 |
-
return this.iterator( 'row', function ( settings, row ) {
|
7977 |
-
return row;
|
7978 |
-
}, 1 );
|
7979 |
-
} );
|
7980 |
-
|
7981 |
-
_api_registerPlural( 'rows().ids()', 'row().id()', function ( hash ) {
|
7982 |
-
var a = [];
|
7983 |
-
var context = this.context;
|
7984 |
-
|
7985 |
-
// `iterator` will drop undefined values, but in this case we want them
|
7986 |
-
for ( var i=0, ien=context.length ; i<ien ; i++ ) {
|
7987 |
-
for ( var j=0, jen=this[i].length ; j<jen ; j++ ) {
|
7988 |
-
var id = context[i].rowIdFn( context[i].aoData[ this[i][j] ]._aData );
|
7989 |
-
a.push( (hash === true ? '#' : '' )+ id );
|
7990 |
-
}
|
7991 |
-
}
|
7992 |
-
|
7993 |
-
return new _Api( context, a );
|
7994 |
-
} );
|
7995 |
-
|
7996 |
-
_api_registerPlural( 'rows().remove()', 'row().remove()', function () {
|
7997 |
-
var that = this;
|
7998 |
-
|
7999 |
-
this.iterator( 'row', function ( settings, row, thatIdx ) {
|
8000 |
-
var data = settings.aoData;
|
8001 |
-
var rowData = data[ row ];
|
8002 |
-
var i, ien, j, jen;
|
8003 |
-
var loopRow, loopCells;
|
8004 |
-
|
8005 |
-
data.splice( row, 1 );
|
8006 |
-
|
8007 |
-
// Update the cached indexes
|
8008 |
-
for ( i=0, ien=data.length ; i<ien ; i++ ) {
|
8009 |
-
loopRow = data[i];
|
8010 |
-
loopCells = loopRow.anCells;
|
8011 |
-
|
8012 |
-
// Rows
|
8013 |
-
if ( loopRow.nTr !== null ) {
|
8014 |
-
loopRow.nTr._DT_RowIndex = i;
|
8015 |
-
}
|
8016 |
-
|
8017 |
-
// Cells
|
8018 |
-
if ( loopCells !== null ) {
|
8019 |
-
for ( j=0, jen=loopCells.length ; j<jen ; j++ ) {
|
8020 |
-
loopCells[j]._DT_CellIndex.row = i;
|
8021 |
-
}
|
8022 |
-
}
|
8023 |
-
}
|
8024 |
-
|
8025 |
-
// Delete from the display arrays
|
8026 |
-
_fnDeleteIndex( settings.aiDisplayMaster, row );
|
8027 |
-
_fnDeleteIndex( settings.aiDisplay, row );
|
8028 |
-
_fnDeleteIndex( that[ thatIdx ], row, false ); // maintain local indexes
|
8029 |
-
|
8030 |
-
// Check for an 'overflow' they case for displaying the table
|
8031 |
-
_fnLengthOverflow( settings );
|
8032 |
-
|
8033 |
-
// Remove the row's ID reference if there is one
|
8034 |
-
var id = settings.rowIdFn( rowData._aData );
|
8035 |
-
if ( id !== undefined ) {
|
8036 |
-
delete settings.aIds[ id ];
|
8037 |
-
}
|
8038 |
-
} );
|
8039 |
-
|
8040 |
-
this.iterator( 'table', function ( settings ) {
|
8041 |
-
for ( var i=0, ien=settings.aoData.length ; i<ien ; i++ ) {
|
8042 |
-
settings.aoData[i].idx = i;
|
8043 |
-
}
|
8044 |
-
} );
|
8045 |
-
|
8046 |
-
return this;
|
8047 |
-
} );
|
8048 |
-
|
8049 |
-
|
8050 |
-
_api_register( 'rows.add()', function ( rows ) {
|
8051 |
-
var newRows = this.iterator( 'table', function ( settings ) {
|
8052 |
-
var row, i, ien;
|
8053 |
-
var out = [];
|
8054 |
-
|
8055 |
-
for ( i=0, ien=rows.length ; i<ien ; i++ ) {
|
8056 |
-
row = rows[i];
|
8057 |
-
|
8058 |
-
if ( row.nodeName && row.nodeName.toUpperCase() === 'TR' ) {
|
8059 |
-
out.push( _fnAddTr( settings, row )[0] );
|
8060 |
-
}
|
8061 |
-
else {
|
8062 |
-
out.push( _fnAddData( settings, row ) );
|
8063 |
-
}
|
8064 |
-
}
|
8065 |
-
|
8066 |
-
return out;
|
8067 |
-
}, 1 );
|
8068 |
-
|
8069 |
-
// Return an Api.rows() extended instance, so rows().nodes() etc can be used
|
8070 |
-
var modRows = this.rows( -1 );
|
8071 |
-
modRows.pop();
|
8072 |
-
$.merge( modRows, newRows );
|
8073 |
-
|
8074 |
-
return modRows;
|
8075 |
-
} );
|
8076 |
-
|
8077 |
-
|
8078 |
-
|
8079 |
-
|
8080 |
-
|
8081 |
-
/**
|
8082 |
-
*
|
8083 |
-
*/
|
8084 |
-
_api_register( 'row()', function ( selector, opts ) {
|
8085 |
-
return _selector_first( this.rows( selector, opts ) );
|
8086 |
-
} );
|
8087 |
-
|
8088 |
-
|
8089 |
-
_api_register( 'row().data()', function ( data ) {
|
8090 |
-
var ctx = this.context;
|
8091 |
-
|
8092 |
-
if ( data === undefined ) {
|
8093 |
-
// Get
|
8094 |
-
return ctx.length && this.length ?
|
8095 |
-
ctx[0].aoData[ this[0] ]._aData :
|
8096 |
-
undefined;
|
8097 |
-
}
|
8098 |
-
|
8099 |
-
// Set
|
8100 |
-
ctx[0].aoData[ this[0] ]._aData = data;
|
8101 |
-
|
8102 |
-
// Automatically invalidate
|
8103 |
-
_fnInvalidate( ctx[0], this[0], 'data' );
|
8104 |
-
|
8105 |
-
return this;
|
8106 |
-
} );
|
8107 |
-
|
8108 |
-
|
8109 |
-
_api_register( 'row().node()', function () {
|
8110 |
-
var ctx = this.context;
|
8111 |
-
|
8112 |
-
return ctx.length && this.length ?
|
8113 |
-
ctx[0].aoData[ this[0] ].nTr || null :
|
8114 |
-
null;
|
8115 |
-
} );
|
8116 |
-
|
8117 |
-
|
8118 |
-
_api_register( 'row.add()', function ( row ) {
|
8119 |
-
// Allow a jQuery object to be passed in - only a single row is added from
|
8120 |
-
// it though - the first element in the set
|
8121 |
-
if ( row instanceof $ && row.length ) {
|
8122 |
-
row = row[0];
|
8123 |
-
}
|
8124 |
-
|
8125 |
-
var rows = this.iterator( 'table', function ( settings ) {
|
8126 |
-
if ( row.nodeName && row.nodeName.toUpperCase() === 'TR' ) {
|
8127 |
-
return _fnAddTr( settings, row )[0];
|
8128 |
-
}
|
8129 |
-
return _fnAddData( settings, row );
|
8130 |
-
} );
|
8131 |
-
|
8132 |
-
// Return an Api.rows() extended instance, with the newly added row selected
|
8133 |
-
return this.row( rows[0] );
|
8134 |
-
} );
|
8135 |
-
|
8136 |
-
|
8137 |
-
|
8138 |
-
var __details_add = function ( ctx, row, data, klass )
|
8139 |
-
{
|
8140 |
-
// Convert to array of TR elements
|
8141 |
-
var rows = [];
|
8142 |
-
var addRow = function ( r, k ) {
|
8143 |
-
// Recursion to allow for arrays of jQuery objects
|
8144 |
-
if ( $.isArray( r ) || r instanceof $ ) {
|
8145 |
-
for ( var i=0, ien=r.length ; i<ien ; i++ ) {
|
8146 |
-
addRow( r[i], k );
|
8147 |
-
}
|
8148 |
-
return;
|
8149 |
-
}
|
8150 |
-
|
8151 |
-
// If we get a TR element, then just add it directly - up to the dev
|
8152 |
-
// to add the correct number of columns etc
|
8153 |
-
if ( r.nodeName && r.nodeName.toLowerCase() === 'tr' ) {
|
8154 |
-
rows.push( r );
|
8155 |
-
}
|
8156 |
-
else {
|
8157 |
-
// Otherwise create a row with a wrapper
|
8158 |
-
var created = $('<tr><td/></tr>').addClass( k );
|
8159 |
-
$('td', created)
|
8160 |
-
.addClass( k )
|
8161 |
-
.html( r )
|
8162 |
-
[0].colSpan = _fnVisbleColumns( ctx );
|
8163 |
-
|
8164 |
-
rows.push( created[0] );
|
8165 |
-
}
|
8166 |
-
};
|
8167 |
-
|
8168 |
-
addRow( data, klass );
|
8169 |
-
|
8170 |
-
if ( row._details ) {
|
8171 |
-
row._details.detach();
|
8172 |
-
}
|
8173 |
-
|
8174 |
-
row._details = $(rows);
|
8175 |
-
|
8176 |
-
// If the children were already shown, that state should be retained
|
8177 |
-
if ( row._detailsShow ) {
|
8178 |
-
row._details.insertAfter( row.nTr );
|
8179 |
-
}
|
8180 |
-
};
|
8181 |
-
|
8182 |
-
|
8183 |
-
var __details_remove = function ( api, idx )
|
8184 |
-
{
|
8185 |
-
var ctx = api.context;
|
8186 |
-
|
8187 |
-
if ( ctx.length ) {
|
8188 |
-
var row = ctx[0].aoData[ idx !== undefined ? idx : api[0] ];
|
8189 |
-
|
8190 |
-
if ( row && row._details ) {
|
8191 |
-
row._details.remove();
|
8192 |
-
|
8193 |
-
row._detailsShow = undefined;
|
8194 |
-
row._details = undefined;
|
8195 |
-
}
|
8196 |
-
}
|
8197 |
-
};
|
8198 |
-
|
8199 |
-
|
8200 |
-
var __details_display = function ( api, show ) {
|
8201 |
-
var ctx = api.context;
|
8202 |
-
|
8203 |
-
if ( ctx.length && api.length ) {
|
8204 |
-
var row = ctx[0].aoData[ api[0] ];
|
8205 |
-
|
8206 |
-
if ( row._details ) {
|
8207 |
-
row._detailsShow = show;
|
8208 |
-
|
8209 |
-
if ( show ) {
|
8210 |
-
row._details.insertAfter( row.nTr );
|
8211 |
-
}
|
8212 |
-
else {
|
8213 |
-
row._details.detach();
|
8214 |
-
}
|
8215 |
-
|
8216 |
-
__details_events( ctx[0] );
|
8217 |
-
}
|
8218 |
-
}
|
8219 |
-
};
|
8220 |
-
|
8221 |
-
|
8222 |
-
var __details_events = function ( settings )
|
8223 |
-
{
|
8224 |
-
var api = new _Api( settings );
|
8225 |
-
var namespace = '.dt.DT_details';
|
8226 |
-
var drawEvent = 'draw'+namespace;
|
8227 |
-
var colvisEvent = 'column-visibility'+namespace;
|
8228 |
-
var destroyEvent = 'destroy'+namespace;
|
8229 |
-
var data = settings.aoData;
|
8230 |
-
|
8231 |
-
api.off( drawEvent +' '+ colvisEvent +' '+ destroyEvent );
|
8232 |
-
|
8233 |
-
if ( _pluck( data, '_details' ).length > 0 ) {
|
8234 |
-
// On each draw, insert the required elements into the document
|
8235 |
-
api.on( drawEvent, function ( e, ctx ) {
|
8236 |
-
if ( settings !== ctx ) {
|
8237 |
-
return;
|
8238 |
-
}
|
8239 |
-
|
8240 |
-
api.rows( {page:'current'} ).eq(0).each( function (idx) {
|
8241 |
-
// Internal data grab
|
8242 |
-
var row = data[ idx ];
|
8243 |
-
|
8244 |
-
if ( row._detailsShow ) {
|
8245 |
-
row._details.insertAfter( row.nTr );
|
8246 |
-
}
|
8247 |
-
} );
|
8248 |
-
} );
|
8249 |
-
|
8250 |
-
// Column visibility change - update the colspan
|
8251 |
-
api.on( colvisEvent, function ( e, ctx, idx, vis ) {
|
8252 |
-
if ( settings !== ctx ) {
|
8253 |
-
return;
|
8254 |
-
}
|
8255 |
-
|
8256 |
-
// Update the colspan for the details rows (note, only if it already has
|
8257 |
-
// a colspan)
|
8258 |
-
var row, visible = _fnVisbleColumns( ctx );
|
8259 |
-
|
8260 |
-
for ( var i=0, ien=data.length ; i<ien ; i++ ) {
|
8261 |
-
row = data[i];
|
8262 |
-
|
8263 |
-
if ( row._details ) {
|
8264 |
-
row._details.children('td[colspan]').attr('colspan', visible );
|
8265 |
-
}
|
8266 |
-
}
|
8267 |
-
} );
|
8268 |
-
|
8269 |
-
// Table destroyed - nuke any child rows
|
8270 |
-
api.on( destroyEvent, function ( e, ctx ) {
|
8271 |
-
if ( settings !== ctx ) {
|
8272 |
-
return;
|
8273 |
-
}
|
8274 |
-
|
8275 |
-
for ( var i=0, ien=data.length ; i<ien ; i++ ) {
|
8276 |
-
if ( data[i]._details ) {
|
8277 |
-
__details_remove( api, i );
|
8278 |
-
}
|
8279 |
-
}
|
8280 |
-
} );
|
8281 |
-
}
|
8282 |
-
};
|
8283 |
-
|
8284 |
-
// Strings for the method names to help minification
|
8285 |
-
var _emp = '';
|
8286 |
-
var _child_obj = _emp+'row().child';
|
8287 |
-
var _child_mth = _child_obj+'()';
|
8288 |
-
|
8289 |
-
// data can be:
|
8290 |
-
// tr
|
8291 |
-
// string
|
8292 |
-
// jQuery or array of any of the above
|
8293 |
-
_api_register( _child_mth, function ( data, klass ) {
|
8294 |
-
var ctx = this.context;
|
8295 |
-
|
8296 |
-
if ( data === undefined ) {
|
8297 |
-
// get
|
8298 |
-
return ctx.length && this.length ?
|
8299 |
-
ctx[0].aoData[ this[0] ]._details :
|
8300 |
-
undefined;
|
8301 |
-
}
|
8302 |
-
else if ( data === true ) {
|
8303 |
-
// show
|
8304 |
-
this.child.show();
|
8305 |
-
}
|
8306 |
-
else if ( data === false ) {
|
8307 |
-
// remove
|
8308 |
-
__details_remove( this );
|
8309 |
-
}
|
8310 |
-
else if ( ctx.length && this.length ) {
|
8311 |
-
// set
|
8312 |
-
__details_add( ctx[0], ctx[0].aoData[ this[0] ], data, klass );
|
8313 |
-
}
|
8314 |
-
|
8315 |
-
return this;
|
8316 |
-
} );
|
8317 |
-
|
8318 |
-
|
8319 |
-
_api_register( [
|
8320 |
-
_child_obj+'.show()',
|
8321 |
-
_child_mth+'.show()' // only when `child()` was called with parameters (without
|
8322 |
-
], function ( show ) { // it returns an object and this method is not executed)
|
8323 |
-
__details_display( this, true );
|
8324 |
-
return this;
|
8325 |
-
} );
|
8326 |
-
|
8327 |
-
|
8328 |
-
_api_register( [
|
8329 |
-
_child_obj+'.hide()',
|
8330 |
-
_child_mth+'.hide()' // only when `child()` was called with parameters (without
|
8331 |
-
], function () { // it returns an object and this method is not executed)
|
8332 |
-
__details_display( this, false );
|
8333 |
-
return this;
|
8334 |
-
} );
|
8335 |
-
|
8336 |
-
|
8337 |
-
_api_register( [
|
8338 |
-
_child_obj+'.remove()',
|
8339 |
-
_child_mth+'.remove()' // only when `child()` was called with parameters (without
|
8340 |
-
], function () { // it returns an object and this method is not executed)
|
8341 |
-
__details_remove( this );
|
8342 |
-
return this;
|
8343 |
-
} );
|
8344 |
-
|
8345 |
-
|
8346 |
-
_api_register( _child_obj+'.isShown()', function () {
|
8347 |
-
var ctx = this.context;
|
8348 |
-
|
8349 |
-
if ( ctx.length && this.length ) {
|
8350 |
-
// _detailsShown as false or undefined will fall through to return false
|
8351 |
-
return ctx[0].aoData[ this[0] ]._detailsShow || false;
|
8352 |
-
}
|
8353 |
-
return false;
|
8354 |
-
} );
|
8355 |
-
|
8356 |
-
|
8357 |
-
|
8358 |
-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
8359 |
-
* Columns
|
8360 |
-
*
|
8361 |
-
* {integer} - column index (>=0 count from left, <0 count from right)
|
8362 |
-
* "{integer}:visIdx" - visible column index (i.e. translate to column index) (>=0 count from left, <0 count from right)
|
8363 |
-
* "{integer}:visible" - alias for {integer}:visIdx (>=0 count from left, <0 count from right)
|
8364 |
-
* "{string}:name" - column name
|
8365 |
-
* "{string}" - jQuery selector on column header nodes
|
8366 |
-
*
|
8367 |
-
*/
|
8368 |
-
|
8369 |
-
// can be an array of these items, comma separated list, or an array of comma
|
8370 |
-
// separated lists
|
8371 |
-
|
8372 |
-
var __re_column_selector = /^([^:]+):(name|visIdx|visible)$/;
|
8373 |
-
|
8374 |
-
|
8375 |
-
// r1 and r2 are redundant - but it means that the parameters match for the
|
8376 |
-
// iterator callback in columns().data()
|
8377 |
-
var __columnData = function ( settings, column, r1, r2, rows ) {
|
8378 |
-
var a = [];
|
8379 |
-
for ( var row=0, ien=rows.length ; row<ien ; row++ ) {
|
8380 |
-
a.push( _fnGetCellData( settings, rows[row], column ) );
|
8381 |
-
}
|
8382 |
-
return a;
|
8383 |
-
};
|
8384 |
-
|
8385 |
-
|
8386 |
-
var __column_selector = function ( settings, selector, opts )
|
8387 |
-
{
|
8388 |
-
var
|
8389 |
-
columns = settings.aoColumns,
|
8390 |
-
names = _pluck( columns, 'sName' ),
|
8391 |
-
nodes = _pluck( columns, 'nTh' );
|
8392 |
-
|
8393 |
-
var run = function ( s ) {
|
8394 |
-
var selInt = _intVal( s );
|
8395 |
-
|
8396 |
-
// Selector - all
|
8397 |
-
if ( s === '' ) {
|
8398 |
-
return _range( columns.length );
|
8399 |
-
}
|
8400 |
-
|
8401 |
-
// Selector - index
|
8402 |
-
if ( selInt !== null ) {
|
8403 |
-
return [ selInt >= 0 ?
|
8404 |
-
selInt : // Count from left
|
8405 |
-
columns.length + selInt // Count from right (+ because its a negative value)
|
8406 |
-
];
|
8407 |
-
}
|
8408 |
-
|
8409 |
-
// Selector = function
|
8410 |
-
if ( typeof s === 'function' ) {
|
8411 |
-
var rows = _selector_row_indexes( settings, opts );
|
8412 |
-
|
8413 |
-
return $.map( columns, function (col, idx) {
|
8414 |
-
return s(
|
8415 |
-
idx,
|
8416 |
-
__columnData( settings, idx, 0, 0, rows ),
|
8417 |
-
nodes[ idx ]
|
8418 |
-
) ? idx : null;
|
8419 |
-
} );
|
8420 |
-
}
|
8421 |
-
|
8422 |
-
// jQuery or string selector
|
8423 |
-
var match = typeof s === 'string' ?
|
8424 |
-
s.match( __re_column_selector ) :
|
8425 |
-
'';
|
8426 |
-
|
8427 |
-
if ( match ) {
|
8428 |
-
switch( match[2] ) {
|
8429 |
-
case 'visIdx':
|
8430 |
-
case 'visible':
|
8431 |
-
var idx = parseInt( match[1], 10 );
|
8432 |
-
// Visible index given, convert to column index
|
8433 |
-
if ( idx < 0 ) {
|
8434 |
-
// Counting from the right
|
8435 |
-
var visColumns = $.map( columns, function (col,i) {
|
8436 |
-
return col.bVisible ? i : null;
|
8437 |
-
} );
|
8438 |
-
return [ visColumns[ visColumns.length + idx ] ];
|
8439 |
-
}
|
8440 |
-
// Counting from the left
|
8441 |
-
return [ _fnVisibleToColumnIndex( settings, idx ) ];
|
8442 |
-
|
8443 |
-
case 'name':
|
8444 |
-
// match by name. `names` is column index complete and in order
|
8445 |
-
return $.map( names, function (name, i) {
|
8446 |
-
return name === match[1] ? i : null;
|
8447 |
-
} );
|
8448 |
-
|
8449 |
-
default:
|
8450 |
-
return [];
|
8451 |
-
}
|
8452 |
-
}
|
8453 |
-
|
8454 |
-
// Cell in the table body
|
8455 |
-
if ( s.nodeName && s._DT_CellIndex ) {
|
8456 |
-
return [ s._DT_CellIndex.column ];
|
8457 |
-
}
|
8458 |
-
|
8459 |
-
// jQuery selector on the TH elements for the columns
|
8460 |
-
var jqResult = $( nodes )
|
8461 |
-
.filter( s )
|
8462 |
-
.map( function () {
|
8463 |
-
return $.inArray( this, nodes ); // `nodes` is column index complete and in order
|
8464 |
-
} )
|
8465 |
-
.toArray();
|
8466 |
-
|
8467 |
-
if ( jqResult.length || ! s.nodeName ) {
|
8468 |
-
return jqResult;
|
8469 |
-
}
|
8470 |
-
|
8471 |
-
// Otherwise a node which might have a `dt-column` data attribute, or be
|
8472 |
-
// a child or such an element
|
8473 |
-
var host = $(s).closest('*[data-dt-column]');
|
8474 |
-
return host.length ?
|
8475 |
-
[ host.data('dt-column') ] :
|
8476 |
-
[];
|
8477 |
-
};
|
8478 |
-
|
8479 |
-
return _selector_run( 'column', selector, run, settings, opts );
|
8480 |
-
};
|
8481 |
-
|
8482 |
-
|
8483 |
-
var __setColumnVis = function ( settings, column, vis ) {
|
8484 |
-
var
|
8485 |
-
cols = settings.aoColumns,
|
8486 |
-
col = cols[ column ],
|
8487 |
-
data = settings.aoData,
|
8488 |
-
row, cells, i, ien, tr;
|
8489 |
-
|
8490 |
-
// Get
|
8491 |
-
if ( vis === undefined ) {
|
8492 |
-
return col.bVisible;
|
8493 |
-
}
|
8494 |
-
|
8495 |
-
// Set
|
8496 |
-
// No change
|
8497 |
-
if ( col.bVisible === vis ) {
|
8498 |
-
return;
|
8499 |
-
}
|
8500 |
-
|
8501 |
-
if ( vis ) {
|
8502 |
-
// Insert column
|
8503 |
-
// Need to decide if we should use appendChild or insertBefore
|
8504 |
-
var insertBefore = $.inArray( true, _pluck(cols, 'bVisible'), column+1 );
|
8505 |
-
|
8506 |
-
for ( i=0, ien=data.length ; i<ien ; i++ ) {
|
8507 |
-
tr = data[i].nTr;
|
8508 |
-
cells = data[i].anCells;
|
8509 |
-
|
8510 |
-
if ( tr ) {
|
8511 |
-
// insertBefore can act like appendChild if 2nd arg is null
|
8512 |
-
tr.insertBefore( cells[ column ], cells[ insertBefore ] || null );
|
8513 |
-
}
|
8514 |
-
}
|
8515 |
-
}
|
8516 |
-
else {
|
8517 |
-
// Remove column
|
8518 |
-
$( _pluck( settings.aoData, 'anCells', column ) ).detach();
|
8519 |
-
}
|
8520 |
-
|
8521 |
-
// Common actions
|
8522 |
-
col.bVisible = vis;
|
8523 |
-
_fnDrawHead( settings, settings.aoHeader );
|
8524 |
-
_fnDrawHead( settings, settings.aoFooter );
|
8525 |
-
|
8526 |
-
_fnSaveState( settings );
|
8527 |
-
};
|
8528 |
-
|
8529 |
-
|
8530 |
-
_api_register( 'columns()', function ( selector, opts ) {
|
8531 |
-
// argument shifting
|
8532 |
-
if ( selector === undefined ) {
|
8533 |
-
selector = '';
|
8534 |
-
}
|
8535 |
-
else if ( $.isPlainObject( selector ) ) {
|
8536 |
-
opts = selector;
|
8537 |
-
selector = '';
|
8538 |
-
}
|
8539 |
-
|
8540 |
-
opts = _selector_opts( opts );
|
8541 |
-
|
8542 |
-
var inst = this.iterator( 'table', function ( settings ) {
|
8543 |
-
return __column_selector( settings, selector, opts );
|
8544 |
-
}, 1 );
|
8545 |
-
|
8546 |
-
// Want argument shifting here and in _row_selector?
|
8547 |
-
inst.selector.cols = selector;
|
8548 |
-
inst.selector.opts = opts;
|
8549 |
-
|
8550 |
-
return inst;
|
8551 |
-
} );
|
8552 |
-
|
8553 |
-
_api_registerPlural( 'columns().header()', 'column().header()', function ( selector, opts ) {
|
8554 |
-
return this.iterator( 'column', function ( settings, column ) {
|
8555 |
-
return settings.aoColumns[column].nTh;
|
8556 |
-
}, 1 );
|
8557 |
-
} );
|
8558 |
-
|
8559 |
-
_api_registerPlural( 'columns().footer()', 'column().footer()', function ( selector, opts ) {
|
8560 |
-
return this.iterator( 'column', function ( settings, column ) {
|
8561 |
-
return settings.aoColumns[column].nTf;
|
8562 |
-
}, 1 );
|
8563 |
-
} );
|
8564 |
-
|
8565 |
-
_api_registerPlural( 'columns().data()', 'column().data()', function () {
|
8566 |
-
return this.iterator( 'column-rows', __columnData, 1 );
|
8567 |
-
} );
|
8568 |
-
|
8569 |
-
_api_registerPlural( 'columns().dataSrc()', 'column().dataSrc()', function () {
|
8570 |
-
return this.iterator( 'column', function ( settings, column ) {
|
8571 |
-
return settings.aoColumns[column].mData;
|
8572 |
-
}, 1 );
|
8573 |
-
} );
|
8574 |
-
|
8575 |
-
_api_registerPlural( 'columns().cache()', 'column().cache()', function ( type ) {
|
8576 |
-
return this.iterator( 'column-rows', function ( settings, column, i, j, rows ) {
|
8577 |
-
return _pluck_order( settings.aoData, rows,
|
8578 |
-
type === 'search' ? '_aFilterData' : '_aSortData', column
|
8579 |
-
);
|
8580 |
-
}, 1 );
|
8581 |
-
} );
|
8582 |
-
|
8583 |
-
_api_registerPlural( 'columns().nodes()', 'column().nodes()', function () {
|
8584 |
-
return this.iterator( 'column-rows', function ( settings, column, i, j, rows ) {
|
8585 |
-
return _pluck_order( settings.aoData, rows, 'anCells', column ) ;
|
8586 |
-
}, 1 );
|
8587 |
-
} );
|
8588 |
-
|
8589 |
-
_api_registerPlural( 'columns().visible()', 'column().visible()', function ( vis, calc ) {
|
8590 |
-
var ret = this.iterator( 'column', function ( settings, column ) {
|
8591 |
-
if ( vis === undefined ) {
|
8592 |
-
return settings.aoColumns[ column ].bVisible;
|
8593 |
-
} // else
|
8594 |
-
__setColumnVis( settings, column, vis );
|
8595 |
-
} );
|
8596 |
-
|
8597 |
-
// Group the column visibility changes
|
8598 |
-
if ( vis !== undefined ) {
|
8599 |
-
// Second loop once the first is done for events
|
8600 |
-
this.iterator( 'column', function ( settings, column ) {
|
8601 |
-
_fnCallbackFire( settings, null, 'column-visibility', [settings, column, vis, calc] );
|
8602 |
-
} );
|
8603 |
-
|
8604 |
-
if ( calc === undefined || calc ) {
|
8605 |
-
this.columns.adjust();
|
8606 |
-
}
|
8607 |
-
}
|
8608 |
-
|
8609 |
-
return ret;
|
8610 |
-
} );
|
8611 |
-
|
8612 |
-
_api_registerPlural( 'columns().indexes()', 'column().index()', function ( type ) {
|
8613 |
-
return this.iterator( 'column', function ( settings, column ) {
|
8614 |
-
return type === 'visible' ?
|
8615 |
-
_fnColumnIndexToVisible( settings, column ) :
|
8616 |
-
column;
|
8617 |
-
}, 1 );
|
8618 |
-
} );
|
8619 |
-
|
8620 |
-
_api_register( 'columns.adjust()', function () {
|
8621 |
-
return this.iterator( 'table', function ( settings ) {
|
8622 |
-
_fnAdjustColumnSizing( settings );
|
8623 |
-
}, 1 );
|
8624 |
-
} );
|
8625 |
-
|
8626 |
-
_api_register( 'column.index()', function ( type, idx ) {
|
8627 |
-
if ( this.context.length !== 0 ) {
|
8628 |
-
var ctx = this.context[0];
|
8629 |
-
|
8630 |
-
if ( type === 'fromVisible' || type === 'toData' ) {
|
8631 |
-
return _fnVisibleToColumnIndex( ctx, idx );
|
8632 |
-
}
|
8633 |
-
else if ( type === 'fromData' || type === 'toVisible' ) {
|
8634 |
-
return _fnColumnIndexToVisible( ctx, idx );
|
8635 |
-
}
|
8636 |
-
}
|
8637 |
-
} );
|
8638 |
-
|
8639 |
-
_api_register( 'column()', function ( selector, opts ) {
|
8640 |
-
return _selector_first( this.columns( selector, opts ) );
|
8641 |
-
} );
|
8642 |
-
|
8643 |
-
|
8644 |
-
|
8645 |
-
var __cell_selector = function ( settings, selector, opts )
|
8646 |
-
{
|
8647 |
-
var data = settings.aoData;
|
8648 |
-
var rows = _selector_row_indexes( settings, opts );
|
8649 |
-
var cells = _removeEmpty( _pluck_order( data, rows, 'anCells' ) );
|
8650 |
-
var allCells = $( [].concat.apply([], cells) );
|
8651 |
-
var row;
|
8652 |
-
var columns = settings.aoColumns.length;
|
8653 |
-
var a, i, ien, j, o, host;
|
8654 |
-
|
8655 |
-
var run = function ( s ) {
|
8656 |
-
var fnSelector = typeof s === 'function';
|
8657 |
-
|
8658 |
-
if ( s === null || s === undefined || fnSelector ) {
|
8659 |
-
// All cells and function selectors
|
8660 |
-
a = [];
|
8661 |
-
|
8662 |
-
for ( i=0, ien=rows.length ; i<ien ; i++ ) {
|
8663 |
-
row = rows[i];
|
8664 |
-
|
8665 |
-
for ( j=0 ; j<columns ; j++ ) {
|
8666 |
-
o = {
|
8667 |
-
row: row,
|
8668 |
-
column: j
|
8669 |
-
};
|
8670 |
-
|
8671 |
-
if ( fnSelector ) {
|
8672 |
-
// Selector - function
|
8673 |
-
host = data[ row ];
|
8674 |
-
|
8675 |
-
if ( s( o, _fnGetCellData(settings, row, j), host.anCells ? host.anCells[j] : null ) ) {
|
8676 |
-
a.push( o );
|
8677 |
-
}
|
8678 |
-
}
|
8679 |
-
else {
|
8680 |
-
// Selector - all
|
8681 |
-
a.push( o );
|
8682 |
-
}
|
8683 |
-
}
|
8684 |
-
}
|
8685 |
-
|
8686 |
-
return a;
|
8687 |
-
}
|
8688 |
-
|
8689 |
-
// Selector - index
|
8690 |
-
if ( $.isPlainObject( s ) ) {
|
8691 |
-
return [s];
|
8692 |
-
}
|
8693 |
-
|
8694 |
-
// Selector - jQuery filtered cells
|
8695 |
-
var jqResult = allCells
|
8696 |
-
.filter( s )
|
8697 |
-
.map( function (i, el) {
|
8698 |
-
return { // use a new object, in case someone changes the values
|
8699 |
-
row: el._DT_CellIndex.row,
|
8700 |
-
column: el._DT_CellIndex.column
|
8701 |
-
};
|
8702 |
-
} )
|
8703 |
-
.toArray();
|
8704 |
-
|
8705 |
-
if ( jqResult.length || ! s.nodeName ) {
|
8706 |
-
return jqResult;
|
8707 |
-
}
|
8708 |
-
|
8709 |
-
// Otherwise the selector is a node, and there is one last option - the
|
8710 |
-
// element might be a child of an element which has dt-row and dt-column
|
8711 |
-
// data attributes
|
8712 |
-
host = $(s).closest('*[data-dt-row]');
|
8713 |
-
return host.length ?
|
8714 |
-
[ {
|
8715 |
-
row: host.data('dt-row'),
|
8716 |
-
column: host.data('dt-column')
|
8717 |
-
} ] :
|
8718 |
-
[];
|
8719 |
-
};
|
8720 |
-
|
8721 |
-
return _selector_run( 'cell', selector, run, settings, opts );
|
8722 |
-
};
|
8723 |
-
|
8724 |
-
|
8725 |
-
|
8726 |
-
|
8727 |
-
_api_register( 'cells()', function ( rowSelector, columnSelector, opts ) {
|
8728 |
-
// Argument shifting
|
8729 |
-
if ( $.isPlainObject( rowSelector ) ) {
|
8730 |
-
// Indexes
|
8731 |
-
if ( rowSelector.row === undefined ) {
|
8732 |
-
// Selector options in first parameter
|
8733 |
-
opts = rowSelector;
|
8734 |
-
rowSelector = null;
|
8735 |
-
}
|
8736 |
-
else {
|
8737 |
-
// Cell index objects in first parameter
|
8738 |
-
opts = columnSelector;
|
8739 |
-
columnSelector = null;
|
8740 |
-
}
|
8741 |
-
}
|
8742 |
-
if ( $.isPlainObject( columnSelector ) ) {
|
8743 |
-
opts = columnSelector;
|
8744 |
-
columnSelector = null;
|
8745 |
-
}
|
8746 |
-
|
8747 |
-
// Cell selector
|
8748 |
-
if ( columnSelector === null || columnSelector === undefined ) {
|
8749 |
-
return this.iterator( 'table', function ( settings ) {
|
8750 |
-
return __cell_selector( settings, rowSelector, _selector_opts( opts ) );
|
8751 |
-
} );
|
8752 |
-
}
|
8753 |
-
|
8754 |
-
// Row + column selector
|
8755 |
-
var columns = this.columns( columnSelector, opts );
|
8756 |
-
var rows = this.rows( rowSelector, opts );
|
8757 |
-
var a, i, ien, j, jen;
|
8758 |
-
|
8759 |
-
var cells = this.iterator( 'table', function ( settings, idx ) {
|
8760 |
-
a = [];
|
8761 |
-
|
8762 |
-
for ( i=0, ien=rows[idx].length ; i<ien ; i++ ) {
|
8763 |
-
for ( j=0, jen=columns[idx].length ; j<jen ; j++ ) {
|
8764 |
-
a.push( {
|
8765 |
-
row: rows[idx][i],
|
8766 |
-
column: columns[idx][j]
|
8767 |
-
} );
|
8768 |
-
}
|
8769 |
-
}
|
8770 |
-
|
8771 |
-
return a;
|
8772 |
-
}, 1 );
|
8773 |
-
|
8774 |
-
$.extend( cells.selector, {
|
8775 |
-
cols: columnSelector,
|
8776 |
-
rows: rowSelector,
|
8777 |
-
opts: opts
|
8778 |
-
} );
|
8779 |
-
|
8780 |
-
return cells;
|
8781 |
-
} );
|
8782 |
-
|
8783 |
-
|
8784 |
-
_api_registerPlural( 'cells().nodes()', 'cell().node()', function () {
|
8785 |
-
return this.iterator( 'cell', function ( settings, row, column ) {
|
8786 |
-
var data = settings.aoData[ row ];
|
8787 |
-
|
8788 |
-
return data && data.anCells ?
|
8789 |
-
data.anCells[ column ] :
|
8790 |
-
undefined;
|
8791 |
-
}, 1 );
|
8792 |
-
} );
|
8793 |
-
|
8794 |
-
|
8795 |
-
_api_register( 'cells().data()', function () {
|
8796 |
-
return this.iterator( 'cell', function ( settings, row, column ) {
|
8797 |
-
return _fnGetCellData( settings, row, column );
|
8798 |
-
}, 1 );
|
8799 |
-
} );
|
8800 |
-
|
8801 |
-
|
8802 |
-
_api_registerPlural( 'cells().cache()', 'cell().cache()', function ( type ) {
|
8803 |
-
type = type === 'search' ? '_aFilterData' : '_aSortData';
|
8804 |
-
|
8805 |
-
return this.iterator( 'cell', function ( settings, row, column ) {
|
8806 |
-
return settings.aoData[ row ][ type ][ column ];
|
8807 |
-
}, 1 );
|
8808 |
-
} );
|
8809 |
-
|
8810 |
-
|
8811 |
-
_api_registerPlural( 'cells().render()', 'cell().render()', function ( type ) {
|
8812 |
-
return this.iterator( 'cell', function ( settings, row, column ) {
|
8813 |
-
return _fnGetCellData( settings, row, column, type );
|
8814 |
-
}, 1 );
|
8815 |
-
} );
|
8816 |
-
|
8817 |
-
|
8818 |
-
_api_registerPlural( 'cells().indexes()', 'cell().index()', function () {
|
8819 |
-
return this.iterator( 'cell', function ( settings, row, column ) {
|
8820 |
-
return {
|
8821 |
-
row: row,
|
8822 |
-
column: column,
|
8823 |
-
columnVisible: _fnColumnIndexToVisible( settings, column )
|
8824 |
-
};
|
8825 |
-
}, 1 );
|
8826 |
-
} );
|
8827 |
-
|
8828 |
-
|
8829 |
-
_api_registerPlural( 'cells().invalidate()', 'cell().invalidate()', function ( src ) {
|
8830 |
-
return this.iterator( 'cell', function ( settings, row, column ) {
|
8831 |
-
_fnInvalidate( settings, row, src, column );
|
8832 |
-
} );
|
8833 |
-
} );
|
8834 |
-
|
8835 |
-
|
8836 |
-
|
8837 |
-
_api_register( 'cell()', function ( rowSelector, columnSelector, opts ) {
|
8838 |
-
return _selector_first( this.cells( rowSelector, columnSelector, opts ) );
|
8839 |
-
} );
|
8840 |
-
|
8841 |
-
|
8842 |
-
_api_register( 'cell().data()', function ( data ) {
|
8843 |
-
var ctx = this.context;
|
8844 |
-
var cell = this[0];
|
8845 |
-
|
8846 |
-
if ( data === undefined ) {
|
8847 |
-
// Get
|
8848 |
-
return ctx.length && cell.length ?
|
8849 |
-
_fnGetCellData( ctx[0], cell[0].row, cell[0].column ) :
|
8850 |
-
undefined;
|
8851 |
-
}
|
8852 |
-
|
8853 |
-
// Set
|
8854 |
-
_fnSetCellData( ctx[0], cell[0].row, cell[0].column, data );
|
8855 |
-
_fnInvalidate( ctx[0], cell[0].row, 'data', cell[0].column );
|
8856 |
-
|
8857 |
-
return this;
|
8858 |
-
} );
|
8859 |
-
|
8860 |
-
|
8861 |
-
|
8862 |
-
/**
|
8863 |
-
* Get current ordering (sorting) that has been applied to the table.
|
8864 |
-
*
|
8865 |
-
* @returns {array} 2D array containing the sorting information for the first
|
8866 |
-
* table in the current context. Each element in the parent array represents
|
8867 |
-
* a column being sorted upon (i.e. multi-sorting with two columns would have
|
8868 |
-
* 2 inner arrays). The inner arrays may have 2 or 3 elements. The first is
|
8869 |
-
* the column index that the sorting condition applies to, the second is the
|
8870 |
-
* direction of the sort (`desc` or `asc`) and, optionally, the third is the
|
8871 |
-
* index of the sorting order from the `column.sorting` initialisation array.
|
8872 |
-
*//**
|
8873 |
-
* Set the ordering for the table.
|
8874 |
-
*
|
8875 |
-
* @param {integer} order Column index to sort upon.
|
8876 |
-
* @param {string} direction Direction of the sort to be applied (`asc` or `desc`)
|
8877 |
-
* @returns {WFDataTables.Api} this
|
8878 |
-
*//**
|
8879 |
-
* Set the ordering for the table.
|
8880 |
-
*
|
8881 |
-
* @param {array} order 1D array of sorting information to be applied.
|
8882 |
-
* @param {array} [...] Optional additional sorting conditions
|
8883 |
-
* @returns {WFDataTables.Api} this
|
8884 |
-
*//**
|
8885 |
-
* Set the ordering for the table.
|
8886 |
-
*
|
8887 |
-
* @param {array} order 2D array of sorting information to be applied.
|
8888 |
-
* @returns {WFDataTables.Api} this
|
8889 |
-
*/
|
8890 |
-
_api_register( 'order()', function ( order, dir ) {
|
8891 |
-
var ctx = this.context;
|
8892 |
-
|
8893 |
-
if ( order === undefined ) {
|
8894 |
-
// get
|
8895 |
-
return ctx.length !== 0 ?
|
8896 |
-
ctx[0].aaSorting :
|
8897 |
-
undefined;
|
8898 |
-
}
|
8899 |
-
|
8900 |
-
// set
|
8901 |
-
if ( typeof order === 'number' ) {
|
8902 |
-
// Simple column / direction passed in
|
8903 |
-
order = [ [ order, dir ] ];
|
8904 |
-
}
|
8905 |
-
else if ( order.length && ! $.isArray( order[0] ) ) {
|
8906 |
-
// Arguments passed in (list of 1D arrays)
|
8907 |
-
order = Array.prototype.slice.call( arguments );
|
8908 |
-
}
|
8909 |
-
// otherwise a 2D array was passed in
|
8910 |
-
|
8911 |
-
return this.iterator( 'table', function ( settings ) {
|
8912 |
-
settings.aaSorting = order.slice();
|
8913 |
-
} );
|
8914 |
-
} );
|
8915 |
-
|
8916 |
-
|
8917 |
-
/**
|
8918 |
-
* Attach a sort listener to an element for a given column
|
8919 |
-
*
|
8920 |
-
* @param {node|jQuery|string} node Identifier for the element(s) to attach the
|
8921 |
-
* listener to. This can take the form of a single DOM node, a jQuery
|
8922 |
-
* collection of nodes or a jQuery selector which will identify the node(s).
|
8923 |
-
* @param {integer} column the column that a click on this node will sort on
|
8924 |
-
* @param {function} [callback] callback function when sort is run
|
8925 |
-
* @returns {WFDataTables.Api} this
|
8926 |
-
*/
|
8927 |
-
_api_register( 'order.listener()', function ( node, column, callback ) {
|
8928 |
-
return this.iterator( 'table', function ( settings ) {
|
8929 |
-
_fnSortAttachListener( settings, node, column, callback );
|
8930 |
-
} );
|
8931 |
-
} );
|
8932 |
-
|
8933 |
-
|
8934 |
-
_api_register( 'order.fixed()', function ( set ) {
|
8935 |
-
if ( ! set ) {
|
8936 |
-
var ctx = this.context;
|
8937 |
-
var fixed = ctx.length ?
|
8938 |
-
ctx[0].aaSortingFixed :
|
8939 |
-
undefined;
|
8940 |
-
|
8941 |
-
return $.isArray( fixed ) ?
|
8942 |
-
{ pre: fixed } :
|
8943 |
-
fixed;
|
8944 |
-
}
|
8945 |
-
|
8946 |
-
return this.iterator( 'table', function ( settings ) {
|
8947 |
-
settings.aaSortingFixed = $.extend( true, {}, set );
|
8948 |
-
} );
|
8949 |
-
} );
|
8950 |
-
|
8951 |
-
|
8952 |
-
// Order by the selected column(s)
|
8953 |
-
_api_register( [
|
8954 |
-
'columns().order()',
|
8955 |
-
'column().order()'
|
8956 |
-
], function ( dir ) {
|
8957 |
-
var that = this;
|
8958 |
-
|
8959 |
-
return this.iterator( 'table', function ( settings, i ) {
|
8960 |
-
var sort = [];
|
8961 |
-
|
8962 |
-
$.each( that[i], function (j, col) {
|
8963 |
-
sort.push( [ col, dir ] );
|
8964 |
-
} );
|
8965 |
-
|
8966 |
-
settings.aaSorting = sort;
|
8967 |
-
} );
|
8968 |
-
} );
|
8969 |
-
|
8970 |
-
|
8971 |
-
|
8972 |
-
_api_register( 'search()', function ( input, regex, smart, caseInsen ) {
|
8973 |
-
var ctx = this.context;
|
8974 |
-
|
8975 |
-
if ( input === undefined ) {
|
8976 |
-
// get
|
8977 |
-
return ctx.length !== 0 ?
|
8978 |
-
ctx[0].oPreviousSearch.sSearch :
|
8979 |
-
undefined;
|
8980 |
-
}
|
8981 |
-
|
8982 |
-
// set
|
8983 |
-
return this.iterator( 'table', function ( settings ) {
|
8984 |
-
if ( ! settings.oFeatures.bFilter ) {
|
8985 |
-
return;
|
8986 |
-
}
|
8987 |
-
|
8988 |
-
_fnFilterComplete( settings, $.extend( {}, settings.oPreviousSearch, {
|
8989 |
-
"sSearch": input+"",
|
8990 |
-
"bRegex": regex === null ? false : regex,
|
8991 |
-
"bSmart": smart === null ? true : smart,
|
8992 |
-
"bCaseInsensitive": caseInsen === null ? true : caseInsen
|
8993 |
-
} ), 1 );
|
8994 |
-
} );
|
8995 |
-
} );
|
8996 |
-
|
8997 |
-
|
8998 |
-
_api_registerPlural(
|
8999 |
-
'columns().search()',
|
9000 |
-
'column().search()',
|
9001 |
-
function ( input, regex, smart, caseInsen ) {
|
9002 |
-
return this.iterator( 'column', function ( settings, column ) {
|
9003 |
-
var preSearch = settings.aoPreSearchCols;
|
9004 |
-
|
9005 |
-
if ( input === undefined ) {
|
9006 |
-
// get
|
9007 |
-
return preSearch[ column ].sSearch;
|
9008 |
-
}
|
9009 |
-
|
9010 |
-
// set
|
9011 |
-
if ( ! settings.oFeatures.bFilter ) {
|
9012 |
-
return;
|
9013 |
-
}
|
9014 |
-
|
9015 |
-
$.extend( preSearch[ column ], {
|
9016 |
-
"sSearch": input+"",
|
9017 |
-
"bRegex": regex === null ? false : regex,
|
9018 |
-
"bSmart": smart === null ? true : smart,
|
9019 |
-
"bCaseInsensitive": caseInsen === null ? true : caseInsen
|
9020 |
-
} );
|
9021 |
-
|
9022 |
-
_fnFilterComplete( settings, settings.oPreviousSearch, 1 );
|
9023 |
-
} );
|
9024 |
-
}
|
9025 |
-
);
|
9026 |
-
|
9027 |
-
/*
|
9028 |
-
* State API methods
|
9029 |
-
*/
|
9030 |
-
|
9031 |
-
_api_register( 'state()', function () {
|
9032 |
-
return this.context.length ?
|
9033 |
-
this.context[0].oSavedState :
|
9034 |
-
null;
|
9035 |
-
} );
|
9036 |
-
|
9037 |
-
|
9038 |
-
_api_register( 'state.clear()', function () {
|
9039 |
-
return this.iterator( 'table', function ( settings ) {
|
9040 |
-
// Save an empty object
|
9041 |
-
settings.fnStateSaveCallback.call( settings.oInstance, settings, {} );
|
9042 |
-
} );
|
9043 |
-
} );
|
9044 |
-
|
9045 |
-
|
9046 |
-
_api_register( 'state.loaded()', function () {
|
9047 |
-
return this.context.length ?
|
9048 |
-
this.context[0].oLoadedState :
|
9049 |
-
null;
|
9050 |
-
} );
|
9051 |
-
|
9052 |
-
|
9053 |
-
_api_register( 'state.save()', function () {
|
9054 |
-
return this.iterator( 'table', function ( settings ) {
|
9055 |
-
_fnSaveState( settings );
|
9056 |
-
} );
|
9057 |
-
} );
|
9058 |
-
|
9059 |
-
|
9060 |
-
|
9061 |
-
/**
|
9062 |
-
* Provide a common method for plug-ins to check the version of WFDataTables being
|
9063 |
-
* used, in order to ensure compatibility.
|
9064 |
-
*
|
9065 |
-
* @param {string} version Version string to check for, in the format "X.Y.Z".
|
9066 |
-
* Note that the formats "X" and "X.Y" are also acceptable.
|
9067 |
-
* @returns {boolean} true if this version of WFDataTables is greater or equal to
|
9068 |
-
* the required version, or false if this version of DataTales is not
|
9069 |
-
* suitable
|
9070 |
-
* @static
|
9071 |
-
* @dtopt API-Static
|
9072 |
-
*
|
9073 |
-
* @example
|
9074 |
-
* alert( $.fn.wfDataTable.versionCheck( '1.9.0' ) );
|
9075 |
-
*/
|
9076 |
-
WFDataTable.versionCheck = WFDataTable.fnVersionCheck = function( version )
|
9077 |
-
{
|
9078 |
-
var aThis = WFDataTable.version.split('.');
|
9079 |
-
var aThat = version.split('.');
|
9080 |
-
var iThis, iThat;
|
9081 |
-
|
9082 |
-
for ( var i=0, iLen=aThat.length ; i<iLen ; i++ ) {
|
9083 |
-
iThis = parseInt( aThis[i], 10 ) || 0;
|
9084 |
-
iThat = parseInt( aThat[i], 10 ) || 0;
|
9085 |
-
|
9086 |
-
// Parts are the same, keep comparing
|
9087 |
-
if (iThis === iThat) {
|
9088 |
-
continue;
|
9089 |
-
}
|
9090 |
-
|
9091 |
-
// Parts are different, return immediately
|
9092 |
-
return iThis > iThat;
|
9093 |
-
}
|
9094 |
-
|
9095 |
-
return true;
|
9096 |
-
};
|
9097 |
-
|
9098 |
-
|
9099 |
-
/**
|
9100 |
-
* Check if a `<table>` node is a WFDataTable table already or not.
|
9101 |
-
*
|
9102 |
-
* @param {node|jquery|string} table Table node, jQuery object or jQuery
|
9103 |
-
* selector for the table to test. Note that if more than more than one
|
9104 |
-
* table is passed on, only the first will be checked
|
9105 |
-
* @returns {boolean} true the table given is a WFDataTable, or false otherwise
|
9106 |
-
* @static
|
9107 |
-
* @dtopt API-Static
|
9108 |
-
*
|
9109 |
-
* @example
|
9110 |
-
* if ( ! $.fn.WFDataTable.isWFDataTable( '#example' ) ) {
|
9111 |
-
* $('#example').wfDataTable();
|
9112 |
-
* }
|
9113 |
-
*/
|
9114 |
-
WFDataTable.isWFDataTable = WFDataTable.fnIsWFDataTable = function ( table )
|
9115 |
-
{
|
9116 |
-
var t = $(table).get(0);
|
9117 |
-
var is = false;
|
9118 |
-
|
9119 |
-
if ( table instanceof WFDataTable.Api ) {
|
9120 |
-
return true;
|
9121 |
-
}
|
9122 |
-
|
9123 |
-
$.each( WFDataTable.settings, function (i, o) {
|
9124 |
-
var head = o.nScrollHead ? $('table', o.nScrollHead)[0] : null;
|
9125 |
-
var foot = o.nScrollFoot ? $('table', o.nScrollFoot)[0] : null;
|
9126 |
-
|
9127 |
-
if ( o.nTable === t || head === t || foot === t ) {
|
9128 |
-
is = true;
|
9129 |
-
}
|
9130 |
-
} );
|
9131 |
-
|
9132 |
-
return is;
|
9133 |
-
};
|
9134 |
-
|
9135 |
-
|
9136 |
-
/**
|
9137 |
-
* Get all WFDataTable tables that have been initialised - optionally you can
|
9138 |
-
* select to get only currently visible tables.
|
9139 |
-
*
|
9140 |
-
* @param {boolean} [visible=false] Flag to indicate if you want all (default)
|
9141 |
-
* or visible tables only.
|
9142 |
-
* @returns {array} Array of `table` nodes (not WFDataTable instances) which are
|
9143 |
-
* WFDataTables
|
9144 |
-
* @static
|
9145 |
-
* @dtopt API-Static
|
9146 |
-
*
|
9147 |
-
* @example
|
9148 |
-
* $.each( $.fn.wfDataTable.tables(true), function () {
|
9149 |
-
* $(table).WFDataTable().columns.adjust();
|
9150 |
-
* } );
|
9151 |
-
*/
|
9152 |
-
WFDataTable.tables = WFDataTable.fnTables = function ( visible )
|
9153 |
-
{
|
9154 |
-
var api = false;
|
9155 |
-
|
9156 |
-
if ( $.isPlainObject( visible ) ) {
|
9157 |
-
api = visible.api;
|
9158 |
-
visible = visible.visible;
|
9159 |
-
}
|
9160 |
-
|
9161 |
-
var a = $.map( WFDataTable.settings, function (o) {
|
9162 |
-
if ( !visible || (visible && $(o.nTable).is(':visible')) ) {
|
9163 |
-
return o.nTable;
|
9164 |
-
}
|
9165 |
-
} );
|
9166 |
-
|
9167 |
-
return api ?
|
9168 |
-
new _Api( a ) :
|
9169 |
-
a;
|
9170 |
-
};
|
9171 |
-
|
9172 |
-
|
9173 |
-
/**
|
9174 |
-
* Convert from camel case parameters to Hungarian notation. This is made public
|
9175 |
-
* for the extensions to provide the same ability as WFDataTables core to accept
|
9176 |
-
* either the 1.9 style Hungarian notation, or the 1.10+ style camelCase
|
9177 |
-
* parameters.
|
9178 |
-
*
|
9179 |
-
* @param {object} src The model object which holds all parameters that can be
|
9180 |
-
* mapped.
|
9181 |
-
* @param {object} user The object to convert from camel case to Hungarian.
|
9182 |
-
* @param {boolean} force When set to `true`, properties which already have a
|
9183 |
-
* Hungarian value in the `user` object will be overwritten. Otherwise they
|
9184 |
-
* won't be.
|
9185 |
-
*/
|
9186 |
-
WFDataTable.camelToHungarian = _fnCamelToHungarian;
|
9187 |
-
|
9188 |
-
|
9189 |
-
|
9190 |
-
/**
|
9191 |
-
*
|
9192 |
-
*/
|
9193 |
-
_api_register( '$()', function ( selector, opts ) {
|
9194 |
-
var
|
9195 |
-
rows = this.rows( opts ).nodes(), // Get all rows
|
9196 |
-
jqRows = $(rows);
|
9197 |
-
|
9198 |
-
return $( [].concat(
|
9199 |
-
jqRows.filter( selector ).toArray(),
|
9200 |
-
jqRows.find( selector ).toArray()
|
9201 |
-
) );
|
9202 |
-
} );
|
9203 |
-
|
9204 |
-
|
9205 |
-
// jQuery functions to operate on the tables
|
9206 |
-
$.each( [ 'on', 'one', 'off' ], function (i, key) {
|
9207 |
-
_api_register( key+'()', function ( /* event, handler */ ) {
|
9208 |
-
var args = Array.prototype.slice.call(arguments);
|
9209 |
-
|
9210 |
-
// Add the `dt` namespace automatically if it isn't already present
|
9211 |
-
args[0] = $.map( args[0].split( /\s/ ), function ( e ) {
|
9212 |
-
return ! e.match(/\.dt\b/) ?
|
9213 |
-
e+'.dt' :
|
9214 |
-
e;
|
9215 |
-
} ).join( ' ' );
|
9216 |
-
|
9217 |
-
var inst = $( this.tables().nodes() );
|
9218 |
-
inst[key].apply( inst, args );
|
9219 |
-
return this;
|
9220 |
-
} );
|
9221 |
-
} );
|
9222 |
-
|
9223 |
-
|
9224 |
-
_api_register( 'clear()', function () {
|
9225 |
-
return this.iterator( 'table', function ( settings ) {
|
9226 |
-
_fnClearTable( settings );
|
9227 |
-
} );
|
9228 |
-
} );
|
9229 |
-
|
9230 |
-
|
9231 |
-
_api_register( 'settings()', function () {
|
9232 |
-
return new _Api( this.context, this.context );
|
9233 |
-
} );
|
9234 |
-
|
9235 |
-
|
9236 |
-
_api_register( 'init()', function () {
|
9237 |
-
var ctx = this.context;
|
9238 |
-
return ctx.length ? ctx[0].oInit : null;
|
9239 |
-
} );
|
9240 |
-
|
9241 |
-
|
9242 |
-
_api_register( 'data()', function () {
|
9243 |
-
return this.iterator( 'table', function ( settings ) {
|
9244 |
-
return _pluck( settings.aoData, '_aData' );
|
9245 |
-
} ).flatten();
|
9246 |
-
} );
|
9247 |
-
|
9248 |
-
|
9249 |
-
_api_register( 'destroy()', function ( remove ) {
|
9250 |
-
remove = remove || false;
|
9251 |
-
|
9252 |
-
return this.iterator( 'table', function ( settings ) {
|
9253 |
-
var orig = settings.nTableWrapper.parentNode;
|
9254 |
-
var classes = settings.oClasses;
|
9255 |
-
var table = settings.nTable;
|
9256 |
-
var tbody = settings.nTBody;
|
9257 |
-
var thead = settings.nTHead;
|
9258 |
-
var tfoot = settings.nTFoot;
|
9259 |
-
var jqTable = $(table);
|
9260 |
-
var jqTbody = $(tbody);
|
9261 |
-
var jqWrapper = $(settings.nTableWrapper);
|
9262 |
-
var rows = $.map( settings.aoData, function (r) { return r.nTr; } );
|
9263 |
-
var i, ien;
|
9264 |
-
|
9265 |
-
// Flag to note that the table is currently being destroyed - no action
|
9266 |
-
// should be taken
|
9267 |
-
settings.bDestroying = true;
|
9268 |
-
|
9269 |
-
// Fire off the destroy callbacks for plug-ins etc
|
9270 |
-
_fnCallbackFire( settings, "aoDestroyCallback", "destroy", [settings] );
|
9271 |
-
|
9272 |
-
// If not being removed from the document, make all columns visible
|
9273 |
-
if ( ! remove ) {
|
9274 |
-
new _Api( settings ).columns().visible( true );
|
9275 |
-
}
|
9276 |
-
|
9277 |
-
// Blitz all `DT` namespaced events (these are internal events, the
|
9278 |
-
// lowercase, `dt` events are user subscribed and they are responsible
|
9279 |
-
// for removing them
|
9280 |
-
jqWrapper.off('.DT').find(':not(tbody *)').off('.DT');
|
9281 |
-
$(window).off('.DT-'+settings.sInstance);
|
9282 |
-
|
9283 |
-
// When scrolling we had to break the table up - restore it
|
9284 |
-
if ( table != thead.parentNode ) {
|
9285 |
-
jqTable.children('thead').detach();
|
9286 |
-
jqTable.append( thead );
|
9287 |
-
}
|
9288 |
-
|
9289 |
-
if ( tfoot && table != tfoot.parentNode ) {
|
9290 |
-
jqTable.children('tfoot').detach();
|
9291 |
-
jqTable.append( tfoot );
|
9292 |
-
}
|
9293 |
-
|
9294 |
-
settings.aaSorting = [];
|
9295 |
-
settings.aaSortingFixed = [];
|
9296 |
-
_fnSortingClasses( settings );
|
9297 |
-
|
9298 |
-
$( rows ).removeClass( settings.asStripeClasses.join(' ') );
|
9299 |
-
|
9300 |
-
$('th, td', thead).removeClass( classes.sSortable+' '+
|
9301 |
-
classes.sSortableAsc+' '+classes.sSortableDesc+' '+classes.sSortableNone
|
9302 |
-
);
|
9303 |
-
|
9304 |
-
if ( settings.bJUI ) {
|
9305 |
-
$('th span.'+classes.sSortIcon+ ', td span.'+classes.sSortIcon, thead).detach();
|
9306 |
-
$('th, td', thead).each( function () {
|
9307 |
-
var wrapper = $('div.'+classes.sSortJUIWrapper, this);
|
9308 |
-
$(this).append( wrapper.contents() );
|
9309 |
-
wrapper.detach();
|
9310 |
-
} );
|
9311 |
-
}
|
9312 |
-
|
9313 |
-
// Add the TR elements back into the table in their original order
|
9314 |
-
jqTbody.children().detach();
|
9315 |
-
jqTbody.append( rows );
|
9316 |
-
|
9317 |
-
// Remove the WFDataTables generated nodes, events and classes
|
9318 |
-
var removedMethod = remove ? 'remove' : 'detach';
|
9319 |
-
jqTable[ removedMethod ]();
|
9320 |
-
jqWrapper[ removedMethod ]();
|
9321 |
-
|
9322 |
-
// If we need to reattach the table to the document
|
9323 |
-
if ( ! remove && orig ) {
|
9324 |
-
// insertBefore acts like appendChild if !arg[1]
|
9325 |
-
orig.insertBefore( table, settings.nTableReinsertBefore );
|
9326 |
-
|
9327 |
-
// Restore the width of the original table - was read from the style property,
|
9328 |
-
// so we can restore directly to that
|
9329 |
-
jqTable
|
9330 |
-
.css( 'width', settings.sDestroyWidth )
|
9331 |
-
.removeClass( classes.sTable );
|
9332 |
-
|
9333 |
-
// If the were originally stripe classes - then we add them back here.
|
9334 |
-
// Note this is not fool proof (for example if not all rows had stripe
|
9335 |
-
// classes - but it's a good effort without getting carried away
|
9336 |
-
ien = settings.asDestroyStripes.length;
|
9337 |
-
|
9338 |
-
if ( ien ) {
|
9339 |
-
jqTbody.children().each( function (i) {
|
9340 |
-
$(this).addClass( settings.asDestroyStripes[i % ien] );
|
9341 |
-
} );
|
9342 |
-
}
|
9343 |
-
}
|
9344 |
-
|
9345 |
-
/* Remove the settings object from the settings array */
|
9346 |
-
var idx = $.inArray( settings, WFDataTable.settings );
|
9347 |
-
if ( idx !== -1 ) {
|
9348 |
-
WFDataTable.settings.splice( idx, 1 );
|
9349 |
-
}
|
9350 |
-
} );
|
9351 |
-
} );
|
9352 |
-
|
9353 |
-
|
9354 |
-
// Add the `every()` method for rows, columns and cells in a compact form
|
9355 |
-
$.each( [ 'column', 'row', 'cell' ], function ( i, type ) {
|
9356 |
-
_api_register( type+'s().every()', function ( fn ) {
|
9357 |
-
var opts = this.selector.opts;
|
9358 |
-
var api = this;
|
9359 |
-
|
9360 |
-
return this.iterator( type, function ( settings, arg1, arg2, arg3, arg4 ) {
|
9361 |
-
// Rows and columns:
|
9362 |
-
// arg1 - index
|
9363 |
-
// arg2 - table counter
|
9364 |
-
// arg3 - loop counter
|
9365 |
-
// arg4 - undefined
|
9366 |
-
// Cells:
|
9367 |
-
// arg1 - row index
|
9368 |
-
// arg2 - column index
|
9369 |
-
// arg3 - table counter
|
9370 |
-
// arg4 - loop counter
|
9371 |
-
fn.call(
|
9372 |
-
api[ type ](
|
9373 |
-
arg1,
|
9374 |
-
type==='cell' ? arg2 : opts,
|
9375 |
-
type==='cell' ? opts : undefined
|
9376 |
-
),
|
9377 |
-
arg1, arg2, arg3, arg4
|
9378 |
-
);
|
9379 |
-
} );
|
9380 |
-
} );
|
9381 |
-
} );
|
9382 |
-
|
9383 |
-
|
9384 |
-
// i18n method for extensions to be able to use the language object from the
|
9385 |
-
// WFDataTable
|
9386 |
-
_api_register( 'i18n()', function ( token, def, plural ) {
|
9387 |
-
var ctx = this.context[0];
|
9388 |
-
var resolved = _fnGetObjectDataFn( token )( ctx.oLanguage );
|
9389 |
-
|
9390 |
-
if ( resolved === undefined ) {
|
9391 |
-
resolved = def;
|
9392 |
-
}
|
9393 |
-
|
9394 |
-
if ( plural !== undefined && $.isPlainObject( resolved ) ) {
|
9395 |
-
resolved = resolved[ plural ] !== undefined ?
|
9396 |
-
resolved[ plural ] :
|
9397 |
-
resolved._;
|
9398 |
-
}
|
9399 |
-
|
9400 |
-
return resolved.replace( '%d', plural ); // nb: plural might be undefined,
|
9401 |
-
} );
|
9402 |
-
|
9403 |
-
/**
|
9404 |
-
* Version string for plug-ins to check compatibility. Allowed format is
|
9405 |
-
* `a.b.c-d` where: a:int, b:int, c:int, d:string(dev|beta|alpha). `d` is used
|
9406 |
-
* only for non-release builds. See http://semver.org/ for more information.
|
9407 |
-
* @member
|
9408 |
-
* @type string
|
9409 |
-
* @default Version number
|
9410 |
-
*/
|
9411 |
-
WFDataTable.version = "1.10.13";
|
9412 |
-
|
9413 |
-
/**
|
9414 |
-
* Private data store, containing all of the settings objects that are
|
9415 |
-
* created for the tables on a given page.
|
9416 |
-
*
|
9417 |
-
* Note that the `WFDataTable.settings` object is aliased to
|
9418 |
-
* `jQuery.fn.wfDataTableExt` through which it may be accessed and
|
9419 |
-
* manipulated, or `jQuery.fn.wfDataTable.settings`.
|
9420 |
-
* @member
|
9421 |
-
* @type array
|
9422 |
-
* @default []
|
9423 |
-
* @private
|
9424 |
-
*/
|
9425 |
-
WFDataTable.settings = [];
|
9426 |
-
|
9427 |
-
/**
|
9428 |
-
* Object models container, for the various models that WFDataTables has
|
9429 |
-
* available to it. These models define the objects that are used to hold
|
9430 |
-
* the active state and configuration of the table.
|
9431 |
-
* @namespace
|
9432 |
-
*/
|
9433 |
-
WFDataTable.models = {};
|
9434 |
-
|
9435 |
-
|
9436 |
-
|
9437 |
-
/**
|
9438 |
-
* Template object for the way in which WFDataTables holds information about
|
9439 |
-
* search information for the global filter and individual column filters.
|
9440 |
-
* @namespace
|
9441 |
-
*/
|
9442 |
-
WFDataTable.models.oSearch = {
|
9443 |
-
/**
|
9444 |
-
* Flag to indicate if the filtering should be case insensitive or not
|
9445 |
-
* @type boolean
|
9446 |
-
* @default true
|
9447 |
-
*/
|
9448 |
-
"bCaseInsensitive": true,
|
9449 |
-
|
9450 |
-
/**
|
9451 |
-
* Applied search term
|
9452 |
-
* @type string
|
9453 |
-
* @default <i>Empty string</i>
|
9454 |
-
*/
|
9455 |
-
"sSearch": "",
|
9456 |
-
|
9457 |
-
/**
|
9458 |
-
* Flag to indicate if the search term should be interpreted as a
|
9459 |
-
* regular expression (true) or not (false) and therefore and special
|
9460 |
-
* regex characters escaped.
|
9461 |
-
* @type boolean
|
9462 |
-
* @default false
|
9463 |
-
*/
|
9464 |
-
"bRegex": false,
|
9465 |
-
|
9466 |
-
/**
|
9467 |
-
* Flag to indicate if WFDataTables is to use its smart filtering or not.
|
9468 |
-
* @type boolean
|
9469 |
-
* @default true
|
9470 |
-
*/
|
9471 |
-
"bSmart": true
|
9472 |
-
};
|
9473 |
-
|
9474 |
-
|
9475 |
-
|
9476 |
-
|
9477 |
-
/**
|
9478 |
-
* Template object for the way in which WFDataTables holds information about
|
9479 |
-
* each individual row. This is the object format used for the settings
|
9480 |
-
* aoData array.
|
9481 |
-
* @namespace
|
9482 |
-
*/
|
9483 |
-
WFDataTable.models.oRow = {
|
9484 |
-
/**
|
9485 |
-
* TR element for the row
|
9486 |
-
* @type node
|
9487 |
-
* @default null
|
9488 |
-
*/
|
9489 |
-
"nTr": null,
|
9490 |
-
|
9491 |
-
/**
|
9492 |
-
* Array of TD elements for each row. This is null until the row has been
|
9493 |
-
* created.
|
9494 |
-
* @type array nodes
|
9495 |
-
* @default []
|
9496 |
-
*/
|
9497 |
-
"anCells": null,
|
9498 |
-
|
9499 |
-
/**
|
9500 |
-
* Data object from the original data source for the row. This is either
|
9501 |
-
* an array if using the traditional form of WFDataTables, or an object if
|
9502 |
-
* using mData options. The exact type will depend on the passed in
|
9503 |
-
* data from the data source, or will be an array if using DOM a data
|
9504 |
-
* source.
|
9505 |
-
* @type array|object
|
9506 |
-
* @default []
|
9507 |
-
*/
|
9508 |
-
"_aData": [],
|
9509 |
-
|
9510 |
-
/**
|
9511 |
-
* Sorting data cache - this array is ostensibly the same length as the
|
9512 |
-
* number of columns (although each index is generated only as it is
|
9513 |
-
* needed), and holds the data that is used for sorting each column in the
|
9514 |
-
* row. We do this cache generation at the start of the sort in order that
|
9515 |
-
* the formatting of the sort data need be done only once for each cell
|
9516 |
-
* per sort. This array should not be read from or written to by anything
|
9517 |
-
* other than the master sorting methods.
|
9518 |
-
* @type array
|
9519 |
-
* @default null
|
9520 |
-
* @private
|
9521 |
-
*/
|
9522 |
-
"_aSortData": null,
|
9523 |
-
|
9524 |
-
/**
|
9525 |
-
* Per cell filtering data cache. As per the sort data cache, used to
|
9526 |
-
* increase the performance of the filtering in WFDataTables
|
9527 |
-
* @type array
|
9528 |
-
* @default null
|
9529 |
-
* @private
|
9530 |
-
*/
|
9531 |
-
"_aFilterData": null,
|
9532 |
-
|
9533 |
-
/**
|
9534 |
-
* Filtering data cache. This is the same as the cell filtering cache, but
|
9535 |
-
* in this case a string rather than an array. This is easily computed with
|
9536 |
-
* a join on `_aFilterData`, but is provided as a cache so the join isn't
|
9537 |
-
* needed on every search (memory traded for performance)
|
9538 |
-
* @type array
|
9539 |
-
* @default null
|
9540 |
-
* @private
|
9541 |
-
*/
|
9542 |
-
"_sFilterRow": null,
|
9543 |
-
|
9544 |
-
/**
|
9545 |
-
* Cache of the class name that WFDataTables has applied to the row, so we
|
9546 |
-
* can quickly look at this variable rather than needing to do a DOM check
|
9547 |
-
* on className for the nTr property.
|
9548 |
-
* @type string
|
9549 |
-
* @default <i>Empty string</i>
|
9550 |
-
* @private
|
9551 |
-
*/
|
9552 |
-
"_sRowStripe": "",
|
9553 |
-
|
9554 |
-
/**
|
9555 |
-
* Denote if the original data source was from the DOM, or the data source
|
9556 |
-
* object. This is used for invalidating data, so WFDataTables can
|
9557 |
-
* automatically read data from the original source, unless uninstructed
|
9558 |
-
* otherwise.
|
9559 |
-
* @type string
|
9560 |
-
* @default null
|
9561 |
-
* @private
|
9562 |
-
*/
|
9563 |
-
"src": null,
|
9564 |
-
|
9565 |
-
/**
|
9566 |
-
* Index in the aoData array. This saves an indexOf lookup when we have the
|
9567 |
-
* object, but want to know the index
|
9568 |
-
* @type integer
|
9569 |
-
* @default -1
|
9570 |
-
* @private
|
9571 |
-
*/
|
9572 |
-
"idx": -1
|
9573 |
-
};
|
9574 |
-
|
9575 |
-
|
9576 |
-
/**
|
9577 |
-
* Template object for the column information object in WFDataTables. This object
|
9578 |
-
* is held in the settings aoColumns array and contains all the information that
|
9579 |
-
* WFDataTables needs about each individual column.
|
9580 |
-
*
|
9581 |
-
* Note that this object is related to {@link WFDataTable.defaults.column}
|
9582 |
-
* but this one is the internal data store for WFDataTables's cache of columns.
|
9583 |
-
* It should NOT be manipulated outside of WFDataTables. Any configuration should
|
9584 |
-
* be done through the initialisation options.
|
9585 |
-
* @namespace
|
9586 |
-
*/
|
9587 |
-
WFDataTable.models.oColumn = {
|
9588 |
-
/**
|
9589 |
-
* Column index. This could be worked out on-the-fly with $.inArray, but it
|
9590 |
-
* is faster to just hold it as a variable
|
9591 |
-
* @type integer
|
9592 |
-
* @default null
|
9593 |
-
*/
|
9594 |
-
"idx": null,
|
9595 |
-
|
9596 |
-
/**
|
9597 |
-
* A list of the columns that sorting should occur on when this column
|
9598 |
-
* is sorted. That this property is an array allows multi-column sorting
|
9599 |
-
* to be defined for a column (for example first name / last name columns
|
9600 |
-
* would benefit from this). The values are integers pointing to the
|
9601 |
-
* columns to be sorted on (typically it will be a single integer pointing
|
9602 |
-
* at itself, but that doesn't need to be the case).
|
9603 |
-
* @type array
|
9604 |
-
*/
|
9605 |
-
"aDataSort": null,
|
9606 |
-
|
9607 |
-
/**
|
9608 |
-
* Define the sorting directions that are applied to the column, in sequence
|
9609 |
-
* as the column is repeatedly sorted upon - i.e. the first value is used
|
9610 |
-
* as the sorting direction when the column if first sorted (clicked on).
|
9611 |
-
* Sort it again (click again) and it will move on to the next index.
|
9612 |
-
* Repeat until loop.
|
9613 |
-
* @type array
|
9614 |
-
*/
|
9615 |
-
"asSorting": null,
|
9616 |
-
|
9617 |
-
/**
|
9618 |
-
* Flag to indicate if the column is searchable, and thus should be included
|
9619 |
-
* in the filtering or not.
|
9620 |
-
* @type boolean
|
9621 |
-
*/
|
9622 |
-
"bSearchable": null,
|
9623 |
-
|
9624 |
-
/**
|
9625 |
-
* Flag to indicate if the column is sortable or not.
|
9626 |
-
* @type boolean
|
9627 |
-
*/
|
9628 |
-
"bSortable": null,
|
9629 |
-
|
9630 |
-
/**
|
9631 |
-
* Flag to indicate if the column is currently visible in the table or not
|
9632 |
-
* @type boolean
|
9633 |
-
*/
|
9634 |
-
"bVisible": null,
|
9635 |
-
|
9636 |
-
/**
|
9637 |
-
* Store for manual type assignment using the `column.type` option. This
|
9638 |
-
* is held in store so we can manipulate the column's `sType` property.
|
9639 |
-
* @type string
|
9640 |
-
* @default null
|
9641 |
-
* @private
|
9642 |
-
*/
|
9643 |
-
"_sManualType": null,
|
9644 |
-
|
9645 |
-
/**
|
9646 |
-
* Flag to indicate if HTML5 data attributes should be used as the data
|
9647 |
-
* source for filtering or sorting. True is either are.
|
9648 |
-
* @type boolean
|
9649 |
-
* @default false
|
9650 |
-
* @private
|
9651 |
-
*/
|
9652 |
-
"_bAttrSrc": false,
|
9653 |
-
|
9654 |
-
/**
|
9655 |
-
* Developer definable function that is called whenever a cell is created (Ajax source,
|
9656 |
-
* etc) or processed for input (DOM source). This can be used as a compliment to mRender
|
9657 |
-
* allowing you to modify the DOM element (add background colour for example) when the
|
9658 |
-
* element is available.
|
9659 |
-
* @type function
|
9660 |
-
* @param {element} nTd The TD node that has been created
|
9661 |
-
* @param {*} sData The Data for the cell
|
9662 |
-
* @param {array|object} oData The data for the whole row
|
9663 |
-
* @param {int} iRow The row index for the aoData data store
|
9664 |
-
* @default null
|
9665 |
-
*/
|
9666 |
-
"fnCreatedCell": null,
|
9667 |
-
|
9668 |
-
/**
|
9669 |
-
* Function to get data from a cell in a column. You should <b>never</b>
|
9670 |
-
* access data directly through _aData internally in WFDataTables - always use
|
9671 |
-
* the method attached to this property. It allows mData to function as
|
9672 |
-
* required. This function is automatically assigned by the column
|
9673 |
-
* initialisation method
|
9674 |
-
* @type function
|
9675 |
-
* @param {array|object} oData The data array/object for the array
|
9676 |
-
* (i.e. aoData[]._aData)
|
9677 |
-
* @param {string} sSpecific The specific data type you want to get -
|
9678 |
-
* 'display', 'type' 'filter' 'sort'
|
9679 |
-
* @returns {*} The data for the cell from the given row's data
|
9680 |
-
* @default null
|
9681 |
-
*/
|
9682 |
-
"fnGetData": null,
|
9683 |
-
|
9684 |
-
/**
|
9685 |
-
* Function to set data for a cell in the column. You should <b>never</b>
|
9686 |
-
* set the data directly to _aData internally in WFDataTables - always use
|
9687 |
-
* this method. It allows mData to function as required. This function
|
9688 |
-
* is automatically assigned by the column initialisation method
|
9689 |
-
* @type function
|
9690 |
-
* @param {array|object} oData The data array/object for the array
|
9691 |
-
* (i.e. aoData[]._aData)
|
9692 |
-
* @param {*} sValue Value to set
|
9693 |
-
* @default null
|
9694 |
-
*/
|
9695 |
-
"fnSetData": null,
|
9696 |
-
|
9697 |
-
/**
|
9698 |
-
* Property to read the value for the cells in the column from the data
|
9699 |
-
* source array / object. If null, then the default content is used, if a
|
9700 |
-
* function is given then the return from the function is used.
|
9701 |
-
* @type function|int|string|null
|
9702 |
-
* @default null
|
9703 |
-
*/
|
9704 |
-
"mData": null,
|
9705 |
-
|
9706 |
-
/**
|
9707 |
-
* Partner property to mData which is used (only when defined) to get
|
9708 |
-
* the data - i.e. it is basically the same as mData, but without the
|
9709 |
-
* 'set' option, and also the data fed to it is the result from mData.
|
9710 |
-
* This is the rendering method to match the data method of mData.
|
9711 |
-
* @type function|int|string|null
|
9712 |
-
* @default null
|
9713 |
-
*/
|
9714 |
-
"mRender": null,
|
9715 |
-
|
9716 |
-
/**
|
9717 |
-
* Unique header TH/TD element for this column - this is what the sorting
|
9718 |
-
* listener is attached to (if sorting is enabled.)
|
9719 |
-
* @type node
|
9720 |
-
* @default null
|
9721 |
-
*/
|
9722 |
-
"nTh": null,
|
9723 |
-
|
9724 |
-
/**
|
9725 |
-
* Unique footer TH/TD element for this column (if there is one). Not used
|
9726 |
-
* in WFDataTables as such, but can be used for plug-ins to reference the
|
9727 |
-
* footer for each column.
|
9728 |
-
* @type node
|
9729 |
-
* @default null
|
9730 |
-
*/
|
9731 |
-
"nTf": null,
|
9732 |
-
|
9733 |
-
/**
|
9734 |
-
* The class to apply to all TD elements in the table's TBODY for the column
|
9735 |
-
* @type string
|
9736 |
-
* @default null
|
9737 |
-
*/
|
9738 |
-
"sClass": null,
|
9739 |
-
|
9740 |
-
/**
|
9741 |
-
* When WFDataTables calculates the column widths to assign to each column,
|
9742 |
-
* it finds the longest string in each column and then constructs a
|
9743 |
-
* temporary table and reads the widths from that. The problem with this
|
9744 |
-
* is that "mmm" is much wider then "iiii", but the latter is a longer
|
9745 |
-
* string - thus the calculation can go wrong (doing it properly and putting
|
9746 |
-
* it into an DOM object and measuring that is horribly(!) slow). Thus as
|
9747 |
-
* a "work around" we provide this option. It will append its value to the
|
9748 |
-
* text that is found to be the longest string for the column - i.e. padding.
|
9749 |
-
* @type string
|
9750 |
-
*/
|
9751 |
-
"sContentPadding": null,
|
9752 |
-
|
9753 |
-
/**
|
9754 |
-
* Allows a default value to be given for a column's data, and will be used
|
9755 |
-
* whenever a null data source is encountered (this can be because mData
|
9756 |
-
* is set to null, or because the data source itself is null).
|
9757 |
-
* @type string
|
9758 |
-
* @default null
|
9759 |
-
*/
|
9760 |
-
"sDefaultContent": null,
|
9761 |
-
|
9762 |
-
/**
|
9763 |
-
* Name for the column, allowing reference to the column by name as well as
|
9764 |
-
* by index (needs a lookup to work by name).
|
9765 |
-
* @type string
|
9766 |
-
*/
|
9767 |
-
"sName": null,
|
9768 |
-
|
9769 |
-
/**
|
9770 |
-
* Custom sorting data type - defines which of the available plug-ins in
|
9771 |
-
* afnSortData the custom sorting will use - if any is defined.
|
9772 |
-
* @type string
|
9773 |
-
* @default std
|
9774 |
-
*/
|
9775 |
-
"sSortDataType": 'std',
|
9776 |
-
|
9777 |
-
/**
|
9778 |
-
* Class to be applied to the header element when sorting on this column
|
9779 |
-
* @type string
|
9780 |
-
* @default null
|
9781 |
-
*/
|
9782 |
-
"sSortingClass": null,
|
9783 |
-
|
9784 |
-
/**
|
9785 |
-
* Class to be applied to the header element when sorting on this column -
|
9786 |
-
* when jQuery UI theming is used.
|
9787 |
-
* @type string
|
9788 |
-
* @default null
|
9789 |
-
*/
|
9790 |
-
"sSortingClassJUI": null,
|
9791 |
-
|
9792 |
-
/**
|
9793 |
-
* Title of the column - what is seen in the TH element (nTh).
|
9794 |
-
* @type string
|
9795 |
-
*/
|
9796 |
-
"sTitle": null,
|
9797 |
-
|
9798 |
-
/**
|
9799 |
-
* Column sorting and filtering type
|
9800 |
-
* @type string
|
9801 |
-
* @default null
|
9802 |
-
*/
|
9803 |
-
"sType": null,
|
9804 |
-
|
9805 |
-
/**
|
9806 |
-
* Width of the column
|
9807 |
-
* @type string
|
9808 |
-
* @default null
|
9809 |
-
*/
|
9810 |
-
"sWidth": null,
|
9811 |
-
|
9812 |
-
/**
|
9813 |
-
* Width of the column when it was first "encountered"
|
9814 |
-
* @type string
|
9815 |
-
* @default null
|
9816 |
-
*/
|
9817 |
-
"sWidthOrig": null
|
9818 |
-
};
|
9819 |
-
|
9820 |
-
|
9821 |
-
/*
|
9822 |
-
* Developer note: The properties of the object below are given in Hungarian
|
9823 |
-
* notation, that was used as the interface for WFDataTables prior to v1.10, however
|
9824 |
-
* from v1.10 onwards the primary interface is camel case. In order to avoid
|
9825 |
-
* breaking backwards compatibility utterly with this change, the Hungarian
|
9826 |
-
* version is still, internally the primary interface, but is is not documented
|
9827 |
-
* - hence the @name tags in each doc comment. This allows a Javascript function
|
9828 |
-
* to create a map from Hungarian notation to camel case (going the other direction
|
9829 |
-
* would require each property to be listed, which would at around 3K to the size
|
9830 |
-
* of WFDataTables, while this method is about a 0.5K hit.
|
9831 |
-
*
|
9832 |
-
* Ultimately this does pave the way for Hungarian notation to be dropped
|
9833 |
-
* completely, but that is a massive amount of work and will break current
|
9834 |
-
* installs (therefore is on-hold until v2).
|
9835 |
-
*/
|
9836 |
-
|
9837 |
-
/**
|
9838 |
-
* Initialisation options that can be given to WFDataTables at initialisation
|
9839 |
-
* time.
|
9840 |
-
* @namespace
|
9841 |
-
*/
|
9842 |
-
WFDataTable.defaults = {
|
9843 |
-
/**
|
9844 |
-
* An array of data to use for the table, passed in at initialisation which
|
9845 |
-
* will be used in preference to any data which is already in the DOM. This is
|
9846 |
-
* particularly useful for constructing tables purely in Javascript, for
|
9847 |
-
* example with a custom Ajax call.
|
9848 |
-
* @type array
|
9849 |
-
* @default null
|
9850 |
-
*
|
9851 |
-
* @dtopt Option
|
9852 |
-
* @name WFDataTable.defaults.data
|
9853 |
-
*
|
9854 |
-
* @example
|
9855 |
-
* // Using a 2D array data source
|
9856 |
-
* $(document).ready( function () {
|
9857 |
-
* $('#example').wfDataTable( {
|
9858 |
-
* "data": [
|
9859 |
-
* ['Trident', 'Internet Explorer 4.0', 'Win 95+', 4, 'X'],
|
9860 |
-
* ['Trident', 'Internet Explorer 5.0', 'Win 95+', 5, 'C'],
|
9861 |
-
* ],
|
9862 |
-
* "columns": [
|
9863 |
-
* { "title": "Engine" },
|
9864 |
-
* { "title": "Browser" },
|
9865 |
-
* { "title": "Platform" },
|
9866 |
-
* { "title": "Version" },
|
9867 |
-
* { "title": "Grade" }
|
9868 |
-
* ]
|
9869 |
-
* } );
|
9870 |
-
* } );
|
9871 |
-
*
|
9872 |
-
* @example
|
9873 |
-
* // Using an array of objects as a data source (`data`)
|
9874 |
-
* $(document).ready( function () {
|
9875 |
-
* $('#example').wfDataTable( {
|
9876 |
-
* "data": [
|
9877 |
-
* {
|
9878 |
-
* "engine": "Trident",
|
9879 |
-
* "browser": "Internet Explorer 4.0",
|
9880 |
-
* "platform": "Win 95+",
|
9881 |
-
* "version": 4,
|
9882 |
-
* "grade": "X"
|
9883 |
-
* },
|
9884 |
-
* {
|
9885 |
-
* "engine": "Trident",
|
9886 |
-
* "browser": "Internet Explorer 5.0",
|
9887 |
-
* "platform": "Win 95+",
|
9888 |
-
* "version": 5,
|
9889 |
-
* "grade": "C"
|
9890 |
-
* }
|
9891 |
-
* ],
|
9892 |
-
* "columns": [
|
9893 |
-
* { "title": "Engine", "data": "engine" },
|
9894 |
-
* { "title": "Browser", "data": "browser" },
|
9895 |
-
* { "title": "Platform", "data": "platform" },
|
9896 |
-
* { "title": "Version", "data": "version" },
|
9897 |
-
* { "title": "Grade", "data": "grade" }
|
9898 |
-
* ]
|
9899 |
-
* } );
|
9900 |
-
* } );
|
9901 |
-
*/
|
9902 |
-
"aaData": null,
|
9903 |
-
|
9904 |
-
|
9905 |
-
/**
|
9906 |
-
* If ordering is enabled, then WFDataTables will perform a first pass sort on
|
9907 |
-
* initialisation. You can define which column(s) the sort is performed
|
9908 |
-
* upon, and the sorting direction, with this variable. The `sorting` array
|
9909 |
-
* should contain an array for each column to be sorted initially containing
|
9910 |
-
* the column's index and a direction string ('asc' or 'desc').
|
9911 |
-
* @type array
|
9912 |
-
* @default [[0,'asc']]
|
9913 |
-
*
|
9914 |
-
* @dtopt Option
|
9915 |
-
* @name WFDataTable.defaults.order
|
9916 |
-
*
|
9917 |
-
* @example
|
9918 |
-
* // Sort by 3rd column first, and then 4th column
|
9919 |
-
* $(document).ready( function() {
|
9920 |
-
* $('#example').wfDataTable( {
|
9921 |
-
* "order": [[2,'asc'], [3,'desc']]
|
9922 |
-
* } );
|
9923 |
-
* } );
|
9924 |
-
*
|
9925 |
-
* // No initial sorting
|
9926 |
-
* $(document).ready( function() {
|
9927 |
-
* $('#example').wfDataTable( {
|
9928 |
-
* "order": []
|
9929 |
-
* } );
|
9930 |
-
* } );
|
9931 |
-
*/
|
9932 |
-
"aaSorting": [[0,'asc']],
|
9933 |
-
|
9934 |
-
|
9935 |
-
/**
|
9936 |
-
* This parameter is basically identical to the `sorting` parameter, but
|
9937 |
-
* cannot be overridden by user interaction with the table. What this means
|
9938 |
-
* is that you could have a column (visible or hidden) which the sorting
|
9939 |
-
* will always be forced on first - any sorting after that (from the user)
|
9940 |
-
* will then be performed as required. This can be useful for grouping rows
|
9941 |
-
* together.
|
9942 |
-
* @type array
|
9943 |
-
* @default null
|
9944 |
-
*
|
9945 |
-
* @dtopt Option
|
9946 |
-
* @name WFDataTable.defaults.orderFixed
|
9947 |
-
*
|
9948 |
-
* @example
|
9949 |
-
* $(document).ready( function() {
|
9950 |
-
* $('#example').wfDataTable( {
|
9951 |
-
* "orderFixed": [[0,'asc']]
|
9952 |
-
* } );
|
9953 |
-
* } )
|
9954 |
-
*/
|
9955 |
-
"aaSortingFixed": [],
|
9956 |
-
|
9957 |
-
|
9958 |
-
/**
|
9959 |
-
* WFDataTables can be instructed to load data to display in the table from a
|
9960 |
-
* Ajax source. This option defines how that Ajax call is made and where to.
|
9961 |
-
*
|
9962 |
-
* The `ajax` property has three different modes of operation, depending on
|
9963 |
-
* how it is defined. These are:
|
9964 |
-
*
|
9965 |
-
* * `string` - Set the URL from where the data should be loaded from.
|
9966 |
-
* * `object` - Define properties for `jQuery.ajax`.
|
9967 |
-
* * `function` - Custom data get function
|
9968 |
-
*
|
9969 |
-
* `string`
|
9970 |
-
* --------
|
9971 |
-
*
|
9972 |
-
* As a string, the `ajax` property simply defines the URL from which
|
9973 |
-
* WFDataTables will load data.
|
9974 |
-
*
|
9975 |
-
* `object`
|
9976 |
-
* --------
|
9977 |
-
*
|
9978 |
-
* As an object, the parameters in the object are passed to
|
9979 |
-
* [jQuery.ajax](http://api.jquery.com/jQuery.ajax/) allowing fine control
|
9980 |
-
* of the Ajax request. WFDataTables has a number of default parameters which
|
9981 |
-
* you can override using this option. Please refer to the jQuery
|
9982 |
-
* documentation for a full description of the options available, although
|
9983 |
-
* the following parameters provide additional options in WFDataTables or
|
9984 |
-
* require special consideration:
|
9985 |
-
*
|
9986 |
-
* * `data` - As with jQuery, `data` can be provided as an object, but it
|
9987 |
-
* can also be used as a function to manipulate the data WFDataTables sends
|
9988 |
-
* to the server. The function takes a single parameter, an object of
|
9989 |
-
* parameters with the values that WFDataTables has readied for sending. An
|
9990 |
-
* object may be returned which will be merged into the WFDataTables
|
9991 |
-
* defaults, or you can add the items to the object that was passed in and
|
9992 |
-
* not return anything from the function. This supersedes `fnServerParams`
|
9993 |
-
* from WFDataTables 1.9-.
|
9994 |
-
*
|
9995 |
-
* * `dataSrc` - By default WFDataTables will look for the property `data` (or
|
9996 |
-
* `aaData` for compatibility with WFDataTables 1.9-) when obtaining data
|
9997 |
-
* from an Ajax source or for server-side processing - this parameter
|
9998 |
-
* allows that property to be changed. You can use Javascript dotted
|
9999 |
-
* object notation to get a data source for multiple levels of nesting, or
|
10000 |
-
* it my be used as a function. As a function it takes a single parameter,
|
10001 |
-
* the JSON returned from the server, which can be manipulated as
|
10002 |
-
* required, with the returned value being that used by WFDataTables as the
|
10003 |
-
* data source for the table. This supersedes `sAjaxDataProp` from
|
10004 |
-
* WFDataTables 1.9-.
|
10005 |
-
*
|
10006 |
-
* * `success` - Should not be overridden it is used internally in
|
10007 |
-
* WFDataTables. To manipulate / transform the data returned by the server
|
10008 |
-
* use `ajax.dataSrc`, or use `ajax` as a function (see below).
|
10009 |
-
*
|
10010 |
-
* `function`
|
10011 |
-
* ----------
|
10012 |
-
*
|
10013 |
-
* As a function, making the Ajax call is left up to yourself allowing
|
10014 |
-
* complete control of the Ajax request. Indeed, if desired, a method other
|
10015 |
-
* than Ajax could be used to obtain the required data, such as Web storage
|
10016 |
-
* or an AIR database.
|
10017 |
-
*
|
10018 |
-
* The function is given four parameters and no return is required. The
|
10019 |
-
* parameters are:
|
10020 |
-
*
|
10021 |
-
* 1. _object_ - Data to send to the server
|
10022 |
-
* 2. _function_ - Callback function that must be executed when the required
|
10023 |
-
* data has been obtained. That data should be passed into the callback
|
10024 |
-
* as the only parameter
|
10025 |
-
* 3. _object_ - WFDataTables settings object for the table
|
10026 |
-
*
|
10027 |
-
* Note that this supersedes `fnServerData` from WFDataTables 1.9-.
|
10028 |
-
*
|
10029 |
-
* @type string|object|function
|
10030 |
-
* @default null
|
10031 |
-
*
|
10032 |
-
* @dtopt Option
|
10033 |
-
* @name WFDataTable.defaults.ajax
|
10034 |
-
* @since 1.10.0
|
10035 |
-
*
|
10036 |
-
* @example
|
10037 |
-
* // Get JSON data from a file via Ajax.
|
10038 |
-
* // Note WFDataTables expects data in the form `{ data: [ ...data... ] }` by default).
|
10039 |
-
* $('#example').wfDataTable( {
|
10040 |
-
* "ajax": "data.json"
|
10041 |
-
* } );
|
10042 |
-
*
|
10043 |
-
* @example
|
10044 |
-
* // Get JSON data from a file via Ajax, using `dataSrc` to change
|
10045 |
-
* // `data` to `tableData` (i.e. `{ tableData: [ ...data... ] }`)
|
10046 |
-
* $('#example').wfDataTable( {
|
10047 |
-
* "ajax": {
|
10048 |
-
* "url": "data.json",
|
10049 |
-
* "dataSrc": "tableData"
|
10050 |
-
* }
|
10051 |
-
* } );
|
10052 |
-
*
|
10053 |
-
* @example
|
10054 |
-
* // Get JSON data from a file via Ajax, using `dataSrc` to read data
|
10055 |
-
* // from a plain array rather than an array in an object
|
10056 |
-
* $('#example').wfDataTable( {
|
10057 |
-
* "ajax": {
|
10058 |
-
* "url": "data.json",
|
10059 |
-
* "dataSrc": ""
|
10060 |
-
* }
|
10061 |
-
* } );
|
10062 |
-
*
|
10063 |
-
* @example
|
10064 |
-
* // Manipulate the data returned from the server - add a link to data
|
10065 |
-
* // (note this can, should, be done using `render` for the column - this
|
10066 |
-
* // is just a simple example of how the data can be manipulated).
|
10067 |
-
* $('#example').wfDataTable( {
|
10068 |
-
* "ajax": {
|
10069 |
-
* "url": "data.json",
|
10070 |
-
* "dataSrc": function ( json ) {
|
10071 |
-
* for ( var i=0, ien=json.length ; i<ien ; i++ ) {
|
10072 |
-
* json[i][0] = '<a href="/message/'+json[i][0]+'>View message</a>';
|
10073 |
-
* }
|
10074 |
-
* return json;
|
10075 |
-
* }
|
10076 |
-
* }
|
10077 |
-
* } );
|
10078 |
-
*
|
10079 |
-
* @example
|
10080 |
-
* // Add data to the request
|
10081 |
-
* $('#example').wfDataTable( {
|
10082 |
-
* "ajax": {
|
10083 |
-
* "url": "data.json",
|
10084 |
-
* "data": function ( d ) {
|
10085 |
-
* return {
|
10086 |
-
* "extra_search": $('#extra').val()
|
10087 |
-
* };
|
10088 |
-
* }
|
10089 |
-
* }
|
10090 |
-
* } );
|
10091 |
-
*
|
10092 |
-
* @example
|
10093 |
-
* // Send request as POST
|
10094 |
-
* $('#example').wfDataTable( {
|
10095 |
-
* "ajax": {
|
10096 |
-
* "url": "data.json",
|
10097 |
-
* "type": "POST"
|
10098 |
-
* }
|
10099 |
-
* } );
|
10100 |
-
*
|
10101 |
-
* @example
|
10102 |
-
* // Get the data from localStorage (could interface with a form for
|
10103 |
-
* // adding, editing and removing rows).
|
10104 |
-
* $('#example').wfDataTable( {
|
10105 |
-
* "ajax": function (data, callback, settings) {
|
10106 |
-
* callback(
|
10107 |
-
* JSON.parse( localStorage.getItem('dataTablesData') )
|
10108 |
-
* );
|
10109 |
-
* }
|
10110 |
-
* } );
|
10111 |
-
*/
|
10112 |
-
"ajax": null,
|
10113 |
-
|
10114 |
-
|
10115 |
-
/**
|
10116 |
-
* This parameter allows you to readily specify the entries in the length drop
|
10117 |
-
* down menu that WFDataTables shows when pagination is enabled. It can be
|
10118 |
-
* either a 1D array of options which will be used for both the displayed
|
10119 |
-
* option and the value, or a 2D array which will use the array in the first
|
10120 |
-
* position as the value, and the array in the second position as the
|
10121 |
-
* displayed options (useful for language strings such as 'All').
|
10122 |
-
*
|
10123 |
-
* Note that the `pageLength` property will be automatically set to the
|
10124 |
-
* first value given in this array, unless `pageLength` is also provided.
|
10125 |
-
* @type array
|
10126 |
-
* @default [ 10, 25, 50, 100 ]
|
10127 |
-
*
|
10128 |
-
* @dtopt Option
|
10129 |
-
* @name WFDataTable.defaults.lengthMenu
|
10130 |
-
*
|
10131 |
-
* @example
|
10132 |
-
* $(document).ready( function() {
|
10133 |
-
* $('#example').wfDataTable( {
|
10134 |
-
* "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
|
10135 |
-
* } );
|
10136 |
-
* } );
|
10137 |
-
*/
|
10138 |
-
"aLengthMenu": [ 10, 25, 50, 100 ],
|
10139 |
-
|
10140 |
-
|
10141 |
-
/**
|
10142 |
-
* The `columns` option in the initialisation parameter allows you to define
|
10143 |
-
* details about the way individual columns behave. For a full list of
|
10144 |
-
* column options that can be set, please see
|
10145 |
-
* {@link WFDataTable.defaults.column}. Note that if you use `columns` to
|
10146 |
-
* define your columns, you must have an entry in the array for every single
|
10147 |
-
* column that you have in your table (these can be null if you don't which
|
10148 |
-
* to specify any options).
|
10149 |
-
* @member
|
10150 |
-
*
|
10151 |
-
* @name WFDataTable.defaults.column
|
10152 |
-
*/
|
10153 |
-
"aoColumns": null,
|
10154 |
-
|
10155 |
-
/**
|
10156 |
-
* Very similar to `columns`, `columnDefs` allows you to target a specific
|
10157 |
-
* column, multiple columns, or all columns, using the `targets` property of
|
10158 |
-
* each object in the array. This allows great flexibility when creating
|
10159 |
-
* tables, as the `columnDefs` arrays can be of any length, targeting the
|
10160 |
-
* columns you specifically want. `columnDefs` may use any of the column
|
10161 |
-
* options available: {@link WFDataTable.defaults.column}, but it _must_
|
10162 |
-
* have `targets` defined in each object in the array. Values in the `targets`
|
10163 |
-
* array may be:
|
10164 |
-
* <ul>
|
10165 |
-
* <li>a string - class name will be matched on the TH for the column</li>
|
10166 |
-
* <li>0 or a positive integer - column index counting from the left</li>
|
10167 |
-
* <li>a negative integer - column index counting from the right</li>
|
10168 |
-
* <li>the string "_all" - all columns (i.e. assign a default)</li>
|
10169 |
-
* </ul>
|
10170 |
-
* @member
|
10171 |
-
*
|
10172 |
-
* @name WFDataTable.defaults.columnDefs
|
10173 |
-
*/
|
10174 |
-
"aoColumnDefs": null,
|
10175 |
-
|
10176 |
-
|
10177 |
-
/**
|
10178 |
-
* Basically the same as `search`, this parameter defines the individual column
|
10179 |
-
* filtering state at initialisation time. The array must be of the same size
|
10180 |
-
* as the number of columns, and each element be an object with the parameters
|
10181 |
-
* `search` and `escapeRegex` (the latter is optional). 'null' is also
|
10182 |
-
* accepted and the default will be used.
|
10183 |
-
* @type array
|
10184 |
-
* @default []
|
10185 |
-
*
|
10186 |
-
* @dtopt Option
|
10187 |
-
* @name WFDataTable.defaults.searchCols
|
10188 |
-
*
|
10189 |
-
* @example
|
10190 |
-
* $(document).ready( function() {
|
10191 |
-
* $('#example').wfDataTable( {
|
10192 |
-
* "searchCols": [
|
10193 |
-
* null,
|
10194 |
-
* { "search": "My filter" },
|
10195 |
-
* null,
|
10196 |
-
* { "search": "^[0-9]", "escapeRegex": false }
|
10197 |
-
* ]
|
10198 |
-
* } );
|
10199 |
-
* } )
|
10200 |
-
*/
|
10201 |
-
"aoSearchCols": [],
|
10202 |
-
|
10203 |
-
|
10204 |
-
/**
|
10205 |
-
* An array of CSS classes that should be applied to displayed rows. This
|
10206 |
-
* array may be of any length, and WFDataTables will apply each class
|
10207 |
-
* sequentially, looping when required.
|
10208 |
-
* @type array
|
10209 |
-
* @default null <i>Will take the values determined by the `oClasses.stripe*`
|
10210 |
-
* options</i>
|
10211 |
-
*
|
10212 |
-
* @dtopt Option
|
10213 |
-
* @name WFDataTable.defaults.stripeClasses
|
10214 |
-
*
|
10215 |
-
* @example
|
10216 |
-
* $(document).ready( function() {
|
10217 |
-
* $('#example').wfDataTable( {
|
10218 |
-
* "stripeClasses": [ 'strip1', 'strip2', 'strip3' ]
|
10219 |
-
* } );
|
10220 |
-
* } )
|
10221 |
-
*/
|
10222 |
-
"asStripeClasses": null,
|
10223 |
-
|
10224 |
-
|
10225 |
-
/**
|
10226 |
-
* Enable or disable automatic column width calculation. This can be disabled
|
10227 |
-
* as an optimisation (it takes some time to calculate the widths) if the
|
10228 |
-
* tables widths are passed in using `columns`.
|
10229 |
-
* @type boolean
|
10230 |
-
* @default true
|
10231 |
-
*
|
10232 |
-
* @dtopt Features
|
10233 |
-
* @name WFDataTable.defaults.autoWidth
|
10234 |
-
*
|
10235 |
-
* @example
|
10236 |
-
* $(document).ready( function () {
|
10237 |
-
* $('#example').wfDataTable( {
|
10238 |
-
* "autoWidth": false
|
10239 |
-
* } );
|
10240 |
-
* } );
|
10241 |
-
*/
|
10242 |
-
"bAutoWidth": true,
|
10243 |
-
|
10244 |
-
|
10245 |
-
/**
|
10246 |
-
* Deferred rendering can provide WFDataTables with a huge speed boost when you
|
10247 |
-
* are using an Ajax or JS data source for the table. This option, when set to
|
10248 |
-
* true, will cause WFDataTables to defer the creation of the table elements for
|
10249 |
-
* each row until they are needed for a draw - saving a significant amount of
|
10250 |
-
* time.
|
10251 |
-
* @type boolean
|
10252 |
-
* @default false
|
10253 |
-
*
|
10254 |
-
* @dtopt Features
|
10255 |
-
* @name WFDataTable.defaults.deferRender
|
10256 |
-
*
|
10257 |
-
* @example
|
10258 |
-
* $(document).ready( function() {
|
10259 |
-
* $('#example').wfDataTable( {
|
10260 |
-
* "ajax": "sources/arrays.txt",
|
10261 |
-
* "deferRender": true
|
10262 |
-
* } );
|
10263 |
-
* } );
|
10264 |
-
*/
|
10265 |
-
"bDeferRender": false,
|
10266 |
-
|
10267 |
-
|
10268 |
-
/**
|
10269 |
-
* Replace a WFDataTable which matches the given selector and replace it with
|
10270 |
-
* one which has the properties of the new initialisation object passed. If no
|
10271 |
-
* table matches the selector, then the new WFDataTable will be constructed as
|
10272 |
-
* per normal.
|
10273 |
-
* @type boolean
|
10274 |
-
* @default false
|
10275 |
-
*
|
10276 |
-
* @dtopt Options
|
10277 |
-
* @name WFDataTable.defaults.destroy
|
10278 |
-
*
|
10279 |
-
* @example
|
10280 |
-
* $(document).ready( function() {
|
10281 |
-
* $('#example').wfDataTable( {
|
10282 |
-
* "srollY": "200px",
|
10283 |
-
* "paginate": false
|
10284 |
-
* } );
|
10285 |
-
*
|
10286 |
-
* // Some time later....
|
10287 |
-
* $('#example').wfDataTable( {
|
10288 |
-
* "filter": false,
|
10289 |
-
* "destroy": true
|
10290 |
-
* } );
|
10291 |
-
* } );
|
10292 |
-
*/
|
10293 |
-
"bDestroy": false,
|
10294 |
-
|
10295 |
-
|
10296 |
-
/**
|
10297 |
-
* Enable or disable filtering of data. Filtering in WFDataTables is "smart" in
|
10298 |
-
* that it allows the end user to input multiple words (space separated) and
|
10299 |
-
* will match a row containing those words, even if not in the order that was
|
10300 |
-
* specified (this allow matching across multiple columns). Note that if you
|
10301 |
-
* wish to use filtering in WFDataTables this must remain 'true' - to remove the
|
10302 |
-
* default filtering input box and retain filtering abilities, please use
|
10303 |
-
* {@link WFDataTable.defaults.dom}.
|
10304 |
-
* @type boolean
|
10305 |
-
* @default true
|
10306 |
-
*
|
10307 |
-
* @dtopt Features
|
10308 |
-
* @name WFDataTable.defaults.searching
|
10309 |
-
*
|
10310 |
-
* @example
|
10311 |
-
* $(document).ready( function () {
|
10312 |
-
* $('#example').wfDataTable( {
|
10313 |
-
* "searching": false
|
10314 |
-
* } );
|
10315 |
-
* } );
|
10316 |
-
*/
|
10317 |
-
"bFilter": true,
|
10318 |
-
|
10319 |
-
|
10320 |
-
/**
|
10321 |
-
* Enable or disable the table information display. This shows information
|
10322 |
-
* about the data that is currently visible on the page, including information
|
10323 |
-
* about filtered data if that action is being performed.
|
10324 |
-
* @type boolean
|
10325 |
-
* @default true
|
10326 |
-
*
|
10327 |
-
* @dtopt Features
|
10328 |
-
* @name WFDataTable.defaults.info
|
10329 |
-
*
|
10330 |
-
* @example
|
10331 |
-
* $(document).ready( function () {
|
10332 |
-
* $('#example').wfDataTable( {
|
10333 |
-
* "info": false
|
10334 |
-
* } );
|
10335 |
-
* } );
|
10336 |
-
*/
|
10337 |
-
"bInfo": true,
|
10338 |
-
|
10339 |
-
|
10340 |
-
/**
|
10341 |
-
* Enable jQuery UI ThemeRoller support (required as ThemeRoller requires some
|
10342 |
-
* slightly different and additional mark-up from what WFDataTables has
|
10343 |
-
* traditionally used).
|
10344 |
-
* @type boolean
|
10345 |
-
* @default false
|
10346 |
-
*
|
10347 |
-
* @dtopt Features
|
10348 |
-
* @name WFDataTable.defaults.jQueryUI
|
10349 |
-
*
|
10350 |
-
* @example
|
10351 |
-
* $(document).ready( function() {
|
10352 |
-
* $('#example').wfDataTable( {
|
10353 |
-
* "jQueryUI": true
|
10354 |
-
* } );
|
10355 |
-
* } );
|
10356 |
-
*/
|
10357 |
-
"bJQueryUI": false,
|
10358 |
-
|
10359 |
-
|
10360 |
-
/**
|
10361 |
-
* Allows the end user to select the size of a formatted page from a select
|
10362 |
-
* menu (sizes are 10, 25, 50 and 100). Requires pagination (`paginate`).
|
10363 |
-
* @type boolean
|
10364 |
-
* @default true
|
10365 |
-
*
|
10366 |
-
* @dtopt Features
|
10367 |
-
* @name WFDataTable.defaults.lengthChange
|
10368 |
-
*
|
10369 |
-
* @example
|
10370 |
-
* $(document).ready( function () {
|
10371 |
-
* $('#example').wfDataTable( {
|
10372 |
-
* "lengthChange": false
|
10373 |
-
* } );
|
10374 |
-
* } );
|
10375 |
-
*/
|
10376 |
-
"bLengthChange": true,
|
10377 |
-
|
10378 |
-
|
10379 |
-
/**
|
10380 |
-
* Enable or disable pagination.
|
10381 |
-
* @type boolean
|
10382 |
-
* @default true
|
10383 |
-
*
|
10384 |
-
* @dtopt Features
|
10385 |
-
* @name WFDataTable.defaults.paging
|
10386 |
-
*
|
10387 |
-
* @example
|
10388 |
-
* $(document).ready( function () {
|
10389 |
-
* $('#example').wfDataTable( {
|
10390 |
-
* "paging": false
|
10391 |
-
* } );
|
10392 |
-
* } );
|
10393 |
-
*/
|
10394 |
-
"bPaginate": true,
|
10395 |
-
|
10396 |
-
|
10397 |
-
/**
|
10398 |
-
* Enable or disable the display of a 'processing' indicator when the table is
|
10399 |
-
* being processed (e.g. a sort). This is particularly useful for tables with
|
10400 |
-
* large amounts of data where it can take a noticeable amount of time to sort
|
10401 |
-
* the entries.
|
10402 |
-
* @type boolean
|
10403 |
-
* @default false
|
10404 |
-
*
|
10405 |
-
* @dtopt Features
|
10406 |
-
* @name WFDataTable.defaults.processing
|
10407 |
-
*
|
10408 |
-
* @example
|
10409 |
-
* $(document).ready( function () {
|
10410 |
-
* $('#example').wfDataTable( {
|
10411 |
-
* "processing": true
|
10412 |
-
* } );
|
10413 |
-
* } );
|
10414 |
-
*/
|
10415 |
-
"bProcessing": false,
|
10416 |
-
|
10417 |
-
|
10418 |
-
/**
|
10419 |
-
* Retrieve the WFDataTables object for the given selector. Note that if the
|
10420 |
-
* table has already been initialised, this parameter will cause WFDataTables
|
10421 |
-
* to simply return the object that has already been set up - it will not take
|
10422 |
-
* account of any changes you might have made to the initialisation object
|
10423 |
-
* passed to WFDataTables (setting this parameter to true is an acknowledgement
|
10424 |
-
* that you understand this). `destroy` can be used to reinitialise a table if
|
10425 |
-
* you need.
|
10426 |
-
* @type boolean
|
10427 |
-
* @default false
|
10428 |
-
*
|
10429 |
-
* @dtopt Options
|
10430 |
-
* @name WFDataTable.defaults.retrieve
|
10431 |
-
*
|
10432 |
-
* @example
|
10433 |
-
* $(document).ready( function() {
|
10434 |
-
* initTable();
|
10435 |
-
* tableActions();
|
10436 |
-
* } );
|
10437 |
-
*
|
10438 |
-
* function initTable ()
|
10439 |
-
* {
|
10440 |
-
* return $('#example').wfDataTable( {
|
10441 |
-
* "scrollY": "200px",
|
10442 |
-
* "paginate": false,
|
10443 |
-
* "retrieve": true
|
10444 |
-
* } );
|
10445 |
-
* }
|
10446 |
-
*
|
10447 |
-
* function tableActions ()
|
10448 |
-
* {
|
10449 |
-
* var table = initTable();
|
10450 |
-
* // perform API operations with oTable
|
10451 |
-
* }
|
10452 |
-
*/
|
10453 |
-
"bRetrieve": false,
|
10454 |
-
|
10455 |
-
|
10456 |
-
/**
|
10457 |
-
* When vertical (y) scrolling is enabled, WFDataTables will force the height of
|
10458 |
-
* the table's viewport to the given height at all times (useful for layout).
|
10459 |
-
* However, this can look odd when filtering data down to a small data set,
|
10460 |
-
* and the footer is left "floating" further down. This parameter (when
|
10461 |
-
* enabled) will cause WFDataTables to collapse the table's viewport down when
|
10462 |
-
* the result set will fit within the given Y height.
|
10463 |
-
* @type boolean
|
10464 |
-
* @default false
|
10465 |
-
*
|
10466 |
-
* @dtopt Options
|
10467 |
-
* @name WFDataTable.defaults.scrollCollapse
|
10468 |
-
*
|
10469 |
-
* @example
|
10470 |
-
* $(document).ready( function() {
|
10471 |
-
* $('#example').wfDataTable( {
|
10472 |
-
* "scrollY": "200",
|
10473 |
-
* "scrollCollapse": true
|
10474 |
-
* } );
|
10475 |
-
* } );
|
10476 |
-
*/
|
10477 |
-
"bScrollCollapse": false,
|
10478 |
-
|
10479 |
-
|
10480 |
-
/**
|
10481 |
-
* Configure WFDataTables to use server-side processing. Note that the
|
10482 |
-
* `ajax` parameter must also be given in order to give WFDataTables a
|
10483 |
-
* source to obtain the required data for each draw.
|
10484 |
-
* @type boolean
|
10485 |
-
* @default false
|
10486 |
-
*
|
10487 |
-
* @dtopt Features
|
10488 |
-
* @dtopt Server-side
|
10489 |
-
* @name WFDataTable.defaults.serverSide
|
10490 |
-
*
|
10491 |
-
* @example
|
10492 |
-
* $(document).ready( function () {
|
10493 |
-
* $('#example').wfDataTable( {
|
10494 |
-
* "serverSide": true,
|
10495 |
-
* "ajax": "xhr.php"
|
10496 |
-
* } );
|
10497 |
-
* } );
|
10498 |
-
*/
|
10499 |
-
"bServerSide": false,
|
10500 |
-
|
10501 |
-
|
10502 |
-
/**
|
10503 |
-
* Enable or disable sorting of columns. Sorting of individual columns can be
|
10504 |
-
* disabled by the `sortable` option for each column.
|
10505 |
-
* @type boolean
|
10506 |
-
* @default true
|
10507 |
-
*
|
10508 |
-
* @dtopt Features
|
10509 |
-
* @name WFDataTable.defaults.ordering
|
10510 |
-
*
|
10511 |
-
* @example
|
10512 |
-
* $(document).ready( function () {
|
10513 |
-
* $('#example').wfDataTable( {
|
10514 |
-
* "ordering": false
|
10515 |
-
* } );
|
10516 |
-
* } );
|
10517 |
-
*/
|
10518 |
-
"bSort": true,
|
10519 |
-
|
10520 |
-
|
10521 |
-
/**
|
10522 |
-
* Enable or display WFDataTables' ability to sort multiple columns at the
|
10523 |
-
* same time (activated by shift-click by the user).
|
10524 |
-
* @type boolean
|
10525 |
-
* @default true
|
10526 |
-
*
|
10527 |
-
* @dtopt Options
|
10528 |
-
* @name WFDataTable.defaults.orderMulti
|
10529 |
-
*
|
10530 |
-
* @example
|
10531 |
-
* // Disable multiple column sorting ability
|
10532 |
-
* $(document).ready( function () {
|
10533 |
-
* $('#example').wfDataTable( {
|
10534 |
-
* "orderMulti": false
|
10535 |
-
* } );
|
10536 |
-
* } );
|
10537 |
-
*/
|
10538 |
-
"bSortMulti": true,
|
10539 |
-
|
10540 |
-
|
10541 |
-
/**
|
10542 |
-
* Allows control over whether WFDataTables should use the top (true) unique
|
10543 |
-
* cell that is found for a single column, or the bottom (false - default).
|
10544 |
-
* This is useful when using complex headers.
|
10545 |
-
* @type boolean
|
10546 |
-
* @default false
|
10547 |
-
*
|
10548 |
-
* @dtopt Options
|
10549 |
-
* @name WFDataTable.defaults.orderCellsTop
|
10550 |
-
*
|
10551 |
-
* @example
|
10552 |
-
* $(document).ready( function() {
|
10553 |
-
* $('#example').wfDataTable( {
|
10554 |
-
* "orderCellsTop": true
|
10555 |
-
* } );
|
10556 |
-
* } );
|
10557 |
-
*/
|
10558 |
-
"bSortCellsTop": false,
|
10559 |
-
|
10560 |
-
|
10561 |
-
/**
|
10562 |
-
* Enable or disable the addition of the classes `sorting\_1`, `sorting\_2` and
|
10563 |
-
* `sorting\_3` to the columns which are currently being sorted on. This is
|
10564 |
-
* presented as a feature switch as it can increase processing time (while
|
10565 |
-
* classes are removed and added) so for large data sets you might want to
|
10566 |
-
* turn this off.
|
10567 |
-
* @type boolean
|
10568 |
-
* @default true
|
10569 |
-
*
|
10570 |
-
* @dtopt Features
|
10571 |
-
* @name WFDataTable.defaults.orderClasses
|
10572 |
-
*
|
10573 |
-
* @example
|
10574 |
-
* $(document).ready( function () {
|
10575 |
-
* $('#example').wfDataTable( {
|
10576 |
-
* "orderClasses": false
|
10577 |
-
* } );
|
10578 |
-
* } );
|
10579 |
-
*/
|
10580 |
-
"bSortClasses": true,
|
10581 |
-
|
10582 |
-
|
10583 |
-
/**
|
10584 |
-
* Enable or disable state saving. When enabled HTML5 `localStorage` will be
|
10585 |
-
* used to save table display information such as pagination information,
|
10586 |
-
* display length, filtering and sorting. As such when the end user reloads
|
10587 |
-
* the page the display display will match what thy had previously set up.
|
10588 |
-
*
|
10589 |
-
* Due to the use of `localStorage` the default state saving is not supported
|
10590 |
-
* in IE6 or 7. If state saving is required in those browsers, use
|
10591 |
-
* `stateSaveCallback` to provide a storage solution such as cookies.
|
10592 |
-
* @type boolean
|
10593 |
-
* @default false
|
10594 |
-
*
|
10595 |
-
* @dtopt Features
|
10596 |
-
* @name WFDataTable.defaults.stateSave
|
10597 |
-
*
|
10598 |
-
* @example
|
10599 |
-
* $(document).ready( function () {
|
10600 |
-
* $('#example').wfDataTable( {
|
10601 |
-
* "stateSave": true
|
10602 |
-
* } );
|
10603 |
-
* } );
|
10604 |
-
*/
|
10605 |
-
"bStateSave": false,
|
10606 |
-
|
10607 |
-
|
10608 |
-
/**
|
10609 |
-
* This function is called when a TR element is created (and all TD child
|
10610 |
-
* elements have been inserted), or registered if using a DOM source, allowing
|
10611 |
-
* manipulation of the TR element (adding classes etc).
|
10612 |
-
* @type function
|
10613 |
-
* @param {node} row "TR" element for the current row
|
10614 |
-
* @param {array} data Raw data array for this row
|
10615 |
-
* @param {int} dataIndex The index of this row in the internal aoData array
|
10616 |
-
*
|
10617 |
-
* @dtopt Callbacks
|
10618 |
-
* @name WFDataTable.defaults.createdRow
|
10619 |
-
*
|
10620 |
-
* @example
|
10621 |
-
* $(document).ready( function() {
|
10622 |
-
* $('#example').wfDataTable( {
|
10623 |
-
* "createdRow": function( row, data, dataIndex ) {
|
10624 |
-
* // Bold the grade for all 'A' grade browsers
|
10625 |
-
* if ( data[4] == "A" )
|
10626 |
-
* {
|
10627 |
-
* $('td:eq(4)', row).html( '<b>A</b>' );
|
10628 |
-
* }
|
10629 |
-
* }
|
10630 |
-
* } );
|
10631 |
-
* } );
|
10632 |
-
*/
|
10633 |
-
"fnCreatedRow": null,
|
10634 |
-
|
10635 |
-
|
10636 |
-
/**
|
10637 |
-
* This function is called on every 'draw' event, and allows you to
|
10638 |
-
* dynamically modify any aspect you want about the created DOM.
|
10639 |
-
* @type function
|
10640 |
-
* @param {object} settings WFDataTables settings object
|
10641 |
-
*
|
10642 |
-
* @dtopt Callbacks
|
10643 |
-
* @name WFDataTable.defaults.drawCallback
|
10644 |
-
*
|
10645 |
-
* @example
|
10646 |
-
* $(document).ready( function() {
|
10647 |
-
* $('#example').wfDataTable( {
|
10648 |
-
* "drawCallback": function( settings ) {
|
10649 |
-
* alert( 'WFDataTables has redrawn the table' );
|
10650 |
-
* }
|
10651 |
-
* } );
|
10652 |
-
* } );
|
10653 |
-
*/
|
10654 |
-
"fnDrawCallback": null,
|
10655 |
-
|
10656 |
-
|
10657 |
-
/**
|
10658 |
-
* Identical to fnHeaderCallback() but for the table footer this function
|
10659 |
-
* allows you to modify the table footer on every 'draw' event.
|
10660 |
-
* @type function
|
10661 |
-
* @param {node} foot "TR" element for the footer
|
10662 |
-
* @param {array} data Full table data (as derived from the original HTML)
|
10663 |
-
* @param {int} start Index for the current display starting point in the
|
10664 |
-
* display array
|
10665 |
-
* @param {int} end Index for the current display ending point in the
|
10666 |
-
* display array
|
10667 |
-
* @param {array int} display Index array to translate the visual position
|
10668 |
-
* to the full data array
|
10669 |
-
*
|
10670 |
-
* @dtopt Callbacks
|
10671 |
-
* @name WFDataTable.defaults.footerCallback
|
10672 |
-
*
|
10673 |
-
* @example
|
10674 |
-
* $(document).ready( function() {
|
10675 |
-
* $('#example').wfDataTable( {
|
10676 |
-
* "footerCallback": function( tfoot, data, start, end, display ) {
|
10677 |
-
* tfoot.getElementsByTagName('th')[0].innerHTML = "Starting index is "+start;
|
10678 |
-
* }
|
10679 |
-
* } );
|
10680 |
-
* } )
|
10681 |
-
*/
|
10682 |
-
"fnFooterCallback": null,
|
10683 |
-
|
10684 |
-
|
10685 |
-
/**
|
10686 |
-
* When rendering large numbers in the information element for the table
|
10687 |
-
* (i.e. "Showing 1 to 10 of 57 entries") WFDataTables will render large numbers
|
10688 |
-
* to have a comma separator for the 'thousands' units (e.g. 1 million is
|
10689 |
-
* rendered as "1,000,000") to help readability for the end user. This
|
10690 |
-
* function will override the default method WFDataTables uses.
|
10691 |
-
* @type function
|
10692 |
-
* @member
|
10693 |
-
* @param {int} toFormat number to be formatted
|
10694 |
-
* @returns {string} formatted string for WFDataTables to show the number
|
10695 |
-
*
|
10696 |
-
* @dtopt Callbacks
|
10697 |
-
* @name WFDataTable.defaults.formatNumber
|
10698 |
-
*
|
10699 |
-
* @example
|
10700 |
-
* // Format a number using a single quote for the separator (note that
|
10701 |
-
* // this can also be done with the language.thousands option)
|
10702 |
-
* $(document).ready( function() {
|
10703 |
-
* $('#example').wfDataTable( {
|
10704 |
-
* "formatNumber": function ( toFormat ) {
|
10705 |
-
* return toFormat.toString().replace(
|
10706 |
-
* /\B(?=(\d{3})+(?!\d))/g, "'"
|
10707 |
-
* );
|
10708 |
-
* };
|
10709 |
-
* } );
|
10710 |
-
* } );
|
10711 |
-
*/
|
10712 |
-
"fnFormatNumber": function ( toFormat ) {
|
10713 |
-
return toFormat.toString().replace(
|
10714 |
-
/\B(?=(\d{3})+(?!\d))/g,
|
10715 |
-
this.oLanguage.sThousands
|
10716 |
-
);
|
10717 |
-
},
|
10718 |
-
|
10719 |
-
|
10720 |
-
/**
|
10721 |
-
* This function is called on every 'draw' event, and allows you to
|
10722 |
-
* dynamically modify the header row. This can be used to calculate and
|
10723 |
-
* display useful information about the table.
|
10724 |
-
* @type function
|
10725 |
-
* @param {node} head "TR" element for the header
|
10726 |
-
* @param {array} data Full table data (as derived from the original HTML)
|
10727 |
-
* @param {int} start Index for the current display starting point in the
|
10728 |
-
* display array
|
10729 |
-
* @param {int} end Index for the current display ending point in the
|
10730 |
-
* display array
|
10731 |
-
* @param {array int} display Index array to translate the visual position
|
10732 |
-
* to the full data array
|
10733 |
-
*
|
10734 |
-
* @dtopt Callbacks
|
10735 |
-
* @name WFDataTable.defaults.headerCallback
|
10736 |
-
*
|
10737 |
-
* @example
|
10738 |
-
* $(document).ready( function() {
|
10739 |
-
* $('#example').wfDataTable( {
|
10740 |
-
* "fheaderCallback": function( head, data, start, end, display ) {
|
10741 |
-
* head.getElementsByTagName('th')[0].innerHTML = "Displaying "+(end-start)+" records";
|
10742 |
-
* }
|
10743 |
-
* } );
|
10744 |
-
* } )
|
10745 |
-
*/
|
10746 |
-
"fnHeaderCallback": null,
|
10747 |
-
|
10748 |
-
|
10749 |
-
/**
|
10750 |
-
* The information element can be used to convey information about the current
|
10751 |
-
* state of the table. Although the internationalisation options presented by
|
10752 |
-
* WFDataTables are quite capable of dealing with most customisations, there may
|
10753 |
-
* be times where you wish to customise the string further. This callback
|
10754 |
-
* allows you to do exactly that.
|
10755 |
-
* @type function
|
10756 |
-
* @param {object} oSettings WFDataTables settings object
|
10757 |
-
* @param {int} start Starting position in data for the draw
|
10758 |
-
* @param {int} end End position in data for the draw
|
10759 |
-
* @param {int} max Total number of rows in the table (regardless of
|
10760 |
-
* filtering)
|
10761 |
-
* @param {int} total Total number of rows in the data set, after filtering
|
10762 |
-
* @param {string} pre The string that WFDataTables has formatted using it's
|
10763 |
-
* own rules
|
10764 |
-
* @returns {string} The string to be displayed in the information element.
|
10765 |
-
*
|
10766 |
-
* @dtopt Callbacks
|
10767 |
-
* @name WFDataTable.defaults.infoCallback
|
10768 |
-
*
|
10769 |
-
* @example
|
10770 |
-
* $('#example').wfDataTable( {
|
10771 |
-
* "infoCallback": function( settings, start, end, max, total, pre ) {
|
10772 |
-
* return start +" to "+ end;
|
10773 |
-
* }
|
10774 |
-
* } );
|
10775 |
-
*/
|
10776 |
-
"fnInfoCallback": null,
|
10777 |
-
|
10778 |
-
|
10779 |
-
/**
|
10780 |
-
* Called when the table has been initialised. Normally WFDataTables will
|
10781 |
-
* initialise sequentially and there will be no need for this function,
|
10782 |
-
* however, this does not hold true when using external language information
|
10783 |
-
* since that is obtained using an async XHR call.
|
10784 |
-
* @type function
|
10785 |
-
* @param {object} settings WFDataTables settings object
|
10786 |
-
* @param {object} json The JSON object request from the server - only
|
10787 |
-
* present if client-side Ajax sourced data is used
|
10788 |
-
*
|
10789 |
-
* @dtopt Callbacks
|
10790 |
-
* @name WFDataTable.defaults.initComplete
|
10791 |
-
*
|
10792 |
-
* @example
|
10793 |
-
* $(document).ready( function() {
|
10794 |
-
* $('#example').wfDataTable( {
|
10795 |
-
* "initComplete": function(settings, json) {
|
10796 |
-
* alert( 'WFDataTables has finished its initialisation.' );
|
10797 |
-
* }
|
10798 |
-
* } );
|
10799 |
-
* } )
|
10800 |
-
*/
|
10801 |
-
"fnInitComplete": null,
|
10802 |
-
|
10803 |
-
|
10804 |
-
/**
|
10805 |
-
* Called at the very start of each table draw and can be used to cancel the
|
10806 |
-
* draw by returning false, any other return (including undefined) results in
|
10807 |
-
* the full draw occurring).
|
10808 |
-
* @type function
|
10809 |
-
* @param {object} settings WFDataTables settings object
|
10810 |
-
* @returns {boolean} False will cancel the draw, anything else (including no
|
10811 |
-
* return) will allow it to complete.
|
10812 |
-
*
|
10813 |
-
* @dtopt Callbacks
|
10814 |
-
* @name WFDataTable.defaults.preDrawCallback
|
10815 |
-
*
|
10816 |
-
* @example
|
10817 |
-
* $(document).ready( function() {
|
10818 |
-
* $('#example').wfDataTable( {
|
10819 |
-
* "preDrawCallback": function( settings ) {
|
10820 |
-
* if ( $('#test').val() == 1 ) {
|
10821 |
-
* return false;
|
10822 |
-
* }
|
10823 |
-
* }
|
10824 |
-
* } );
|
10825 |
-
* } );
|
10826 |
-
*/
|
10827 |
-
"fnPreDrawCallback": null,
|
10828 |
-
|
10829 |
-
|
10830 |
-
/**
|
10831 |
-
* This function allows you to 'post process' each row after it have been
|
10832 |
-
* generated for each table draw, but before it is rendered on screen. This
|
10833 |
-
* function might be used for setting the row class name etc.
|
10834 |
-
* @type function
|
10835 |
-
* @param {node} row "TR" element for the current row
|
10836 |
-
* @param {array} data Raw data array for this row
|
10837 |
-
* @param {int} displayIndex The display index for the current table draw
|
10838 |
-
* @param {int} displayIndexFull The index of the data in the full list of
|
10839 |
-
* rows (after filtering)
|
10840 |
-
*
|
10841 |
-
* @dtopt Callbacks
|
10842 |
-
* @name WFDataTable.defaults.rowCallback
|
10843 |
-
*
|
10844 |
-
* @example
|
10845 |
-
* $(document).ready( function() {
|
10846 |
-
* $('#example').wfDataTable( {
|
10847 |
-
* "rowCallback": function( row, data, displayIndex, displayIndexFull ) {
|
10848 |
-
* // Bold the grade for all 'A' grade browsers
|
10849 |
-
* if ( data[4] == "A" ) {
|
10850 |
-
* $('td:eq(4)', row).html( '<b>A</b>' );
|
10851 |
-
* }
|
10852 |
-
* }
|
10853 |
-
* } );
|
10854 |
-
* } );
|
10855 |
-
*/
|
10856 |
-
"fnRowCallback": null,
|
10857 |
-
|
10858 |
-
|
10859 |
-
/**
|
10860 |
-
* __Deprecated__ The functionality provided by this parameter has now been
|
10861 |
-
* superseded by that provided through `ajax`, which should be used instead.
|
10862 |
-
*
|
10863 |
-
* This parameter allows you to override the default function which obtains
|
10864 |
-
* the data from the server so something more suitable for your application.
|
10865 |
-
* For example you could use POST data, or pull information from a Gears or
|
10866 |
-
* AIR database.
|
10867 |
-
* @type function
|
10868 |
-
* @member
|
10869 |
-
* @param {string} source HTTP source to obtain the data from (`ajax`)
|
10870 |
-
* @param {array} data A key/value pair object containing the data to send
|
10871 |
-
* to the server
|
10872 |
-
* @param {function} callback to be called on completion of the data get
|
10873 |
-
* process that will draw the data on the page.
|
10874 |
-
* @param {object} settings WFDataTables settings object
|
10875 |
-
*
|
10876 |
-
* @dtopt Callbacks
|
10877 |
-
* @dtopt Server-side
|
10878 |
-
* @name WFDataTable.defaults.serverData
|
10879 |
-
*
|
10880 |
-
* @deprecated 1.10. Please use `ajax` for this functionality now.
|
10881 |
-
*/
|
10882 |
-
"fnServerData": null,
|
10883 |
-
|
10884 |
-
|
10885 |
-
/**
|
10886 |
-
* __Deprecated__ The functionality provided by this parameter has now been
|
10887 |
-
* superseded by that provided through `ajax`, which should be used instead.
|
10888 |
-
*
|
10889 |
-
* It is often useful to send extra data to the server when making an Ajax
|
10890 |
-
* request - for example custom filtering information, and this callback
|
10891 |
-
* function makes it trivial to send extra information to the server. The
|
10892 |
-
* passed in parameter is the data set that has been constructed by
|
10893 |
-
* WFDataTables, and you can add to this or modify it as you require.
|
10894 |
-
* @type function
|
10895 |
-
* @param {array} data Data array (array of objects which are name/value
|
10896 |
-
* pairs) that has been constructed by WFDataTables and will be sent to the
|
10897 |
-
* server. In the case of Ajax sourced data with server-side processing
|
10898 |
-
* this will be an empty array, for server-side processing there will be a
|
10899 |
-
* significant number of parameters!
|
10900 |
-
* @returns {undefined} Ensure that you modify the data array passed in,
|
10901 |
-
* as this is passed by reference.
|
10902 |
-
*
|
10903 |
-
* @dtopt Callbacks
|
10904 |
-
* @dtopt Server-side
|
10905 |
-
* @name WFDataTable.defaults.serverParams
|
10906 |
-
*
|
10907 |
-
* @deprecated 1.10. Please use `ajax` for this functionality now.
|
10908 |
-
*/
|
10909 |
-
"fnServerParams": null,
|
10910 |
-
|
10911 |
-
|
10912 |
-
/**
|
10913 |
-
* Load the table state. With this function you can define from where, and how, the
|
10914 |
-
* state of a table is loaded. By default WFDataTables will load from `localStorage`
|
10915 |
-
* but you might wish to use a server-side database or cookies.
|
10916 |
-
* @type function
|
10917 |
-
* @member
|
10918 |
-
* @param {object} settings WFDataTables settings object
|
10919 |
-
* @param {object} callback Callback that can be executed when done. It
|
10920 |
-
* should be passed the loaded state object.
|
10921 |
-
* @return {object} The WFDataTables state object to be loaded
|
10922 |
-
*
|
10923 |
-
* @dtopt Callbacks
|
10924 |
-
* @name WFDataTable.defaults.stateLoadCallback
|
10925 |
-
*
|
10926 |
-
* @example
|
10927 |
-
* $(document).ready( function() {
|
10928 |
-
* $('#example').wfDataTable( {
|
10929 |
-
* "stateSave": true,
|
10930 |
-
* "stateLoadCallback": function (settings, callback) {
|
10931 |
-
* $.ajax( {
|
10932 |
-
* "url": "/state_load",
|
10933 |
-
* "dataType": "json",
|
10934 |
-
* "success": function (json) {
|
10935 |
-
* callback( json );
|
10936 |
-
* }
|
10937 |
-
* } );
|
10938 |
-
* }
|
10939 |
-
* } );
|
10940 |
-
* } );
|
10941 |
-
*/
|
10942 |
-
"fnStateLoadCallback": function ( settings ) {
|
10943 |
-
try {
|
10944 |
-
return JSON.parse(
|
10945 |
-
(settings.iStateDuration === -1 ? sessionStorage : localStorage).getItem(
|
10946 |
-
'WFDataTables_'+settings.sInstance+'_'+location.pathname
|
10947 |
-
)
|
10948 |
-
);
|
10949 |
-
} catch (e) {}
|
10950 |
-
},
|
10951 |
-
|
10952 |
-
|
10953 |
-
/**
|
10954 |
-
* Callback which allows modification of the saved state prior to loading that state.
|
10955 |
-
* This callback is called when the table is loading state from the stored data, but
|
10956 |
-
* prior to the settings object being modified by the saved state. Note that for
|
10957 |
-
* plug-in authors, you should use the `stateLoadParams` event to load parameters for
|
10958 |
-
* a plug-in.
|
10959 |
-
* @type function
|
10960 |
-
* @param {object} settings WFDataTables settings object
|
10961 |
-
* @param {object} data The state object that is to be loaded
|
10962 |
-
*
|
10963 |
-
* @dtopt Callbacks
|
10964 |
-
* @name WFDataTable.defaults.stateLoadParams
|
10965 |
-
*
|
10966 |
-
* @example
|
10967 |
-
* // Remove a saved filter, so filtering is never loaded
|
10968 |
-
* $(document).ready( function() {
|
10969 |
-
* $('#example').wfDataTable( {
|
10970 |
-
* "stateSave": true,
|
10971 |
-
* "stateLoadParams": function (settings, data) {
|
10972 |
-
* data.oSearch.sSearch = "";
|
10973 |
-
* }
|
10974 |
-
* } );
|
10975 |
-
* } );
|
10976 |
-
*
|
10977 |
-
* @example
|
10978 |
-
* // Disallow state loading by returning false
|
10979 |
-
* $(document).ready( function() {
|
10980 |
-
* $('#example').wfDataTable( {
|
10981 |
-
* "stateSave": true,
|
10982 |
-
* "stateLoadParams": function (settings, data) {
|
10983 |
-
* return false;
|
10984 |
-
* }
|
10985 |
-
* } );
|
10986 |
-
* } );
|
10987 |
-
*/
|
10988 |
-
"fnStateLoadParams": null,
|
10989 |
-
|
10990 |
-
|
10991 |
-
/**
|
10992 |
-
* Callback that is called when the state has been loaded from the state saving method
|
10993 |
-
* and the WFDataTables settings object has been modified as a result of the loaded state.
|
10994 |
-
* @type function
|
10995 |
-
* @param {object} settings WFDataTables settings object
|
10996 |
-
* @param {object} data The state object that was loaded
|
10997 |
-
*
|
10998 |
-
* @dtopt Callbacks
|
10999 |
-
* @name WFDataTable.defaults.stateLoaded
|
11000 |
-
*
|
11001 |
-
* @example
|
11002 |
-
* // Show an alert with the filtering value that was saved
|
11003 |
-
* $(document).ready( function() {
|
11004 |
-
* $('#example').wfDataTable( {
|
11005 |
-
* "stateSave": true,
|
11006 |
-
* "stateLoaded": function (settings, data) {
|
11007 |
-
* alert( 'Saved filter was: '+data.oSearch.sSearch );
|
11008 |
-
* }
|
11009 |
-
* } );
|
11010 |
-
* } );
|
11011 |
-
*/
|
11012 |
-
"fnStateLoaded": null,
|
11013 |
-
|
11014 |
-
|
11015 |
-
/**
|
11016 |
-
* Save the table state. This function allows you to define where and how the state
|
11017 |
-
* information for the table is stored By default WFDataTables will use `localStorage`
|
11018 |
-
* but you might wish to use a server-side database or cookies.
|
11019 |
-
* @type function
|
11020 |
-
* @member
|
11021 |
-
* @param {object} settings WFDataTables settings object
|
11022 |
-
* @param {object} data The state object to be saved
|
11023 |
-
*
|
11024 |
-
* @dtopt Callbacks
|
11025 |
-
* @name WFDataTable.defaults.stateSaveCallback
|
11026 |
-
*
|
11027 |
-
* @example
|
11028 |
-
* $(document).ready( function() {
|
11029 |
-
* $('#example').wfDataTable( {
|
11030 |
-
* "stateSave": true,
|
11031 |
-
* "stateSaveCallback": function (settings, data) {
|
11032 |
-
* // Send an Ajax request to the server with the state object
|
11033 |
-
* $.ajax( {
|
11034 |
-
* "url": "/state_save",
|
11035 |
-
* "data": data,
|
11036 |
-
* "dataType": "json",
|
11037 |
-
* "method": "POST"
|
11038 |
-
* "success": function () {}
|
11039 |
-
* } );
|
11040 |
-
* }
|
11041 |
-
* } );
|
11042 |
-
* } );
|
11043 |
-
*/
|
11044 |
-
"fnStateSaveCallback": function ( settings, data ) {
|
11045 |
-
try {
|
11046 |
-
(settings.iStateDuration === -1 ? sessionStorage : localStorage).setItem(
|
11047 |
-
'WFDataTables_'+settings.sInstance+'_'+location.pathname,
|
11048 |
-
JSON.stringify( data )
|
11049 |
-
);
|
11050 |
-
} catch (e) {}
|
11051 |
-
},
|
11052 |
-
|
11053 |
-
|
11054 |
-
/**
|
11055 |
-
* Callback which allows modification of the state to be saved. Called when the table
|
11056 |
-
* has changed state a new state save is required. This method allows modification of
|
11057 |
-
* the state saving object prior to actually doing the save, including addition or
|
11058 |
-
* other state properties or modification. Note that for plug-in authors, you should
|
11059 |
-
* use the `stateSaveParams` event to save parameters for a plug-in.
|
11060 |
-
* @type function
|
11061 |
-
* @param {object} settings WFDataTables settings object
|
11062 |
-
* @param {object} data The state object to be saved
|
11063 |
-
*
|
11064 |
-
* @dtopt Callbacks
|
11065 |
-
* @name WFDataTable.defaults.stateSaveParams
|
11066 |
-
*
|
11067 |
-
* @example
|
11068 |
-
* // Remove a saved filter, so filtering is never saved
|
11069 |
-
* $(document).ready( function() {
|
11070 |
-
* $('#example').wfDataTable( {
|
11071 |
-
* "stateSave": true,
|
11072 |
-
* "stateSaveParams": function (settings, data) {
|
11073 |
-
* data.oSearch.sSearch = "";
|
11074 |
-
* }
|
11075 |
-
* } );
|
11076 |
-
* } );
|
11077 |
-
*/
|
11078 |
-
"fnStateSaveParams": null,
|
11079 |
-
|
11080 |
-
|
11081 |
-
/**
|
11082 |
-
* Duration for which the saved state information is considered valid. After this period
|
11083 |
-
* has elapsed the state will be returned to the default.
|
11084 |
-
* Value is given in seconds.
|
11085 |
-
* @type int
|
11086 |
-
* @default 7200 <i>(2 hours)</i>
|
11087 |
-
*
|
11088 |
-
* @dtopt Options
|
11089 |
-
* @name WFDataTable.defaults.stateDuration
|
11090 |
-
*
|
11091 |
-
* @example
|
11092 |
-
* $(document).ready( function() {
|
11093 |
-
* $('#example').wfDataTable( {
|
11094 |
-
* "stateDuration": 60*60*24; // 1 day
|
11095 |
-
* } );
|
11096 |
-
* } )
|
11097 |
-
*/
|
11098 |
-
"iStateDuration": 7200,
|
11099 |
-
|
11100 |
-
|
11101 |
-
/**
|
11102 |
-
* When enabled WFDataTables will not make a request to the server for the first
|
11103 |
-
* page draw - rather it will use the data already on the page (no sorting etc
|
11104 |
-
* will be applied to it), thus saving on an XHR at load time. `deferLoading`
|
11105 |
-
* is used to indicate that deferred loading is required, but it is also used
|
11106 |
-
* to tell WFDataTables how many records there are in the full table (allowing
|
11107 |
-
* the information element and pagination to be displayed correctly). In the case
|
11108 |
-
* where a filtering is applied to the table on initial load, this can be
|
11109 |
-
* indicated by giving the parameter as an array, where the first element is
|
11110 |
-
* the number of records available after filtering and the second element is the
|
11111 |
-
* number of records without filtering (allowing the table information element
|
11112 |
-
* to be shown correctly).
|
11113 |
-
* @type int | array
|
11114 |
-
* @default null
|
11115 |
-
*
|
11116 |
-
* @dtopt Options
|
11117 |
-
* @name WFDataTable.defaults.deferLoading
|
11118 |
-
*
|
11119 |
-
* @example
|
11120 |
-
* // 57 records available in the table, no filtering applied
|
11121 |
-
* $(document).ready( function() {
|
11122 |
-
* $('#example').wfDataTable( {
|
11123 |
-
* "serverSide": true,
|
11124 |
-
* "ajax": "scripts/server_processing.php",
|
11125 |
-
* "deferLoading": 57
|
11126 |
-
* } );
|
11127 |
-
* } );
|
11128 |
-
*
|
11129 |
-
* @example
|
11130 |
-
* // 57 records after filtering, 100 without filtering (an initial filter applied)
|
11131 |
-
* $(document).ready( function() {
|
11132 |
-
* $('#example').wfDataTable( {
|
11133 |
-
* "serverSide": true,
|
11134 |
-
* "ajax": "scripts/server_processing.php",
|
11135 |
-
* "deferLoading": [ 57, 100 ],
|
11136 |
-
* "search": {
|
11137 |
-
* "search": "my_filter"
|
11138 |
-
* }
|
11139 |
-
* } );
|
11140 |
-
* } );
|
11141 |
-
*/
|
11142 |
-
"iDeferLoading": null,
|
11143 |
-
|
11144 |
-
|
11145 |
-
/**
|
11146 |
-
* Number of rows to display on a single page when using pagination. If
|
11147 |
-
* feature enabled (`lengthChange`) then the end user will be able to override
|
11148 |
-
* this to a custom setting using a pop-up menu.
|
11149 |
-
* @type int
|
11150 |
-
* @default 10
|
11151 |
-
*
|
11152 |
-
* @dtopt Options
|
11153 |
-
* @name WFDataTable.defaults.pageLength
|
11154 |
-
*
|
11155 |
-
* @example
|
11156 |
-
* $(document).ready( function() {
|
11157 |
-
* $('#example').wfDataTable( {
|
11158 |
-
* "pageLength": 50
|
11159 |
-
* } );
|
11160 |
-
* } )
|
11161 |
-
*/
|
11162 |
-
"iDisplayLength": 10,
|
11163 |
-
|
11164 |
-
|
11165 |
-
/**
|
11166 |
-
* Define the starting point for data display when using WFDataTables with
|
11167 |
-
* pagination. Note that this parameter is the number of records, rather than
|
11168 |
-
* the page number, so if you have 10 records per page and want to start on
|
11169 |
-
* the third page, it should be "20".
|
11170 |
-
* @type int
|
11171 |
-
* @default 0
|
11172 |
-
*
|
11173 |
-
* @dtopt Options
|
11174 |
-
* @name WFDataTable.defaults.displayStart
|
11175 |
-
*
|
11176 |
-
* @example
|
11177 |
-
* $(document).ready( function() {
|
11178 |
-
* $('#example').wfDataTable( {
|
11179 |
-
* "displayStart": 20
|
11180 |
-
* } );
|
11181 |
-
* } )
|
11182 |
-
*/
|
11183 |
-
"iDisplayStart": 0,
|
11184 |
-
|
11185 |
-
|
11186 |
-
/**
|
11187 |
-
* By default WFDataTables allows keyboard navigation of the table (sorting, paging,
|
11188 |
-
* and filtering) by adding a `tabindex` attribute to the required elements. This
|
11189 |
-
* allows you to tab through the controls and press the enter key to activate them.
|
11190 |
-
* The tabindex is default 0, meaning that the tab follows the flow of the document.
|
11191 |
-
* You can overrule this using this parameter if you wish. Use a value of -1 to
|
11192 |
-
* disable built-in keyboard navigation.
|
11193 |
-
* @type int
|
11194 |
-
* @default 0
|
11195 |
-
*
|
11196 |
-
* @dtopt Options
|
11197 |
-
* @name WFDataTable.defaults.tabIndex
|
11198 |
-
*
|
11199 |
-
* @example
|
11200 |
-
* $(document).ready( function() {
|
11201 |
-
* $('#example').wfDataTable( {
|
11202 |
-
* "tabIndex": 1
|
11203 |
-
* } );
|
11204 |
-
* } );
|
11205 |
-
*/
|
11206 |
-
"iTabIndex": 0,
|
11207 |
-
|
11208 |
-
|
11209 |
-
/**
|
11210 |
-
* Classes that WFDataTables assigns to the various components and features
|
11211 |
-
* that it adds to the HTML table. This allows classes to be configured
|
11212 |
-
* during initialisation in addition to through the static
|
11213 |
-
* {@link WFDataTable.ext.oStdClasses} object).
|
11214 |
-
* @namespace
|
11215 |
-
* @name WFDataTable.defaults.classes
|
11216 |
-
*/
|
11217 |
-
"oClasses": {},
|
11218 |
-
|
11219 |
-
|
11220 |
-
/**
|
11221 |
-
* All strings that WFDataTables uses in the user interface that it creates
|
11222 |
-
* are defined in this object, allowing you to modified them individually or
|
11223 |
-
* completely replace them all as required.
|
11224 |
-
* @namespace
|
11225 |
-
* @name WFDataTable.defaults.language
|
11226 |
-
*/
|
11227 |
-
"oLanguage": {
|
11228 |
-
/**
|
11229 |
-
* Strings that are used for WAI-ARIA labels and controls only (these are not
|
11230 |
-
* actually visible on the page, but will be read by screenreaders, and thus
|
11231 |
-
* must be internationalised as well).
|
11232 |
-
* @namespace
|
11233 |
-
* @name WFDataTable.defaults.language.aria
|
11234 |
-
*/
|
11235 |
-
"oAria": {
|
11236 |
-
/**
|
11237 |
-
* ARIA label that is added to the table headers when the column may be
|
11238 |
-
* sorted ascending by activing the column (click or return when focused).
|
11239 |
-
* Note that the column header is prefixed to this string.
|
11240 |
-
* @type string
|
11241 |
-
* @default : activate to sort column ascending
|
11242 |
-
*
|
11243 |
-
* @dtopt Language
|
11244 |
-
* @name WFDataTable.defaults.language.aria.sortAscending
|
11245 |
-
*
|
11246 |
-
* @example
|
11247 |
-
* $(document).ready( function() {
|
11248 |
-
* $('#example').wfDataTable( {
|
11249 |
-
* "language": {
|
11250 |
-
* "aria": {
|
11251 |
-
* "sortAscending": " - click/return to sort ascending"
|
11252 |
-
* }
|
11253 |
-
* }
|
11254 |
-
* } );
|
11255 |
-
* } );
|
11256 |
-
*/
|
11257 |
-
"sSortAscending": ": activate to sort column ascending",
|
11258 |
-
|
11259 |
-
/**
|
11260 |
-
* ARIA label that is added to the table headers when the column may be
|
11261 |
-
* sorted descending by activing the column (click or return when focused).
|
11262 |
-
* Note that the column header is prefixed to this string.
|
11263 |
-
* @type string
|
11264 |
-
* @default : activate to sort column ascending
|
11265 |
-
*
|
11266 |
-
* @dtopt Language
|
11267 |
-
* @name WFDataTable.defaults.language.aria.sortDescending
|
11268 |
-
*
|
11269 |
-
* @example
|
11270 |
-
* $(document).ready( function() {
|
11271 |
-
* $('#example').wfDataTable( {
|
11272 |
-
* "language": {
|
11273 |
-
* "aria": {
|
11274 |
-
* "sortDescending": " - click/return to sort descending"
|
11275 |
-
* }
|
11276 |
-
* }
|
11277 |
-
* } );
|
11278 |
-
* } );
|
11279 |
-
*/
|
11280 |
-
"sSortDescending": ": activate to sort column descending"
|
11281 |
-
},
|
11282 |
-
|
11283 |
-
/**
|
11284 |
-
* Pagination string used by WFDataTables for the built-in pagination
|
11285 |
-
* control types.
|
11286 |
-
* @namespace
|
11287 |
-
* @name WFDataTable.defaults.language.paginate
|
11288 |
-
*/
|
11289 |
-
"oPaginate": {
|
11290 |
-
/**
|
11291 |
-
* Text to use when using the 'full_numbers' type of pagination for the
|
11292 |
-
* button to take the user to the first page.
|
11293 |
-
* @type string
|
11294 |
-
* @default First
|
11295 |
-
*
|
11296 |
-
* @dtopt Language
|
11297 |
-
* @name WFDataTable.defaults.language.paginate.first
|
11298 |
-
*
|
11299 |
-
* @example
|
11300 |
-
* $(document).ready( function() {
|
11301 |
-
* $('#example').wfDataTable( {
|
11302 |
-
* "language": {
|
11303 |
-
* "paginate": {
|
11304 |
-
* "first": "First page"
|
11305 |
-
* }
|
11306 |
-
* }
|
11307 |
-
* } );
|
11308 |
-
* } );
|
11309 |
-
*/
|
11310 |
-
"sFirst": "First",
|
11311 |
-
|
11312 |
-
|
11313 |
-
/**
|
11314 |
-
* Text to use when using the 'full_numbers' type of pagination for the
|
11315 |
-
* button to take the user to the last page.
|
11316 |
-
* @type string
|
11317 |
-
* @default Last
|
11318 |
-
*
|
11319 |
-
* @dtopt Language
|
11320 |
-
* @name WFDataTable.defaults.language.paginate.last
|
11321 |
-
*
|
11322 |
-
* @example
|
11323 |
-
* $(document).ready( function() {
|
11324 |
-
* $('#example').wfDataTable( {
|
11325 |
-
* "language": {
|
11326 |
-
* "paginate": {
|
11327 |
-
* "last": "Last page"
|
11328 |
-
* }
|
11329 |
-
* }
|
11330 |
-
* } );
|
11331 |
-
* } );
|
11332 |
-
*/
|
11333 |
-
"sLast": "Last",
|
11334 |
-
|
11335 |
-
|
11336 |
-
/**
|
11337 |
-
* Text to use for the 'next' pagination button (to take the user to the
|
11338 |
-
* next page).
|
11339 |
-
* @type string
|
11340 |
-
* @default Next
|
11341 |
-
*
|
11342 |
-
* @dtopt Language
|
11343 |
-
* @name WFDataTable.defaults.language.paginate.next
|
11344 |
-
*
|
11345 |
-
* @example
|
11346 |
-
* $(document).ready( function() {
|
11347 |
-
* $('#example').wfDataTable( {
|
11348 |
-
* "language": {
|
11349 |
-
* "paginate": {
|
11350 |
-
* "next": "Next page"
|
11351 |
-
* }
|
11352 |
-
* }
|
11353 |
-
* } );
|
11354 |
-
* } );
|
11355 |
-
*/
|
11356 |
-
"sNext": "Next",
|
11357 |
-
|
11358 |
-
|
11359 |
-
/**
|
11360 |
-
* Text to use for the 'previous' pagination button (to take the user to
|
11361 |
-
* the previous page).
|
11362 |
-
* @type string
|
11363 |
-
* @default Previous
|
11364 |
-
*
|
11365 |
-
* @dtopt Language
|
11366 |
-
* @name WFDataTable.defaults.language.paginate.previous
|
11367 |
-
*
|
11368 |
-
* @example
|
11369 |
-
* $(document).ready( function() {
|
11370 |
-
* $('#example').wfDataTable( {
|
11371 |
-
* "language": {
|
11372 |
-
* "paginate": {
|
11373 |
-
* "previous": "Previous page"
|
11374 |
-
* }
|
11375 |
-
* }
|
11376 |
-
* } );
|
11377 |
-
* } );
|
11378 |
-
*/
|
11379 |
-
"sPrevious": "Previous"
|
11380 |
-
},
|
11381 |
-
|
11382 |
-
/**
|
11383 |
-
* This string is shown in preference to `zeroRecords` when the table is
|
11384 |
-
* empty of data (regardless of filtering). Note that this is an optional
|
11385 |
-
* parameter - if it is not given, the value of `zeroRecords` will be used
|
11386 |
-
* instead (either the default or given value).
|
11387 |
-
* @type string
|
11388 |
-
* @default No data available in table
|
11389 |
-
*
|
11390 |
-
* @dtopt Language
|
11391 |
-
* @name WFDataTable.defaults.language.emptyTable
|
11392 |
-
*
|
11393 |
-
* @example
|
11394 |
-
* $(document).ready( function() {
|
11395 |
-
* $('#example').wfDataTable( {
|
11396 |
-
* "language": {
|
11397 |
-
* "emptyTable": "No data available in table"
|
11398 |
-
* }
|
11399 |
-
* } );
|
11400 |
-
* } );
|
11401 |
-
*/
|
11402 |
-
"sEmptyTable": "No data available in table",
|
11403 |
-
|
11404 |
-
|
11405 |
-
/**
|
11406 |
-
* This string gives information to the end user about the information
|
11407 |
-
* that is current on display on the page. The following tokens can be
|
11408 |
-
* used in the string and will be dynamically replaced as the table
|
11409 |
-
* display updates. This tokens can be placed anywhere in the string, or
|
11410 |
-
* removed as needed by the language requires:
|
11411 |
-
*
|
11412 |
-
* * `\_START\_` - Display index of the first record on the current page
|
11413 |
-
* * `\_END\_` - Display index of the last record on the current page
|
11414 |
-
* * `\_TOTAL\_` - Number of records in the table after filtering
|
11415 |
-
* * `\_MAX\_` - Number of records in the table without filtering
|
11416 |
-
* * `\_PAGE\_` - Current page number
|
11417 |
-
* * `\_PAGES\_` - Total number of pages of data in the table
|
11418 |
-
*
|
11419 |
-
* @type string
|
11420 |
-
* @default Showing _START_ to _END_ of _TOTAL_ entries
|
11421 |
-
*
|
11422 |
-
* @dtopt Language
|
11423 |
-
* @name WFDataTable.defaults.language.info
|
11424 |
-
*
|
11425 |
-
* @example
|
11426 |
-
* $(document).ready( function() {
|
11427 |
-
* $('#example').wfDataTable( {
|
11428 |
-
* "language": {
|
11429 |
-
* "info": "Showing page _PAGE_ of _PAGES_"
|
11430 |
-
* }
|
11431 |
-
* } );
|
11432 |
-
* } );
|
11433 |
-
*/
|
11434 |
-
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
|
11435 |
-
|
11436 |
-
|
11437 |
-
/**
|
11438 |
-
* Display information string for when the table is empty. Typically the
|
11439 |
-
* format of this string should match `info`.
|
11440 |
-
* @type string
|
11441 |
-
* @default Showing 0 to 0 of 0 entries
|
11442 |
-
*
|
11443 |
-
* @dtopt Language
|
11444 |
-
* @name WFDataTable.defaults.language.infoEmpty
|
11445 |
-
*
|
11446 |
-
* @example
|
11447 |
-
* $(document).ready( function() {
|
11448 |
-
* $('#example').wfDataTable( {
|
11449 |
-
* "language": {
|
11450 |
-
* "infoEmpty": "No entries to show"
|
11451 |
-
* }
|
11452 |
-
* } );
|
11453 |
-
* } );
|
11454 |
-
*/
|
11455 |
-
"sInfoEmpty": "Showing 0 to 0 of 0 entries",
|
11456 |
-
|
11457 |
-
|
11458 |
-
/**
|
11459 |
-
* When a user filters the information in a table, this string is appended
|
11460 |
-
* to the information (`info`) to give an idea of how strong the filtering
|
11461 |
-
* is. The variable _MAX_ is dynamically updated.
|
11462 |
-
* @type string
|
11463 |
-
* @default (filtered from _MAX_ total entries)
|
11464 |
-
*
|
11465 |
-
* @dtopt Language
|
11466 |
-
* @name WFDataTable.defaults.language.infoFiltered
|
11467 |
-
*
|
11468 |
-
* @example
|
11469 |
-
* $(document).ready( function() {
|
11470 |
-
* $('#example').wfDataTable( {
|
11471 |
-
* "language": {
|
11472 |
-
* "infoFiltered": " - filtering from _MAX_ records"
|
11473 |
-
* }
|
11474 |
-
* } );
|
11475 |
-
* } );
|
11476 |
-
*/
|
11477 |
-
"sInfoFiltered": "(filtered from _MAX_ total entries)",
|
11478 |
-
|
11479 |
-
|
11480 |
-
/**
|
11481 |
-
* If can be useful to append extra information to the info string at times,
|
11482 |
-
* and this variable does exactly that. This information will be appended to
|
11483 |
-
* the `info` (`infoEmpty` and `infoFiltered` in whatever combination they are
|
11484 |
-
* being used) at all times.
|
11485 |
-
* @type string
|
11486 |
-
* @default <i>Empty string</i>
|
11487 |
-
*
|
11488 |
-
* @dtopt Language
|
11489 |
-
* @name WFDataTable.defaults.language.infoPostFix
|
11490 |
-
*
|
11491 |
-
* @example
|
11492 |
-
* $(document).ready( function() {
|
11493 |
-
* $('#example').wfDataTable( {
|
11494 |
-
* "language": {
|
11495 |
-
* "infoPostFix": "All records shown are derived from real information."
|
11496 |
-
* }
|
11497 |
-
* } );
|
11498 |
-
* } );
|
11499 |
-
*/
|
11500 |
-
"sInfoPostFix": "",
|
11501 |
-
|
11502 |
-
|
11503 |
-
/**
|
11504 |
-
* This decimal place operator is a little different from the other
|
11505 |
-
* language options since WFDataTables doesn't output floating point
|
11506 |
-
* numbers, so it won't ever use this for display of a number. Rather,
|
11507 |
-
* what this parameter does is modify the sort methods of the table so
|
11508 |
-
* that numbers which are in a format which has a character other than
|
11509 |
-
* a period (`.`) as a decimal place will be sorted numerically.
|
11510 |
-
*
|
11511 |
-
* Note that numbers with different decimal places cannot be shown in
|
11512 |
-
* the same table and still be sortable, the table must be consistent.
|
11513 |
-
* However, multiple different tables on the page can use different
|
11514 |
-
* decimal place characters.
|
11515 |
-
* @type string
|
11516 |
-
* @default
|
11517 |
-
*
|
11518 |
-
* @dtopt Language
|
11519 |
-
* @name WFDataTable.defaults.language.decimal
|
11520 |
-
*
|
11521 |
-
* @example
|
11522 |
-
* $(document).ready( function() {
|
11523 |
-
* $('#example').wfDataTable( {
|
11524 |
-
* "language": {
|
11525 |
-
* "decimal": ","
|
11526 |
-
* "thousands": "."
|
11527 |
-
* }
|
11528 |
-
* } );
|
11529 |
-
* } );
|
11530 |
-
*/
|
11531 |
-
"sDecimal": "",
|
11532 |
-
|
11533 |
-
|
11534 |
-
/**
|
11535 |
-
* WFDataTables has a build in number formatter (`formatNumber`) which is
|
11536 |
-
* used to format large numbers that are used in the table information.
|
11537 |
-
* By default a comma is used, but this can be trivially changed to any
|
11538 |
-
* character you wish with this parameter.
|
11539 |
-
* @type string
|
11540 |
-
* @default ,
|
11541 |
-
*
|
11542 |
-
* @dtopt Language
|
11543 |
-
* @name WFDataTable.defaults.language.thousands
|
11544 |
-
*
|
11545 |
-
* @example
|
11546 |
-
* $(document).ready( function() {
|
11547 |
-
* $('#example').wfDataTable( {
|
11548 |
-
* "language": {
|
11549 |
-
* "thousands": "'"
|
11550 |
-
* }
|
11551 |
-
* } );
|
11552 |
-
* } );
|
11553 |
-
*/
|
11554 |
-
"sThousands": ",",
|
11555 |
-
|
11556 |
-
|
11557 |
-
/**
|
11558 |
-
* Detail the action that will be taken when the drop down menu for the
|
11559 |
-
* pagination length option is changed. The '_MENU_' variable is replaced
|
11560 |
-
* with a default select list of 10, 25, 50 and 100, and can be replaced
|
11561 |
-
* with a custom select box if required.
|
11562 |
-
* @type string
|
11563 |
-
* @default Show _MENU_ entries
|
11564 |
-
*
|
11565 |
-
* @dtopt Language
|
11566 |
-
* @name WFDataTable.defaults.language.lengthMenu
|
11567 |
-
*
|
11568 |
-
* @example
|
11569 |
-
* // Language change only
|
11570 |
-
* $(document).ready( function() {
|
11571 |
-
* $('#example').wfDataTable( {
|
11572 |
-
* "language": {
|
11573 |
-
* "lengthMenu": "Display _MENU_ records"
|
11574 |
-
* }
|
11575 |
-
* } );
|
11576 |
-
* } );
|
11577 |
-
*
|
11578 |
-
* @example
|
11579 |
-
* // Language and options change
|
11580 |
-
* $(document).ready( function() {
|
11581 |
-
* $('#example').wfDataTable( {
|
11582 |
-
* "language": {
|
11583 |
-
* "lengthMenu": 'Display <select>'+
|
11584 |
-
* '<option value="10">10</option>'+
|
11585 |
-
* '<option value="20">20</option>'+
|
11586 |
-
* '<option value="30">30</option>'+
|
11587 |
-
* '<option value="40">40</option>'+
|
11588 |
-
* '<option value="50">50</option>'+
|
11589 |
-
* '<option value="-1">All</option>'+
|
11590 |
-
* '</select> records'
|
11591 |
-
* }
|
11592 |
-
* } );
|
11593 |
-
* } );
|
11594 |
-
*/
|
11595 |
-
"sLengthMenu": "Show _MENU_ entries",
|
11596 |
-
|
11597 |
-
|
11598 |
-
/**
|
11599 |
-
* When using Ajax sourced data and during the first draw when WFDataTables is
|
11600 |
-
* gathering the data, this message is shown in an empty row in the table to
|
11601 |
-
* indicate to the end user the the data is being loaded. Note that this
|
11602 |
-
* parameter is not used when loading data by server-side processing, just
|
11603 |
-
* Ajax sourced data with client-side processing.
|
11604 |
-
* @type string
|
11605 |
-
* @default Loading...
|
11606 |
-
*
|
11607 |
-
* @dtopt Language
|
11608 |
-
* @name WFDataTable.defaults.language.loadingRecords
|
11609 |
-
*
|
11610 |
-
* @example
|
11611 |
-
* $(document).ready( function() {
|
11612 |
-
* $('#example').wfDataTable( {
|
11613 |
-
* "language": {
|
11614 |
-
* "loadingRecords": "Please wait - loading..."
|
11615 |
-
* }
|
11616 |
-
* } );
|
11617 |
-
* } );
|
11618 |
-
*/
|
11619 |
-
"sLoadingRecords": "Loading...",
|
11620 |
-
|
11621 |
-
|
11622 |
-
/**
|
11623 |
-
* Text which is displayed when the table is processing a user action
|
11624 |
-
* (usually a sort command or similar).
|
11625 |
-
* @type string
|
11626 |
-
* @default Processing...
|
11627 |
-
*
|
11628 |
-
* @dtopt Language
|
11629 |
-
* @name WFDataTable.defaults.language.processing
|
11630 |
-
*
|
11631 |
-
* @example
|
11632 |
-
* $(document).ready( function() {
|
11633 |
-
* $('#example').wfDataTable( {
|
11634 |
-
* "language": {
|
11635 |
-
* "processing": "WFDataTables is currently busy"
|
11636 |
-
* }
|
11637 |
-
* } );
|
11638 |
-
* } );
|
11639 |
-
*/
|
11640 |
-
"sProcessing": "Processing...",
|
11641 |
-
|
11642 |
-
|
11643 |
-
/**
|
11644 |
-
* Details the actions that will be taken when the user types into the
|
11645 |
-
* filtering input text box. The variable "_INPUT_", if used in the string,
|
11646 |
-
* is replaced with the HTML text box for the filtering input allowing
|
11647 |
-
* control over where it appears in the string. If "_INPUT_" is not given
|
11648 |
-
* then the input box is appended to the string automatically.
|
11649 |
-
* @type string
|
11650 |
-
* @default Search:
|
11651 |
-
*
|
11652 |
-
* @dtopt Language
|
11653 |
-
* @name WFDataTable.defaults.language.search
|
11654 |
-
*
|
11655 |
-
* @example
|
11656 |
-
* // Input text box will be appended at the end automatically
|
11657 |
-
* $(document).ready( function() {
|
11658 |
-
* $('#example').wfDataTable( {
|
11659 |
-
* "language": {
|
11660 |
-
* "search": "Filter records:"
|
11661 |
-
* }
|
11662 |
-
* } );
|
11663 |
-
* } );
|
11664 |
-
*
|
11665 |
-
* @example
|
11666 |
-
* // Specify where the filter should appear
|
11667 |
-
* $(document).ready( function() {
|
11668 |
-
* $('#example').wfDataTable( {
|
11669 |
-
* "language": {
|
11670 |
-
* "search": "Apply filter _INPUT_ to table"
|
11671 |
-
* }
|
11672 |
-
* } );
|
11673 |
-
* } );
|
11674 |
-
*/
|
11675 |
-
"sSearch": "Search:",
|
11676 |
-
|
11677 |
-
|
11678 |
-
/**
|
11679 |
-
* Assign a `placeholder` attribute to the search `input` element
|
11680 |
-
* @type string
|
11681 |
-
* @default
|
11682 |
-
*
|
11683 |
-
* @dtopt Language
|
11684 |
-
* @name WFDataTable.defaults.language.searchPlaceholder
|
11685 |
-
*/
|
11686 |
-
"sSearchPlaceholder": "",
|
11687 |
-
|
11688 |
-
|
11689 |
-
/**
|
11690 |
-
* All of the language information can be stored in a file on the
|
11691 |
-
* server-side, which WFDataTables will look up if this parameter is passed.
|
11692 |
-
* It must store the URL of the language file, which is in a JSON format,
|
11693 |
-
* and the object has the same properties as the oLanguage object in the
|
11694 |
-
* initialiser object (i.e. the above parameters). Please refer to one of
|
11695 |
-
* the example language files to see how this works in action.
|
11696 |
-
* @type string
|
11697 |
-
* @default <i>Empty string - i.e. disabled</i>
|
11698 |
-
*
|
11699 |
-
* @dtopt Language
|
11700 |
-
* @name WFDataTable.defaults.language.url
|
11701 |
-
*
|
11702 |
-
* @example
|
11703 |
-
* $(document).ready( function() {
|
11704 |
-
* $('#example').wfDataTable( {
|
11705 |
-
* "language": {
|
11706 |
-
* "url": "http://www.sprymedia.co.uk/dataTables/lang.txt"
|
11707 |
-
* }
|
11708 |
-
* } );
|
11709 |
-
* } );
|
11710 |
-
*/
|
11711 |
-
"sUrl": "",
|
11712 |
-
|
11713 |
-
|
11714 |
-
/**
|
11715 |
-
* Text shown inside the table records when the is no information to be
|
11716 |
-
* displayed after filtering. `emptyTable` is shown when there is simply no
|
11717 |
-
* information in the table at all (regardless of filtering).
|
11718 |
-
* @type string
|
11719 |
-
* @default No matching records found
|
11720 |
-
*
|
11721 |
-
* @dtopt Language
|
11722 |
-
* @name WFDataTable.defaults.language.zeroRecords
|
11723 |
-
*
|
11724 |
-
* @example
|
11725 |
-
* $(document).ready( function() {
|
11726 |
-
* $('#example').wfDataTable( {
|
11727 |
-
* "language": {
|
11728 |
-
* "zeroRecords": "No records to display"
|
11729 |
-
* }
|
11730 |
-
* } );
|
11731 |
-
* } );
|
11732 |
-
*/
|
11733 |
-
"sZeroRecords": "No matching records found"
|
11734 |
-
},
|
11735 |
-
|
11736 |
-
|
11737 |
-
/**
|
11738 |
-
* This parameter allows you to have define the global filtering state at
|
11739 |
-
* initialisation time. As an object the `search` parameter must be
|
11740 |
-
* defined, but all other parameters are optional. When `regex` is true,
|
11741 |
-
* the search string will be treated as a regular expression, when false
|
11742 |
-
* (default) it will be treated as a straight string. When `smart`
|
11743 |
-
* WFDataTables will use it's smart filtering methods (to word match at
|
11744 |
-
* any point in the data), when false this will not be done.
|
11745 |
-
* @namespace
|
11746 |
-
* @extends WFDataTable.models.oSearch
|
11747 |
-
*
|
11748 |
-
* @dtopt Options
|
11749 |
-
* @name WFDataTable.defaults.search
|
11750 |
-
*
|
11751 |
-
* @example
|
11752 |
-
* $(document).ready( function() {
|
11753 |
-
* $('#example').wfDataTable( {
|
11754 |
-
* "search": {"search": "Initial search"}
|
11755 |
-
* } );
|
11756 |
-
* } )
|
11757 |
-
*/
|
11758 |
-
"oSearch": $.extend( {}, WFDataTable.models.oSearch ),
|
11759 |
-
|
11760 |
-
|
11761 |
-
/**
|
11762 |
-
* __Deprecated__ The functionality provided by this parameter has now been
|
11763 |
-
* superseded by that provided through `ajax`, which should be used instead.
|
11764 |
-
*
|
11765 |
-
* By default WFDataTables will look for the property `data` (or `aaData` for
|
11766 |
-
* compatibility with WFDataTables 1.9-) when obtaining data from an Ajax
|
11767 |
-
* source or for server-side processing - this parameter allows that
|
11768 |
-
* property to be changed. You can use Javascript dotted object notation to
|
11769 |
-
* get a data source for multiple levels of nesting.
|
11770 |
-
* @type string
|
11771 |
-
* @default data
|
11772 |
-
*
|
11773 |
-
* @dtopt Options
|
11774 |
-
* @dtopt Server-side
|
11775 |
-
* @name WFDataTable.defaults.ajaxDataProp
|
11776 |
-
*
|
11777 |
-
* @deprecated 1.10. Please use `ajax` for this functionality now.
|
11778 |
-
*/
|
11779 |
-
"sAjaxDataProp": "data",
|
11780 |
-
|
11781 |
-
|
11782 |
-
/**
|
11783 |
-
* __Deprecated__ The functionality provided by this parameter has now been
|
11784 |
-
* superseded by that provided through `ajax`, which should be used instead.
|
11785 |
-
*
|
11786 |
-
* You can instruct WFDataTables to load data from an external
|
11787 |
-
* source using this parameter (use aData if you want to pass data in you
|
11788 |
-
* already have). Simply provide a url a JSON object can be obtained from.
|
11789 |
-
* @type string
|
11790 |
-
* @default null
|
11791 |
-
*
|
11792 |
-
* @dtopt Options
|
11793 |
-
* @dtopt Server-side
|
11794 |
-
* @name WFDataTable.defaults.ajaxSource
|
11795 |
-
*
|
11796 |
-
* @deprecated 1.10. Please use `ajax` for this functionality now.
|
11797 |
-
*/
|
11798 |
-
"sAjaxSource": null,
|
11799 |
-
|
11800 |
-
|
11801 |
-
/**
|
11802 |
-
* This initialisation variable allows you to specify exactly where in the
|
11803 |
-
* DOM you want WFDataTables to inject the various controls it adds to the page
|
11804 |
-
* (for example you might want the pagination controls at the top of the
|
11805 |
-
* table). DIV elements (with or without a custom class) can also be added to
|
11806 |
-
* aid styling. The follow syntax is used:
|
11807 |
-
* <ul>
|
11808 |
-
* <li>The following options are allowed:
|
11809 |
-
* <ul>
|
11810 |
-
* <li>'l' - Length changing</li>
|
11811 |
-
* <li>'f' - Filtering input</li>
|
11812 |
-
* <li>'t' - The table!</li>
|
11813 |
-
* <li>'i' - Information</li>
|
11814 |
-
* <li>'p' - Pagination</li>
|
11815 |
-
* <li>'r' - pRocessing</li>
|
11816 |
-
* </ul>
|
11817 |
-
* </li>
|
11818 |
-
* <li>The following constants are allowed:
|
11819 |
-
* <ul>
|
11820 |
-
* <li>'H' - jQueryUI theme "header" classes ('fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix')</li>
|
11821 |
-
* <li>'F' - jQueryUI theme "footer" classes ('fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix')</li>
|
11822 |
-
* </ul>
|
11823 |
-
* </li>
|
11824 |
-
* <li>The following syntax is expected:
|
11825 |
-
* <ul>
|
11826 |
-
* <li>'<' and '>' - div elements</li>
|
11827 |
-
* <li>'<"class" and '>' - div with a class</li>
|
11828 |
-
* <li>'<"#id" and '>' - div with an ID</li>
|
11829 |
-
* </ul>
|
11830 |
-
* </li>
|
11831 |
-
* <li>Examples:
|
11832 |
-
* <ul>
|
11833 |
-
* <li>'<"wrapper"flipt>'</li>
|
11834 |
-
* <li>'<lf<t>ip>'</li>
|
11835 |
-
* </ul>
|
11836 |
-
* </li>
|
11837 |
-
* </ul>
|
11838 |
-
* @type string
|
11839 |
-
* @default lfrtip <i>(when `jQueryUI` is false)</i> <b>or</b>
|
11840 |
-
* <"H"lfr>t<"F"ip> <i>(when `jQueryUI` is true)</i>
|
11841 |
-
*
|
11842 |
-
* @dtopt Options
|
11843 |
-
* @name WFDataTable.defaults.dom
|
11844 |
-
*
|
11845 |
-
* @example
|
11846 |
-
* $(document).ready( function() {
|
11847 |
-
* $('#example').wfDataTable( {
|
11848 |
-
* "dom": '<"top"i>rt<"bottom"flp><"clear">'
|
11849 |
-
* } );
|
11850 |
-
* } );
|
11851 |
-
*/
|
11852 |
-
"sDom": "lfrtip",
|
11853 |
-
|
11854 |
-
|
11855 |
-
/**
|
11856 |
-
* Search delay option. This will throttle full table searches that use the
|
11857 |
-
* WFDataTables provided search input element (it does not effect calls to
|
11858 |
-
* `dt-api search()`, providing a delay before the search is made.
|
11859 |
-
* @type integer
|
11860 |
-
* @default 0
|
11861 |
-
*
|
11862 |
-
* @dtopt Options
|
11863 |
-
* @name WFDataTable.defaults.searchDelay
|
11864 |
-
*
|
11865 |
-
* @example
|
11866 |
-
* $(document).ready( function() {
|
11867 |
-
* $('#example').wfDataTable( {
|
11868 |
-
* "searchDelay": 200
|
11869 |
-
* } );
|
11870 |
-
* } )
|
11871 |
-
*/
|
11872 |
-
"searchDelay": null,
|
11873 |
-
|
11874 |
-
|
11875 |
-
/**
|
11876 |
-
* WFDataTables features six different built-in options for the buttons to
|
11877 |
-
* display for pagination control:
|
11878 |
-
*
|
11879 |
-
* * `numbers` - Page number buttons only
|
11880 |
-
* * `simple` - 'Previous' and 'Next' buttons only
|
11881 |
-
* * 'simple_numbers` - 'Previous' and 'Next' buttons, plus page numbers
|
11882 |
-
* * `full` - 'First', 'Previous', 'Next' and 'Last' buttons
|
11883 |
-
* * `full_numbers` - 'First', 'Previous', 'Next' and 'Last' buttons, plus page numbers
|
11884 |
-
* * `first_last_numbers` - 'First' and 'Last' buttons, plus page numbers
|
11885 |
-
*
|
11886 |
-
* Further methods can be added using {@link WFDataTable.ext.oPagination}.
|
11887 |
-
* @type string
|
11888 |
-
* @default simple_numbers
|
11889 |
-
*
|
11890 |
-
* @dtopt Options
|
11891 |
-
* @name WFDataTable.defaults.pagingType
|
11892 |
-
*
|
11893 |
-
* @example
|
11894 |
-
* $(document).ready( function() {
|
11895 |
-
* $('#example').wfDataTable( {
|
11896 |
-
* "pagingType": "full_numbers"
|
11897 |
-
* } );
|
11898 |
-
* } )
|
11899 |
-
*/
|
11900 |
-
"sPaginationType": "simple_numbers",
|
11901 |
-
|
11902 |
-
|
11903 |
-
/**
|
11904 |
-
* Enable horizontal scrolling. When a table is too wide to fit into a
|
11905 |
-
* certain layout, or you have a large number of columns in the table, you
|
11906 |
-
* can enable x-scrolling to show the table in a viewport, which can be
|
11907 |
-
* scrolled. This property can be `true` which will allow the table to
|
11908 |
-
* scroll horizontally when needed, or any CSS unit, or a number (in which
|
11909 |
-
* case it will be treated as a pixel measurement). Setting as simply `true`
|
11910 |
-
* is recommended.
|
11911 |
-
* @type boolean|string
|
11912 |
-
* @default <i>blank string - i.e. disabled</i>
|
11913 |
-
*
|
11914 |
-
* @dtopt Features
|
11915 |
-
* @name WFDataTable.defaults.scrollX
|
11916 |
-
*
|
11917 |
-
* @example
|
11918 |
-
* $(document).ready( function() {
|
11919 |
-
* $('#example').wfDataTable( {
|
11920 |
-
* "scrollX": true,
|
11921 |
-
* "scrollCollapse": true
|
11922 |
-
* } );
|
11923 |
-
* } );
|
11924 |
-
*/
|
11925 |
-
"sScrollX": "",
|
11926 |
-
|
11927 |
-
|
11928 |
-
/**
|
11929 |
-
* This property can be used to force a WFDataTable to use more width than it
|
11930 |
-
* might otherwise do when x-scrolling is enabled. For example if you have a
|
11931 |
-
* table which requires to be well spaced, this parameter is useful for
|
11932 |
-
* "over-sizing" the table, and thus forcing scrolling. This property can by
|
11933 |
-
* any CSS unit, or a number (in which case it will be treated as a pixel
|
11934 |
-
* measurement).
|
11935 |
-
* @type string
|
11936 |
-
* @default <i>blank string - i.e. disabled</i>
|
11937 |
-
*
|
11938 |
-
* @dtopt Options
|
11939 |
-
* @name WFDataTable.defaults.scrollXInner
|
11940 |
-
*
|
11941 |
-
* @example
|
11942 |
-
* $(document).ready( function() {
|
11943 |
-
* $('#example').wfDataTable( {
|
11944 |
-
* "scrollX": "100%",
|
11945 |
-
* "scrollXInner": "110%"
|
11946 |
-
* } );
|
11947 |
-
* } );
|
11948 |
-
*/
|
11949 |
-
"sScrollXInner": "",
|
11950 |
-
|
11951 |
-
|
11952 |
-
/**
|
11953 |
-
* Enable vertical scrolling. Vertical scrolling will constrain the WFDataTable
|
11954 |
-
* to the given height, and enable scrolling for any data which overflows the
|
11955 |
-
* current viewport. This can be used as an alternative to paging to display
|
11956 |
-
* a lot of data in a small area (although paging and scrolling can both be
|
11957 |
-
* enabled at the same time). This property can be any CSS unit, or a number
|
11958 |
-
* (in which case it will be treated as a pixel measurement).
|
11959 |
-
* @type string
|
11960 |
-
* @default <i>blank string - i.e. disabled</i>
|
11961 |
-
*
|
11962 |
-
* @dtopt Features
|
11963 |
-
* @name WFDataTable.defaults.scrollY
|
11964 |
-
*
|
11965 |
-
* @example
|
11966 |
-
* $(document).ready( function() {
|
11967 |
-
* $('#example').wfDataTable( {
|
11968 |
-
* "scrollY": "200px",
|
11969 |
-
* "paginate": false
|
11970 |
-
* } );
|
11971 |
-
* } );
|
11972 |
-
*/
|
11973 |
-
"sScrollY": "",
|
11974 |
-
|
11975 |
-
|
11976 |
-
/**
|
11977 |
-
* __Deprecated__ The functionality provided by this parameter has now been
|
11978 |
-
* superseded by that provided through `ajax`, which should be used instead.
|
11979 |
-
*
|
11980 |
-
* Set the HTTP method that is used to make the Ajax call for server-side
|
11981 |
-
* processing or Ajax sourced data.
|
11982 |
-
* @type string
|
11983 |
-
* @default GET
|
11984 |
-
*
|
11985 |
-
* @dtopt Options
|
11986 |
-
* @dtopt Server-side
|
11987 |
-
* @name WFDataTable.defaults.serverMethod
|
11988 |
-
*
|
11989 |
-
* @deprecated 1.10. Please use `ajax` for this functionality now.
|
11990 |
-
*/
|
11991 |
-
"sServerMethod": "GET",
|
11992 |
-
|
11993 |
-
|
11994 |
-
/**
|
11995 |
-
* WFDataTables makes use of renderers when displaying HTML elements for
|
11996 |
-
* a table. These renderers can be added or modified by plug-ins to
|
11997 |
-
* generate suitable mark-up for a site. For example the Bootstrap
|
11998 |
-
* integration plug-in for WFDataTables uses a paging button renderer to
|
11999 |
-
* display pagination buttons in the mark-up required by Bootstrap.
|
12000 |
-
*
|
12001 |
-
* For further information about the renderers available see
|
12002 |
-
* WFDataTable.ext.renderer
|
12003 |
-
* @type string|object
|
12004 |
-
* @default null
|
12005 |
-
*
|
12006 |
-
* @name WFDataTable.defaults.renderer
|
12007 |
-
*
|
12008 |
-
*/
|
12009 |
-
"renderer": null,
|
12010 |
-
|
12011 |
-
|
12012 |
-
/**
|
12013 |
-
* Set the data property name that WFDataTables should use to get a row's id
|
12014 |
-
* to set as the `id` property in the node.
|
12015 |
-
* @type string
|
12016 |
-
* @default DT_RowId
|
12017 |
-
*
|
12018 |
-
* @name WFDataTable.defaults.rowId
|
12019 |
-
*/
|
12020 |
-
"rowId": "DT_RowId"
|
12021 |
-
};
|
12022 |
-
|
12023 |
-
_fnHungarianMap( WFDataTable.defaults );
|
12024 |
-
|
12025 |
-
|
12026 |
-
|
12027 |
-
/*
|
12028 |
-
* Developer note - See note in model.defaults.js about the use of Hungarian
|
12029 |
-
* notation and camel case.
|
12030 |
-
*/
|
12031 |
-
|
12032 |
-
/**
|
12033 |
-
* Column options that can be given to WFDataTables at initialisation time.
|
12034 |
-
* @namespace
|
12035 |
-
*/
|
12036 |
-
WFDataTable.defaults.column = {
|
12037 |
-
/**
|
12038 |
-
* Define which column(s) an order will occur on for this column. This
|
12039 |
-
* allows a column's ordering to take multiple columns into account when
|
12040 |
-
* doing a sort or use the data from a different column. For example first
|
12041 |
-
* name / last name columns make sense to do a multi-column sort over the
|
12042 |
-
* two columns.
|
12043 |
-
* @type array|int
|
12044 |
-
* @default null <i>Takes the value of the column index automatically</i>
|
12045 |
-
*
|
12046 |
-
* @name WFDataTable.defaults.column.orderData
|
12047 |
-
* @dtopt Columns
|
12048 |
-
*
|
12049 |
-
* @example
|
12050 |
-
* // Using `columnDefs`
|
12051 |
-
* $(document).ready( function() {
|
12052 |
-
* $('#example').wfDataTable( {
|
12053 |
-
* "columnDefs": [
|
12054 |
-
* { "orderData": [ 0, 1 ], "targets": [ 0 ] },
|
12055 |
-
* { "orderData": [ 1, 0 ], "targets": [ 1 ] },
|
12056 |
-
* { "orderData": 2, "targets": [ 2 ] }
|
12057 |
-
* ]
|
12058 |
-
* } );
|
12059 |
-
* } );
|
12060 |
-
*
|
12061 |
-
* @example
|
12062 |
-
* // Using `columns`
|
12063 |
-
* $(document).ready( function() {
|
12064 |
-
* $('#example').wfDataTable( {
|
12065 |
-
* "columns": [
|
12066 |
-
* { "orderData": [ 0, 1 ] },
|
12067 |
-
* { "orderData": [ 1, 0 ] },
|
12068 |
-
* { "orderData": 2 },
|
12069 |
-
* null,
|
12070 |
-
* null
|
12071 |
-
* ]
|
12072 |
-
* } );
|
12073 |
-
* } );
|
12074 |
-
*/
|
12075 |
-
"aDataSort": null,
|
12076 |
-
"iDataSort": -1,
|
12077 |
-
|
12078 |
-
|
12079 |
-
/**
|
12080 |
-
* You can control the default ordering direction, and even alter the
|
12081 |
-
* behaviour of the sort handler (i.e. only allow ascending ordering etc)
|
12082 |
-
* using this parameter.
|
12083 |
-
* @type array
|
12084 |
-
* @default [ 'asc', 'desc' ]
|
12085 |
-
*
|
12086 |
-
* @name WFDataTable.defaults.column.orderSequence
|
12087 |
-
* @dtopt Columns
|
12088 |
-
*
|
12089 |
-
* @example
|
12090 |
-
* // Using `columnDefs`
|
12091 |
-
* $(document).ready( function() {
|
12092 |
-
* $('#example').wfDataTable( {
|
12093 |
-
* "columnDefs": [
|
12094 |
-
* { "orderSequence": [ "asc" ], "targets": [ 1 ] },
|
12095 |
-
* { "orderSequence": [ "desc", "asc", "asc" ], "targets": [ 2 ] },
|
12096 |
-
* { "orderSequence": [ "desc" ], "targets": [ 3 ] }
|
12097 |
-
* ]
|
12098 |
-
* } );
|
12099 |
-
* } );
|
12100 |
-
*
|
12101 |
-
* @example
|
12102 |
-
* // Using `columns`
|
12103 |
-
* $(document).ready( function() {
|
12104 |
-
* $('#example').wfDataTable( {
|
12105 |
-
* "columns": [
|
12106 |
-
* null,
|
12107 |
-
* { "orderSequence": [ "asc" ] },
|
12108 |
-
* { "orderSequence": [ "desc", "asc", "asc" ] },
|
12109 |
-
* { "orderSequence": [ "desc" ] },
|
12110 |
-
* null
|
12111 |
-
* ]
|
12112 |
-
* } );
|
12113 |
-
* } );
|
12114 |
-
*/
|
12115 |
-
"asSorting": [ 'asc', 'desc' ],
|
12116 |
-
|
12117 |
-
|
12118 |
-
/**
|
12119 |
-
* Enable or disable filtering on the data in this column.
|
12120 |
-
* @type boolean
|
12121 |
-
* @default true
|
12122 |
-
*
|
12123 |
-
* @name WFDataTable.defaults.column.searchable
|
12124 |
-
* @dtopt Columns
|
12125 |
-
*
|
12126 |
-
* @example
|
12127 |
-
* // Using `columnDefs`
|
12128 |
-
* $(document).ready( function() {
|
12129 |
-
* $('#example').wfDataTable( {
|
12130 |
-
* "columnDefs": [
|
12131 |
-
* { "searchable": false, "targets": [ 0 ] }
|
12132 |
-
* ] } );
|
12133 |
-
* } );
|
12134 |
-
*
|
12135 |
-
* @example
|
12136 |
-
* // Using `columns`
|
12137 |
-
* $(document).ready( function() {
|
12138 |
-
* $('#example').wfDataTable( {
|
12139 |
-
* "columns": [
|
12140 |
-
* { "searchable": false },
|
12141 |
-
* null,
|
12142 |
-
* null,
|
12143 |
-
* null,
|
12144 |
-
* null
|
12145 |
-
* ] } );
|
12146 |
-
* } );
|
12147 |
-
*/
|
12148 |
-
"bSearchable": true,
|
12149 |
-
|
12150 |
-
|
12151 |
-
/**
|
12152 |
-
* Enable or disable ordering on this column.
|
12153 |
-
* @type boolean
|
12154 |
-
* @default true
|
12155 |
-
*
|
12156 |
-
* @name WFDataTable.defaults.column.orderable
|
12157 |
-
* @dtopt Columns
|
12158 |
-
*
|
12159 |
-
* @example
|
12160 |
-
* // Using `columnDefs`
|
12161 |
-
* $(document).ready( function() {
|
12162 |
-
* $('#example').wfDataTable( {
|
12163 |
-
* "columnDefs": [
|
12164 |
-
* { "orderable": false, "targets": [ 0 ] }
|
12165 |
-
* ] } );
|
12166 |
-
* } );
|
12167 |
-
*
|
12168 |
-
* @example
|
12169 |
-
* // Using `columns`
|
12170 |
-
* $(document).ready( function() {
|
12171 |
-
* $('#example').wfDataTable( {
|
12172 |
-
* "columns": [
|
12173 |
-
* { "orderable": false },
|
12174 |
-
* null,
|
12175 |
-
* null,
|
12176 |
-
* null,
|
12177 |
-
* null
|
12178 |
-
* ] } );
|
12179 |
-
* } );
|
12180 |
-
*/
|
12181 |
-
"bSortable": true,
|
12182 |
-
|
12183 |
-
|
12184 |
-
/**
|
12185 |
-
* Enable or disable the display of this column.
|
12186 |
-
* @type boolean
|
12187 |
-
* @default true
|
12188 |
-
*
|
12189 |
-
* @name WFDataTable.defaults.column.visible
|
12190 |
-
* @dtopt Columns
|
12191 |
-
*
|
12192 |
-
* @example
|
12193 |
-
* // Using `columnDefs`
|
12194 |
-
* $(document).ready( function() {
|
12195 |
-
* $('#example').wfDataTable( {
|
12196 |
-
* "columnDefs": [
|
12197 |
-
* { "visible": false, "targets": [ 0 ] }
|
12198 |
-
* ] } );
|
12199 |
-
* } );
|
12200 |
-
*
|
12201 |
-
* @example
|
12202 |
-
* // Using `columns`
|
12203 |
-
* $(document).ready( function() {
|
12204 |
-
* $('#example').wfDataTable( {
|
12205 |
-
* "columns": [
|
12206 |
-
* { "visible": false },
|
12207 |
-
* null,
|
12208 |
-
* null,
|
12209 |
-
* null,
|
12210 |
-
* null
|
12211 |
-
* ] } );
|
12212 |
-
* } );
|
12213 |
-
*/
|
12214 |
-
"bVisible": true,
|
12215 |
-
|
12216 |
-
|
12217 |
-
/**
|
12218 |
-
* Developer definable function that is called whenever a cell is created (Ajax source,
|
12219 |
-
* etc) or processed for input (DOM source). This can be used as a compliment to mRender
|
12220 |
-
* allowing you to modify the DOM element (add background colour for example) when the
|
12221 |
-
* element is available.
|
12222 |
-
* @type function
|
12223 |
-
* @param {element} td The TD node that has been created
|
12224 |
-
* @param {*} cellData The Data for the cell
|
12225 |
-
* @param {array|object} rowData The data for the whole row
|
12226 |
-
* @param {int} row The row index for the aoData data store
|
12227 |
-
* @param {int} col The column index for aoColumns
|
12228 |
-
*
|
12229 |
-
* @name WFDataTable.defaults.column.createdCell
|
12230 |
-
* @dtopt Columns
|
12231 |
-
*
|
12232 |
-
* @example
|
12233 |
-
* $(document).ready( function() {
|
12234 |
-
* $('#example').wfDataTable( {
|
12235 |
-
* "columnDefs": [ {
|
12236 |
-
* "targets": [3],
|
12237 |
-
* "createdCell": function (td, cellData, rowData, row, col) {
|
12238 |
-
* if ( cellData == "1.7" ) {
|
12239 |
-
* $(td).css('color', 'blue')
|
12240 |
-
* }
|
12241 |
-
* }
|
12242 |
-
* } ]
|
12243 |
-
* });
|
12244 |
-
* } );
|
12245 |
-
*/
|
12246 |
-
"fnCreatedCell": null,
|
12247 |
-
|
12248 |
-
|
12249 |
-
/**
|
12250 |
-
* This parameter has been replaced by `data` in WFDataTables to ensure naming
|
12251 |
-
* consistency. `dataProp` can still be used, as there is backwards
|
12252 |
-
* compatibility in WFDataTables for this option, but it is strongly
|
12253 |
-
* recommended that you use `data` in preference to `dataProp`.
|
12254 |
-
* @name WFDataTable.defaults.column.dataProp
|
12255 |
-
*/
|
12256 |
-
|
12257 |
-
|
12258 |
-
/**
|
12259 |
-
* This property can be used to read data from any data source property,
|
12260 |
-
* including deeply nested objects / properties. `data` can be given in a
|
12261 |
-
* number of different ways which effect its behaviour:
|
12262 |
-
*
|
12263 |
-
* * `integer` - treated as an array index for the data source. This is the
|
12264 |
-
* default that WFDataTables uses (incrementally increased for each column).
|
12265 |
-
* * `string` - read an object property from the data source. There are
|
12266 |
-
* three 'special' options that can be used in the string to alter how
|
12267 |
-
* WFDataTables reads the data from the source object:
|
12268 |
-
* * `.` - Dotted Javascript notation. Just as you use a `.` in
|
12269 |
-
* Javascript to read from nested objects, so to can the options
|
12270 |
-
* specified in `data`. For example: `browser.version` or
|
12271 |
-
* `browser.name`. If your object parameter name contains a period, use
|
12272 |
-
* `\\` to escape it - i.e. `first\\.name`.
|
12273 |
-
* * `[]` - Array notation. WFDataTables can automatically combine data
|
12274 |
-
* from and array source, joining the data with the characters provided
|
12275 |
-
* between the two brackets. For example: `name[, ]` would provide a
|
12276 |
-
* comma-space separated list from the source array. If no characters
|
12277 |
-
* are provided between the brackets, the original array source is
|
12278 |
-
* returned.
|
12279 |
-
* * `()` - Function notation. Adding `()` to the end of a parameter will
|
12280 |
-
* execute a function of the name given. For example: `browser()` for a
|
12281 |
-
* simple function on the data source, `browser.version()` for a
|
12282 |
-
* function in a nested property or even `browser().version` to get an
|
12283 |
-
* object property if the function called returns an object. Note that
|
12284 |
-
* function notation is recommended for use in `render` rather than
|
12285 |
-
* `data` as it is much simpler to use as a renderer.
|
12286 |
-
* * `null` - use the original data source for the row rather than plucking
|
12287 |
-
* data directly from it. This action has effects on two other
|
12288 |
-
* initialisation options:
|
12289 |
-
* * `defaultContent` - When null is given as the `data` option and
|
12290 |
-
* `defaultContent` is specified for the column, the value defined by
|
12291 |
-
* `defaultContent` will be used for the cell.
|
12292 |
-
* * `render` - When null is used for the `data` option and the `render`
|
12293 |
-
* option is specified for the column, the whole data source for the
|
12294 |
-
* row is used for the renderer.
|
12295 |
-
* * `function` - the function given will be executed whenever WFDataTables
|
12296 |
-
* needs to set or get the data for a cell in the column. The function
|
12297 |
-
* takes three parameters:
|
12298 |
-
* * Parameters:
|
12299 |
-
* * `{array|object}` The data source for the row
|
12300 |
-
* * `{string}` The type call data requested - this will be 'set' when
|
12301 |
-
* setting data or 'filter', 'display', 'type', 'sort' or undefined
|
12302 |
-
* when gathering data. Note that when `undefined` is given for the
|
12303 |
-
* type WFDataTables expects to get the raw data for the object back<
|
12304 |
-
* * `{*}` Data to set when the second parameter is 'set'.
|
12305 |
-
* * Return:
|
12306 |
-
* * The return value from the function is not required when 'set' is
|
12307 |
-
* the type of call, but otherwise the return is what will be used
|
12308 |
-
* for the data requested.
|
12309 |
-
*
|
12310 |
-
* Note that `data` is a getter and setter option. If you just require
|
12311 |
-
* formatting of data for output, you will likely want to use `render` which
|
12312 |
-
* is simply a getter and thus simpler to use.
|
12313 |
-
*
|
12314 |
-
* Note that prior to WFDataTables 1.9.2 `data` was called `mDataProp`. The
|
12315 |
-
* name change reflects the flexibility of this property and is consistent
|
12316 |
-
* with the naming of mRender. If 'mDataProp' is given, then it will still
|
12317 |
-
* be used by WFDataTables, as it automatically maps the old name to the new
|
12318 |
-
* if required.
|
12319 |
-
*
|
12320 |
-
* @type string|int|function|null
|
12321 |
-
* @default null <i>Use automatically calculated column index</i>
|
12322 |
-
*
|
12323 |
-
* @name WFDataTable.defaults.column.data
|
12324 |
-
* @dtopt Columns
|
12325 |
-
*
|
12326 |
-
* @example
|
12327 |
-
* // Read table data from objects
|
12328 |
-
* // JSON structure for each row:
|
12329 |
-
* // {
|
12330 |
-
* // "engine": {value},
|
12331 |
-
* // "browser": {value},
|
12332 |
-
* // "platform": {value},
|
12333 |
-
* // "version": {value},
|
12334 |
-
* // "grade": {value}
|
12335 |
-
* // }
|
12336 |
-
* $(document).ready( function() {
|
12337 |
-
* $('#example').wfDataTable( {
|
12338 |
-
* "ajaxSource": "sources/objects.txt",
|
12339 |
-
* "columns": [
|
12340 |
-
* { "data": "engine" },
|
12341 |
-
* { "data": "browser" },
|
12342 |
-
* { "data": "platform" },
|
12343 |
-
* { "data": "version" },
|
12344 |
-
* { "data": "grade" }
|
12345 |
-
* ]
|
12346 |
-
* } );
|
12347 |
-
* } );
|
12348 |
-
*
|
12349 |
-
* @example
|
12350 |
-
* // Read information from deeply nested objects
|
12351 |
-
* // JSON structure for each row:
|
12352 |
-
* // {
|
12353 |
-
* // "engine": {value},
|
12354 |
-
* // "browser": {value},
|
12355 |
-
* // "platform": {
|
12356 |
-
* // "inner": {value}
|
12357 |
-
* // },
|
12358 |
-
* // "details": [
|
12359 |
-
* // {value}, {value}
|
12360 |
-
* // ]
|
12361 |
-
* // }
|
12362 |
-
* $(document).ready( function() {
|
12363 |
-
* $('#example').wfDataTable( {
|
12364 |
-
* "ajaxSource": "sources/deep.txt",
|
12365 |
-
* "columns": [
|
12366 |
-
* { "data": "engine" },
|
12367 |
-
* { "data": "browser" },
|
12368 |
-
* { "data": "platform.inner" },
|
12369 |
-
* { "data": "platform.details.0" },
|
12370 |
-
* { "data": "platform.details.1" }
|
12371 |
-
* ]
|
12372 |
-
* } );
|
12373 |
-
* } );
|
12374 |
-
*
|
12375 |
-
* @example
|
12376 |
-
* // Using `data` as a function to provide different information for
|
12377 |
-
* // sorting, filtering and display. In this case, currency (price)
|
12378 |
-
* $(document).ready( function() {
|
12379 |
-
* $('#example').wfDataTable( {
|
12380 |
-
* "columnDefs": [ {
|
12381 |
-
* "targets": [ 0 ],
|
12382 |
-
* "data": function ( source, type, val ) {
|
12383 |
-
* if (type === 'set') {
|
12384 |
-
* source.price = val;
|
12385 |
-
* // Store the computed dislay and filter values for efficiency
|
12386 |
-
* source.price_display = val=="" ? "" : "$"+numberFormat(val);
|
12387 |
-
* source.price_filter = val=="" ? "" : "$"+numberFormat(val)+" "+val;
|
12388 |
-
* return;
|
12389 |
-
* }
|
12390 |
-
* else if (type === 'display') {
|
12391 |
-
* return source.price_display;
|
12392 |
-
* }
|
12393 |
-
* else if (type === 'filter') {
|
12394 |
-
* return source.price_filter;
|
12395 |
-
* }
|
12396 |
-
* // 'sort', 'type' and undefined all just use the integer
|
12397 |
-
* return source.price;
|
12398 |
-
* }
|
12399 |
-
* } ]
|
12400 |
-
* } );
|
12401 |
-
* } );
|
12402 |
-
*
|
12403 |
-
* @example
|
12404 |
-
* // Using default content
|
12405 |
-
* $(document).ready( function() {
|
12406 |
-
* $('#example').wfDataTable( {
|
12407 |
-
* "columnDefs": [ {
|
12408 |
-
* "targets": [ 0 ],
|
12409 |
-
* "data": null,
|
12410 |
-
* "defaultContent": "Click to edit"
|
12411 |
-
* } ]
|
12412 |
-
* } );
|
12413 |
-
* } );
|
12414 |
-
*
|
12415 |
-
* @example
|
12416 |
-
* // Using array notation - outputting a list from an array
|
12417 |
-
* $(document).ready( function() {
|
12418 |
-
* $('#example').wfDataTable( {
|
12419 |
-
* "columnDefs": [ {
|
12420 |
-
* "targets": [ 0 ],
|
12421 |
-
* "data": "name[, ]"
|
12422 |
-
* } ]
|
12423 |
-
* } );
|
12424 |
-
* } );
|
12425 |
-
*
|
12426 |
-
*/
|
12427 |
-
"mData": null,
|
12428 |
-
|
12429 |
-
|
12430 |
-
/**
|
12431 |
-
* This property is the rendering partner to `data` and it is suggested that
|
12432 |
-
* when you want to manipulate data for display (including filtering,
|
12433 |
-
* sorting etc) without altering the underlying data for the table, use this
|
12434 |
-
* property. `render` can be considered to be the the read only companion to
|
12435 |
-
* `data` which is read / write (then as such more complex). Like `data`
|
12436 |
-
* this option can be given in a number of different ways to effect its
|
12437 |
-
* behaviour:
|
12438 |
-
*
|
12439 |
-
* * `integer` - treated as an array index for the data source. This is the
|
12440 |
-
* default that WFDataTables uses (incrementally increased for each column).
|
12441 |
-
* * `string` - read an object property from the data source. There are
|
12442 |
-
* three 'special' options that can be used in the string to alter how
|
12443 |
-
* WFDataTables reads the data from the source object:
|
12444 |
-
* * `.` - Dotted Javascript notation. Just as you use a `.` in
|
12445 |
-
* Javascript to read from nested objects, so to can the options
|
12446 |
-
* specified in `data`. For example: `browser.version` or
|
12447 |
-
* `browser.name`. If your object parameter name contains a period, use
|
12448 |
-
* `\\` to escape it - i.e. `first\\.name`.
|
12449 |
-
* * `[]` - Array notation. WFDataTables can automatically combine data
|
12450 |
-
* from and array source, joining the data with the characters provided
|
12451 |
-
* between the two brackets. For example: `name[, ]` would provide a
|
12452 |
-
* comma-space separated list from the source array. If no characters
|
12453 |
-
* are provided between the brackets, the original array source is
|
12454 |
-
* returned.
|
12455 |
-
* * `()` - Function notation. Adding `()` to the end of a parameter will
|
12456 |
-
* execute a function of the name given. For example: `browser()` for a
|
12457 |
-
* simple function on the data source, `browser.version()` for a
|
12458 |
-
* function in a nested property or even `browser().version` to get an
|
12459 |
-
* object property if the function called returns an object.
|
12460 |
-
* * `object` - use different data for the different data types requested by
|
12461 |
-
* WFDataTables ('filter', 'display', 'type' or 'sort'). The property names
|
12462 |
-
* of the object is the data type the property refers to and the value can
|
12463 |
-
* defined using an integer, string or function using the same rules as
|
12464 |
-
* `render` normally does. Note that an `_` option _must_ be specified.
|
12465 |
-
* This is the default value to use if you haven't specified a value for
|
12466 |
-
* the data type requested by WFDataTables.
|
12467 |
-
* * `function` - the function given will be executed whenever WFDataTables
|
12468 |
-
* needs to set or get the data for a cell in the column. The function
|
12469 |
-
* takes three parameters:
|
12470 |
-
* * Parameters:
|
12471 |
-
* * {array|object} The data source for the row (based on `data`)
|
12472 |
-
* * {string} The type call data requested - this will be 'filter',
|
12473 |
-
* 'display', 'type' or 'sort'.
|
12474 |
-
* * {array|object} The full data source for the row (not based on
|
12475 |
-
* `data`)
|
12476 |
-
* * Return:
|
12477 |
-
* * The return value from the function is what will be used for the
|
12478 |
-
* data requested.
|
12479 |
-
*
|
12480 |
-
* @type string|int|function|object|null
|
12481 |
-
* @default null Use the data source value.
|
12482 |
-
*
|
12483 |
-
* @name WFDataTable.defaults.column.render
|
12484 |
-
* @dtopt Columns
|
12485 |
-
*
|
12486 |
-
* @example
|
12487 |
-
* // Create a comma separated list from an array of objects
|
12488 |
-
* $(document).ready( function() {
|
12489 |
-
* $('#example').wfDataTable( {
|
12490 |
-
* "ajaxSource": "sources/deep.txt",
|
12491 |
-
* "columns": [
|
12492 |
-
* { "data": "engine" },
|
12493 |
-
* { "data": "browser" },
|
12494 |
-
* {
|
12495 |
-
* "data": "platform",
|
12496 |
-
* "render": "[, ].name"
|
12497 |
-
* }
|
12498 |
-
* ]
|
12499 |
-
* } );
|
12500 |
-
* } );
|
12501 |
-
*
|
12502 |
-
* @example
|
12503 |
-
* // Execute a function to obtain data
|
12504 |
-
* $(document).ready( function() {
|
12505 |
-
* $('#example').wfDataTable( {
|
12506 |
-
* "columnDefs": [ {
|
12507 |
-
* "targets": [ 0 ],
|
12508 |
-
* "data": null, // Use the full data source object for the renderer's source
|
12509 |
-
* "render": "browserName()"
|
12510 |
-
* } ]
|
12511 |
-
* } );
|
12512 |
-
* } );
|
12513 |
-
*
|
12514 |
-
* @example
|
12515 |
-
* // As an object, extracting different data for the different types
|
12516 |
-
* // This would be used with a data source such as:
|
12517 |
-
* // { "phone": 5552368, "phone_filter": "5552368 555-2368", "phone_display": "555-2368" }
|
12518 |
-
* // Here the `phone` integer is used for sorting and type detection, while `phone_filter`
|
12519 |
-
* // (which has both forms) is used for filtering for if a user inputs either format, while
|
12520 |
-
* // the formatted phone number is the one that is shown in the table.
|
12521 |
-
* $(document).ready( function() {
|
12522 |
-
* $('#example').wfDataTable( {
|
12523 |
-
* "columnDefs": [ {
|
12524 |
-
* "targets": [ 0 ],
|
12525 |
-
* "data": null, // Use the full data source object for the renderer's source
|
12526 |
-
* "render": {
|
12527 |
-
* "_": "phone",
|
12528 |
-
* "filter": "phone_filter",
|
12529 |
-
* "display": "phone_display"
|
12530 |
-
* }
|
12531 |
-
* } ]
|
12532 |
-
* } );
|
12533 |
-
* } );
|
12534 |
-
*
|
12535 |
-
* @example
|
12536 |
-
* // Use as a function to create a link from the data source
|
12537 |
-
* $(document).ready( function() {
|
12538 |
-
* $('#example').wfDataTable( {
|
12539 |
-
* "columnDefs": [ {
|
12540 |
-
* "targets": [ 0 ],
|
12541 |
-
* "data": "download_link",
|
12542 |
-
* "render": function ( data, type, full ) {
|
12543 |
-
* return '<a href="'+data+'">Download</a>';
|
12544 |
-
* }
|
12545 |
-
* } ]
|
12546 |
-
* } );
|
12547 |
-
* } );
|
12548 |
-
*/
|
12549 |
-
"mRender": null,
|
12550 |
-
|
12551 |
-
|
12552 |
-
/**
|
12553 |
-
* Change the cell type created for the column - either TD cells or TH cells. This
|
12554 |
-
* can be useful as TH cells have semantic meaning in the table body, allowing them
|
12555 |
-
* to act as a header for a row (you may wish to add scope='row' to the TH elements).
|
12556 |
-
* @type string
|
12557 |
-
* @default td
|
12558 |
-
*
|
12559 |
-
* @name WFDataTable.defaults.column.cellType
|
12560 |
-
* @dtopt Columns
|
12561 |
-
*
|
12562 |
-
* @example
|
12563 |
-
* // Make the first column use TH cells
|
12564 |
-
* $(document).ready( function() {
|
12565 |
-
* $('#example').wfDataTable( {
|
12566 |
-
* "columnDefs": [ {
|
12567 |
-
* "targets": [ 0 ],
|
12568 |
-
* "cellType": "th"
|
12569 |
-
* } ]
|
12570 |
-
* } );
|
12571 |
-
* } );
|
12572 |
-
*/
|
12573 |
-
"sCellType": "td",
|
12574 |
-
|
12575 |
-
|
12576 |
-
/**
|
12577 |
-
* Class to give to each cell in this column.
|
12578 |
-
* @type string
|
12579 |
-
* @default <i>Empty string</i>
|
12580 |
-
*
|
12581 |
-
* @name WFDataTable.defaults.column.class
|
12582 |
-
* @dtopt Columns
|
12583 |
-
*
|
12584 |
-
* @example
|
12585 |
-
* // Using `columnDefs`
|
12586 |
-
* $(document).ready( function() {
|
12587 |
-
* $('#example').wfDataTable( {
|
12588 |
-
* "columnDefs": [
|
12589 |
-
* { "class": "my_class", "targets": [ 0 ] }
|
12590 |
-
* ]
|
12591 |
-
* } );
|
12592 |
-
* } );
|
12593 |
-
*
|
12594 |
-
* @example
|
12595 |
-
* // Using `columns`
|
12596 |
-
* $(document).ready( function() {
|
12597 |
-
* $('#example').wfDataTable( {
|
12598 |
-
* "columns": [
|
12599 |
-
* { "class": "my_class" },
|
12600 |
-
* null,
|
12601 |
-
* null,
|
12602 |
-
* null,
|
12603 |
-
* null
|
12604 |
-
* ]
|
12605 |
-
* } );
|
12606 |
-
* } );
|
12607 |
-
*/
|
12608 |
-
"sClass": "",
|
12609 |
-
|
12610 |
-
/**
|
12611 |
-
* When WFDataTables calculates the column widths to assign to each column,
|
12612 |
-
* it finds the longest string in each column and then constructs a
|
12613 |
-
* temporary table and reads the widths from that. The problem with this
|
12614 |
-
* is that "mmm" is much wider then "iiii", but the latter is a longer
|
12615 |
-
* string - thus the calculation can go wrong (doing it properly and putting
|
12616 |
-
* it into an DOM object and measuring that is horribly(!) slow). Thus as
|
12617 |
-
* a "work around" we provide this option. It will append its value to the
|
12618 |
-
* text that is found to be the longest string for the column - i.e. padding.
|
12619 |
-
* Generally you shouldn't need this!
|
12620 |
-
* @type string
|
12621 |
-
* @default <i>Empty string<i>
|
12622 |
-
*
|
12623 |
-
* @name WFDataTable.defaults.column.contentPadding
|
12624 |
-
* @dtopt Columns
|
12625 |
-
*
|
12626 |
-
* @example
|
12627 |
-
* // Using `columns`
|
12628 |
-
* $(document).ready( function() {
|
12629 |
-
* $('#example').wfDataTable( {
|
12630 |
-
* "columns": [
|
12631 |
-
* null,
|
12632 |
-
* null,
|
12633 |
-
* null,
|
12634 |
-
* {
|
12635 |
-
* "contentPadding": "mmm"
|
12636 |
-
* }
|
12637 |
-
* ]
|
12638 |
-
* } );
|
12639 |
-
* } );
|
12640 |
-
*/
|
12641 |
-
"sContentPadding": "",
|
12642 |
-
|
12643 |
-
|
12644 |
-
/**
|
12645 |
-
* Allows a default value to be given for a column's data, and will be used
|
12646 |
-
* whenever a null data source is encountered (this can be because `data`
|
12647 |
-
* is set to null, or because the data source itself is null).
|
12648 |
-
* @type string
|
12649 |
-
* @default null
|
12650 |
-
*
|
12651 |
-
* @name WFDataTable.defaults.column.defaultContent
|
12652 |
-
* @dtopt Columns
|
12653 |
-
*
|
12654 |
-
* @example
|
12655 |
-
* // Using `columnDefs`
|
12656 |
-
* $(document).ready( function() {
|
12657 |
-
* $('#example').wfDataTable( {
|
12658 |
-
* "columnDefs": [
|
12659 |
-
* {
|
12660 |
-
* "data": null,
|
12661 |
-
* "defaultContent": "Edit",
|
12662 |
-
* "targets": [ -1 ]
|
12663 |
-
* }
|
12664 |
-
* ]
|
12665 |
-
* } );
|
12666 |
-
* } );
|
12667 |
-
*
|
12668 |
-
* @example
|
12669 |
-
* // Using `columns`
|
12670 |
-
* $(document).ready( function() {
|
12671 |
-
* $('#example').wfDataTable( {
|
12672 |
-
* "columns": [
|
12673 |
-
* null,
|
12674 |
-
* null,
|
12675 |
-
* null,
|
12676 |
-
* {
|
12677 |
-
* "data": null,
|
12678 |
-
* "defaultContent": "Edit"
|
12679 |
-
* }
|
12680 |
-
* ]
|
12681 |
-
* } );
|
12682 |
-
* } );
|
12683 |
-
*/
|
12684 |
-
"sDefaultContent": null,
|
12685 |
-
|
12686 |
-
|
12687 |
-
/**
|
12688 |
-
* This parameter is only used in WFDataTables' server-side processing. It can
|
12689 |
-
* be exceptionally useful to know what columns are being displayed on the
|
12690 |
-
* client side, and to map these to database fields. When defined, the names
|
12691 |
-
* also allow WFDataTables to reorder information from the server if it comes
|
12692 |
-
* back in an unexpected order (i.e. if you switch your columns around on the
|
12693 |
-
* client-side, your server-side code does not also need updating).
|
12694 |
-
* @type string
|
12695 |
-
* @default <i>Empty string</i>
|
12696 |
-
*
|
12697 |
-
* @name WFDataTable.defaults.column.name
|
12698 |
-
* @dtopt Columns
|
12699 |
-
*
|
12700 |
-
* @example
|
12701 |
-
* // Using `columnDefs`
|
12702 |
-
* $(document).ready( function() {
|
12703 |
-
* $('#example').wfDataTable( {
|
12704 |
-
* "columnDefs": [
|
12705 |
-
* { "name": "engine", "targets": [ 0 ] },
|
12706 |
-
* { "name": "browser", "targets": [ 1 ] },
|
12707 |
-
* { "name": "platform", "targets": [ 2 ] },
|
12708 |
-
* { "name": "version", "targets": [ 3 ] },
|
12709 |
-
* { "name": "grade", "targets": [ 4 ] }
|
12710 |
-
* ]
|
12711 |
-
* } );
|
12712 |
-
* } );
|
12713 |
-
*
|
12714 |
-
* @example
|
12715 |
-
* // Using `columns`
|
12716 |
-
* $(document).ready( function() {
|
12717 |
-
* $('#example').wfDataTable( {
|
12718 |
-
* "columns": [
|
12719 |
-
* { "name": "engine" },
|
12720 |
-
* { "name": "browser" },
|
12721 |
-
* { "name": "platform" },
|
12722 |
-
* { "name": "version" },
|
12723 |
-
* { "name": "grade" }
|
12724 |
-
* ]
|
12725 |
-
* } );
|
12726 |
-
* } );
|
12727 |
-
*/
|
12728 |
-
"sName": "",
|
12729 |
-
|
12730 |
-
|
12731 |
-
/**
|
12732 |
-
* Defines a data source type for the ordering which can be used to read
|
12733 |
-
* real-time information from the table (updating the internally cached
|
12734 |
-
* version) prior to ordering. This allows ordering to occur on user
|
12735 |
-
* editable elements such as form inputs.
|
12736 |
-
* @type string
|
12737 |
-
* @default std
|
12738 |
-
*
|
12739 |
-
* @name WFDataTable.defaults.column.orderDataType
|
12740 |
-
* @dtopt Columns
|
12741 |
-
*
|
12742 |
-
* @example
|
12743 |
-
* // Using `columnDefs`
|
12744 |
-
* $(document).ready( function() {
|
12745 |
-
* $('#example').wfDataTable( {
|
12746 |
-
* "columnDefs": [
|
12747 |
-
* { "orderDataType": "dom-text", "targets": [ 2, 3 ] },
|
12748 |
-
* { "type": "numeric", "targets": [ 3 ] },
|
12749 |
-
* { "orderDataType": "dom-select", "targets": [ 4 ] },
|
12750 |
-
* { "orderDataType": "dom-checkbox", "targets": [ 5 ] }
|
12751 |
-
* ]
|
12752 |
-
* } );
|
12753 |
-
* } );
|
12754 |
-
*
|
12755 |
-
* @example
|
12756 |
-
* // Using `columns`
|
12757 |
-
* $(document).ready( function() {
|
12758 |
-
* $('#example').wfDataTable( {
|
12759 |
-
* "columns": [
|
12760 |
-
* null,
|
12761 |
-
* null,
|
12762 |
-
* { "orderDataType": "dom-text" },
|
12763 |
-
* { "orderDataType": "dom-text", "type": "numeric" },
|
12764 |
-
* { "orderDataType": "dom-select" },
|
12765 |
-
* { "orderDataType": "dom-checkbox" }
|
12766 |
-
* ]
|
12767 |
-
* } );
|
12768 |
-
* } );
|
12769 |
-
*/
|
12770 |
-
"sSortDataType": "std",
|
12771 |
-
|
12772 |
-
|
12773 |
-
/**
|
12774 |
-
* The title of this column.
|
12775 |
-
* @type string
|
12776 |
-
* @default null <i>Derived from the 'TH' value for this column in the
|
12777 |
-
* original HTML table.</i>
|
12778 |
-
*
|
12779 |
-
* @name WFDataTable.defaults.column.title
|
12780 |
-
* @dtopt Columns
|
12781 |
-
*
|
12782 |
-
* @example
|
12783 |
-
* // Using `columnDefs`
|
12784 |
-
* $(document).ready( function() {
|
12785 |
-
* $('#example').wfDataTable( {
|
12786 |
-
* "columnDefs": [
|
12787 |
-
* { "title": "My column title", "targets": [ 0 ] }
|
12788 |
-
* ]
|
12789 |
-
* } );
|
12790 |
-
* } );
|
12791 |
-
*
|
12792 |
-
* @example
|
12793 |
-
* // Using `columns`
|
12794 |
-
* $(document).ready( function() {
|
12795 |
-
* $('#example').wfDataTable( {
|
12796 |
-
* "columns": [
|
12797 |
-
* { "title": "My column title" },
|
12798 |
-
* null,
|
12799 |
-
* null,
|
12800 |
-
* null,
|
12801 |
-
* null
|
12802 |
-
* ]
|
12803 |
-
* } );
|
12804 |
-
* } );
|
12805 |
-
*/
|
12806 |
-
"sTitle": null,
|
12807 |
-
|
12808 |
-
|
12809 |
-
/**
|
12810 |
-
* The type allows you to specify how the data for this column will be
|
12811 |
-
* ordered. Four types (string, numeric, date and html (which will strip
|
12812 |
-
* HTML tags before ordering)) are currently available. Note that only date
|
12813 |
-
* formats understood by Javascript's Date() object will be accepted as type
|
12814 |
-
* date. For example: "Mar 26, 2008 5:03 PM". May take the values: 'string',
|
12815 |
-
* 'numeric', 'date' or 'html' (by default). Further types can be adding
|
12816 |
-
* through plug-ins.
|
12817 |
-
* @type string
|
12818 |
-
* @default null <i>Auto-detected from raw data</i>
|
12819 |
-
*
|
12820 |
-
* @name WFDataTable.defaults.column.type
|
12821 |
-
* @dtopt Columns
|
12822 |
-
*
|
12823 |
-
* @example
|
12824 |
-
* // Using `columnDefs`
|
12825 |
-
* $(document).ready( function() {
|
12826 |
-
* $('#example').wfDataTable( {
|
12827 |
-
* "columnDefs": [
|
12828 |
-
* { "type": "html", "targets": [ 0 ] }
|
12829 |
-
* ]
|
12830 |
-
* } );
|
12831 |
-
* } );
|
12832 |
-
*
|
12833 |
-
* @example
|
12834 |
-
* // Using `columns`
|
12835 |
-
* $(document).ready( function() {
|
12836 |
-
* $('#example').wfDataTable( {
|
12837 |
-
* "columns": [
|
12838 |
-
* { "type": "html" },
|
12839 |
-
* null,
|
12840 |
-
* null,
|
12841 |
-
* null,
|
12842 |
-
* null
|
12843 |
-
* ]
|
12844 |
-
* } );
|
12845 |
-
* } );
|
12846 |
-
*/
|
12847 |
-
"sType": null,
|
12848 |
-
|
12849 |
-
|
12850 |
-
/**
|
12851 |
-
* Defining the width of the column, this parameter may take any CSS value
|
12852 |
-
* (3em, 20px etc). WFDataTables applies 'smart' widths to columns which have not
|
12853 |
-
* been given a specific width through this interface ensuring that the table
|
12854 |
-
* remains readable.
|
12855 |
-
* @type string
|
12856 |
-
* @default null <i>Automatic</i>
|
12857 |
-
*
|
12858 |
-
* @name WFDataTable.defaults.column.width
|
12859 |
-
* @dtopt Columns
|
12860 |
-
*
|
12861 |
-
* @example
|
12862 |
-
* // Using `columnDefs`
|
12863 |
-
* $(document).ready( function() {
|
12864 |
-
* $('#example').wfDataTable( {
|
12865 |
-
* "columnDefs": [
|
12866 |
-
* { "width": "20%", "targets": [ 0 ] }
|
12867 |
-
* ]
|
12868 |
-
* } );
|
12869 |
-
* } );
|
12870 |
-
*
|
12871 |
-
* @example
|
12872 |
-
* // Using `columns`
|
12873 |
-
* $(document).ready( function() {
|
12874 |
-
* $('#example').wfDataTable( {
|
12875 |
-
* "columns": [
|
12876 |
-
* { "width": "20%" },
|
12877 |
-
* null,
|
12878 |
-
* null,
|
12879 |
-
* null,
|
12880 |
-
* null
|
12881 |
-
* ]
|
12882 |
-
* } );
|
12883 |
-
* } );
|
12884 |
-
*/
|
12885 |
-
"sWidth": null
|
12886 |
-
};
|
12887 |
-
|
12888 |
-
_fnHungarianMap( WFDataTable.defaults.column );
|
12889 |
-
|
12890 |
-
|
12891 |
-
|
12892 |
-
/**
|
12893 |
-
* WFDataTables settings object - this holds all the information needed for a
|
12894 |
-
* given table, including configuration, data and current application of the
|
12895 |
-
* table options. WFDataTables does not have a single instance for each WFDataTable
|
12896 |
-
* with the settings attached to that instance, but rather instances of the
|
12897 |
-
* WFDataTable "class" are created on-the-fly as needed (typically by a
|
12898 |
-
* $().wfDataTable() call) and the settings object is then applied to that
|
12899 |
-
* instance.
|
12900 |
-
*
|
12901 |
-
* Note that this object is related to {@link WFDataTable.defaults} but this
|
12902 |
-
* one is the internal data store for WFDataTables's cache of columns. It should
|
12903 |
-
* NOT be manipulated outside of WFDataTables. Any configuration should be done
|
12904 |
-
* through the initialisation options.
|
12905 |
-
* @namespace
|
12906 |
-
* @todo Really should attach the settings object to individual instances so we
|
12907 |
-
* don't need to create new instances on each $().wfDataTable() call (if the
|
12908 |
-
* table already exists). It would also save passing oSettings around and
|
12909 |
-
* into every single function. However, this is a very significant
|
12910 |
-
* architecture change for WFDataTables and will almost certainly break
|
12911 |
-
* backwards compatibility with older installations. This is something that
|
12912 |
-
* will be done in 2.0.
|
12913 |
-
*/
|
12914 |
-
WFDataTable.models.oSettings = {
|
12915 |
-
/**
|
12916 |
-
* Primary features of WFDataTables and their enablement state.
|
12917 |
-
* @namespace
|
12918 |
-
*/
|
12919 |
-
"oFeatures": {
|
12920 |
-
|
12921 |
-
/**
|
12922 |
-
* Flag to say if WFDataTables should automatically try to calculate the
|
12923 |
-
* optimum table and columns widths (true) or not (false).
|
12924 |
-
* Note that this parameter will be set by the initialisation routine. To
|
12925 |
-
* set a default use {@link WFDataTable.defaults}.
|
12926 |
-
* @type boolean
|
12927 |
-
*/
|
12928 |
-
"bAutoWidth": null,
|
12929 |
-
|
12930 |
-
/**
|
12931 |
-
* Delay the creation of TR and TD elements until they are actually
|
12932 |
-
* needed by a driven page draw. This can give a significant speed
|
12933 |
-
* increase for Ajax source and Javascript source data, but makes no
|
12934 |
-
* difference at all fro DOM and server-side processing tables.
|
12935 |
-
* Note that this parameter will be set by the initialisation routine. To
|
12936 |
-
* set a default use {@link WFDataTable.defaults}.
|
12937 |
-
* @type boolean
|
12938 |
-
*/
|
12939 |
-
"bDeferRender": null,
|
12940 |
-
|
12941 |
-
/**
|
12942 |
-
* Enable filtering on the table or not. Note that if this is disabled
|
12943 |
-
* then there is no filtering at all on the table, including fnFilter.
|
12944 |
-
* To just remove the filtering input use sDom and remove the 'f' option.
|
12945 |
-
* Note that this parameter will be set by the initialisation routine. To
|
12946 |
-
* set a default use {@link WFDataTable.defaults}.
|
12947 |
-
* @type boolean
|
12948 |
-
*/
|
12949 |
-
"bFilter": null,
|
12950 |
-
|
12951 |
-
/**
|
12952 |
-
* Table information element (the 'Showing x of y records' div) enable
|
12953 |
-
* flag.
|
12954 |
-
* Note that this parameter will be set by the initialisation routine. To
|
12955 |
-
* set a default use {@link WFDataTable.defaults}.
|
12956 |
-
* @type boolean
|
12957 |
-
*/
|
12958 |
-
"bInfo": null,
|
12959 |
-
|
12960 |
-
/**
|
12961 |
-
* Present a user control allowing the end user to change the page size
|
12962 |
-
* when pagination is enabled.
|
12963 |
-
* Note that this parameter will be set by the initialisation routine. To
|
12964 |
-
* set a default use {@link WFDataTable.defaults}.
|
12965 |
-
* @type boolean
|
12966 |
-
*/
|
12967 |
-
"bLengthChange": null,
|
12968 |
-
|
12969 |
-
/**
|
12970 |
-
* Pagination enabled or not. Note that if this is disabled then length
|
12971 |
-
* changing must also be disabled.
|
12972 |
-
* Note that this parameter will be set by the initialisation routine. To
|
12973 |
-
* set a default use {@link WFDataTable.defaults}.
|
12974 |
-
* @type boolean
|
12975 |
-
*/
|
12976 |
-
"bPaginate": null,
|
12977 |
-
|
12978 |
-
/**
|
12979 |
-
* Processing indicator enable flag whenever WFDataTables is enacting a
|
12980 |
-
* user request - typically an Ajax request for server-side processing.
|
12981 |
-
* Note that this parameter will be set by the initialisation routine. To
|
12982 |
-
* set a default use {@link WFDataTable.defaults}.
|
12983 |
-
* @type boolean
|
12984 |
-
*/
|
12985 |
-
"bProcessing": null,
|
12986 |
-
|
12987 |
-
/**
|
12988 |
-
* Server-side processing enabled flag - when enabled WFDataTables will
|
12989 |
-
* get all data from the server for every draw - there is no filtering,
|
12990 |
-
* sorting or paging done on the client-side.
|
12991 |
-
* Note that this parameter will be set by the initialisation routine. To
|
12992 |
-
* set a default use {@link WFDataTable.defaults}.
|
12993 |
-
* @type boolean
|
12994 |
-
*/
|
12995 |
-
"bServerSide": null,
|
12996 |
-
|
12997 |
-
/**
|
12998 |
-
* Sorting enablement flag.
|
12999 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13000 |
-
* set a default use {@link WFDataTable.defaults}.
|
13001 |
-
* @type boolean
|
13002 |
-
*/
|
13003 |
-
"bSort": null,
|
13004 |
-
|
13005 |
-
/**
|
13006 |
-
* Multi-column sorting
|
13007 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13008 |
-
* set a default use {@link WFDataTable.defaults}.
|
13009 |
-
* @type boolean
|
13010 |
-
*/
|
13011 |
-
"bSortMulti": null,
|
13012 |
-
|
13013 |
-
/**
|
13014 |
-
* Apply a class to the columns which are being sorted to provide a
|
13015 |
-
* visual highlight or not. This can slow things down when enabled since
|
13016 |
-
* there is a lot of DOM interaction.
|
13017 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13018 |
-
* set a default use {@link WFDataTable.defaults}.
|
13019 |
-
* @type boolean
|
13020 |
-
*/
|
13021 |
-
"bSortClasses": null,
|
13022 |
-
|
13023 |
-
/**
|
13024 |
-
* State saving enablement flag.
|
13025 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13026 |
-
* set a default use {@link WFDataTable.defaults}.
|
13027 |
-
* @type boolean
|
13028 |
-
*/
|
13029 |
-
"bStateSave": null
|
13030 |
-
},
|
13031 |
-
|
13032 |
-
|
13033 |
-
/**
|
13034 |
-
* Scrolling settings for a table.
|
13035 |
-
* @namespace
|
13036 |
-
*/
|
13037 |
-
"oScroll": {
|
13038 |
-
/**
|
13039 |
-
* When the table is shorter in height than sScrollY, collapse the
|
13040 |
-
* table container down to the height of the table (when true).
|
13041 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13042 |
-
* set a default use {@link WFDataTable.defaults}.
|
13043 |
-
* @type boolean
|
13044 |
-
*/
|
13045 |
-
"bCollapse": null,
|
13046 |
-
|
13047 |
-
/**
|
13048 |
-
* Width of the scrollbar for the web-browser's platform. Calculated
|
13049 |
-
* during table initialisation.
|
13050 |
-
* @type int
|
13051 |
-
* @default 0
|
13052 |
-
*/
|
13053 |
-
"iBarWidth": 0,
|
13054 |
-
|
13055 |
-
/**
|
13056 |
-
* Viewport width for horizontal scrolling. Horizontal scrolling is
|
13057 |
-
* disabled if an empty string.
|
13058 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13059 |
-
* set a default use {@link WFDataTable.defaults}.
|
13060 |
-
* @type string
|
13061 |
-
*/
|
13062 |
-
"sX": null,
|
13063 |
-
|
13064 |
-
/**
|
13065 |
-
* Width to expand the table to when using x-scrolling. Typically you
|
13066 |
-
* should not need to use this.
|
13067 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13068 |
-
* set a default use {@link WFDataTable.defaults}.
|
13069 |
-
* @type string
|
13070 |
-
* @deprecated
|
13071 |
-
*/
|
13072 |
-
"sXInner": null,
|
13073 |
-
|
13074 |
-
/**
|
13075 |
-
* Viewport height for vertical scrolling. Vertical scrolling is disabled
|
13076 |
-
* if an empty string.
|
13077 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13078 |
-
* set a default use {@link WFDataTable.defaults}.
|
13079 |
-
* @type string
|
13080 |
-
*/
|
13081 |
-
"sY": null
|
13082 |
-
},
|
13083 |
-
|
13084 |
-
/**
|
13085 |
-
* Language information for the table.
|
13086 |
-
* @namespace
|
13087 |
-
* @extends WFDataTable.defaults.oLanguage
|
13088 |
-
*/
|
13089 |
-
"oLanguage": {
|
13090 |
-
/**
|
13091 |
-
* Information callback function. See
|
13092 |
-
* {@link WFDataTable.defaults.fnInfoCallback}
|
13093 |
-
* @type function
|
13094 |
-
* @default null
|
13095 |
-
*/
|
13096 |
-
"fnInfoCallback": null
|
13097 |
-
},
|
13098 |
-
|
13099 |
-
/**
|
13100 |
-
* Browser support parameters
|
13101 |
-
* @namespace
|
13102 |
-
*/
|
13103 |
-
"oBrowser": {
|
13104 |
-
/**
|
13105 |
-
* Indicate if the browser incorrectly calculates width:100% inside a
|
13106 |
-
* scrolling element (IE6/7)
|
13107 |
-
* @type boolean
|
13108 |
-
* @default false
|
13109 |
-
*/
|
13110 |
-
"bScrollOversize": false,
|
13111 |
-
|
13112 |
-
/**
|
13113 |
-
* Determine if the vertical scrollbar is on the right or left of the
|
13114 |
-
* scrolling container - needed for rtl language layout, although not
|
13115 |
-
* all browsers move the scrollbar (Safari).
|
13116 |
-
* @type boolean
|
13117 |
-
* @default false
|
13118 |
-
*/
|
13119 |
-
"bScrollbarLeft": false,
|
13120 |
-
|
13121 |
-
/**
|
13122 |
-
* Flag for if `getBoundingClientRect` is fully supported or not
|
13123 |
-
* @type boolean
|
13124 |
-
* @default false
|
13125 |
-
*/
|
13126 |
-
"bBounding": false,
|
13127 |
-
|
13128 |
-
/**
|
13129 |
-
* Browser scrollbar width
|
13130 |
-
* @type integer
|
13131 |
-
* @default 0
|
13132 |
-
*/
|
13133 |
-
"barWidth": 0
|
13134 |
-
},
|
13135 |
-
|
13136 |
-
|
13137 |
-
"ajax": null,
|
13138 |
-
|
13139 |
-
|
13140 |
-
/**
|
13141 |
-
* Array referencing the nodes which are used for the features. The
|
13142 |
-
* parameters of this object match what is allowed by sDom - i.e.
|
13143 |
-
* <ul>
|
13144 |
-
* <li>'l' - Length changing</li>
|
13145 |
-
* <li>'f' - Filtering input</li>
|
13146 |
-
* <li>'t' - The table!</li>
|
13147 |
-
* <li>'i' - Information</li>
|
13148 |
-
* <li>'p' - Pagination</li>
|
13149 |
-
* <li>'r' - pRocessing</li>
|
13150 |
-
* </ul>
|
13151 |
-
* @type array
|
13152 |
-
* @default []
|
13153 |
-
*/
|
13154 |
-
"aanFeatures": [],
|
13155 |
-
|
13156 |
-
/**
|
13157 |
-
* Store data information - see {@link WFDataTable.models.oRow} for detailed
|
13158 |
-
* information.
|
13159 |
-
* @type array
|
13160 |
-
* @default []
|
13161 |
-
*/
|
13162 |
-
"aoData": [],
|
13163 |
-
|
13164 |
-
/**
|
13165 |
-
* Array of indexes which are in the current display (after filtering etc)
|
13166 |
-
* @type array
|
13167 |
-
* @default []
|
13168 |
-
*/
|
13169 |
-
"aiDisplay": [],
|
13170 |
-
|
13171 |
-
/**
|
13172 |
-
* Array of indexes for display - no filtering
|
13173 |
-
* @type array
|
13174 |
-
* @default []
|
13175 |
-
*/
|
13176 |
-
"aiDisplayMaster": [],
|
13177 |
-
|
13178 |
-
/**
|
13179 |
-
* Map of row ids to data indexes
|
13180 |
-
* @type object
|
13181 |
-
* @default {}
|
13182 |
-
*/
|
13183 |
-
"aIds": {},
|
13184 |
-
|
13185 |
-
/**
|
13186 |
-
* Store information about each column that is in use
|
13187 |
-
* @type array
|
13188 |
-
* @default []
|
13189 |
-
*/
|
13190 |
-
"aoColumns": [],
|
13191 |
-
|
13192 |
-
/**
|
13193 |
-
* Store information about the table's header
|
13194 |
-
* @type array
|
13195 |
-
* @default []
|
13196 |
-
*/
|
13197 |
-
"aoHeader": [],
|
13198 |
-
|
13199 |
-
/**
|
13200 |
-
* Store information about the table's footer
|
13201 |
-
* @type array
|
13202 |
-
* @default []
|
13203 |
-
*/
|
13204 |
-
"aoFooter": [],
|
13205 |
-
|
13206 |
-
/**
|
13207 |
-
* Store the applied global search information in case we want to force a
|
13208 |
-
* research or compare the old search to a new one.
|
13209 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13210 |
-
* set a default use {@link WFDataTable.defaults}.
|
13211 |
-
* @namespace
|
13212 |
-
* @extends WFDataTable.models.oSearch
|
13213 |
-
*/
|
13214 |
-
"oPreviousSearch": {},
|
13215 |
-
|
13216 |
-
/**
|
13217 |
-
* Store the applied search for each column - see
|
13218 |
-
* {@link WFDataTable.models.oSearch} for the format that is used for the
|
13219 |
-
* filtering information for each column.
|
13220 |
-
* @type array
|
13221 |
-
* @default []
|
13222 |
-
*/
|
13223 |
-
"aoPreSearchCols": [],
|
13224 |
-
|
13225 |
-
/**
|
13226 |
-
* Sorting that is applied to the table. Note that the inner arrays are
|
13227 |
-
* used in the following manner:
|
13228 |
-
* <ul>
|
13229 |
-
* <li>Index 0 - column number</li>
|
13230 |
-
* <li>Index 1 - current sorting direction</li>
|
13231 |
-
* </ul>
|
13232 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13233 |
-
* set a default use {@link WFDataTable.defaults}.
|
13234 |
-
* @type array
|
13235 |
-
* @todo These inner arrays should really be objects
|
13236 |
-
*/
|
13237 |
-
"aaSorting": null,
|
13238 |
-
|
13239 |
-
/**
|
13240 |
-
* Sorting that is always applied to the table (i.e. prefixed in front of
|
13241 |
-
* aaSorting).
|
13242 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13243 |
-
* set a default use {@link WFDataTable.defaults}.
|
13244 |
-
* @type array
|
13245 |
-
* @default []
|
13246 |
-
*/
|
13247 |
-
"aaSortingFixed": [],
|
13248 |
-
|
13249 |
-
/**
|
13250 |
-
* Classes to use for the striping of a table.
|
13251 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13252 |
-
* set a default use {@link WFDataTable.defaults}.
|
13253 |
-
* @type array
|
13254 |
-
* @default []
|
13255 |
-
*/
|
13256 |
-
"asStripeClasses": null,
|
13257 |
-
|
13258 |
-
/**
|
13259 |
-
* If restoring a table - we should restore its striping classes as well
|
13260 |
-
* @type array
|
13261 |
-
* @default []
|
13262 |
-
*/
|
13263 |
-
"asDestroyStripes": [],
|
13264 |
-
|
13265 |
-
/**
|
13266 |
-
* If restoring a table - we should restore its width
|
13267 |
-
* @type int
|
13268 |
-
* @default 0
|
13269 |
-
*/
|
13270 |
-
"sDestroyWidth": 0,
|
13271 |
-
|
13272 |
-
/**
|
13273 |
-
* Callback functions array for every time a row is inserted (i.e. on a draw).
|
13274 |
-
* @type array
|
13275 |
-
* @default []
|
13276 |
-
*/
|
13277 |
-
"aoRowCallback": [],
|
13278 |
-
|
13279 |
-
/**
|
13280 |
-
* Callback functions for the header on each draw.
|
13281 |
-
* @type array
|
13282 |
-
* @default []
|
13283 |
-
*/
|
13284 |
-
"aoHeaderCallback": [],
|
13285 |
-
|
13286 |
-
/**
|
13287 |
-
* Callback function for the footer on each draw.
|
13288 |
-
* @type array
|
13289 |
-
* @default []
|
13290 |
-
*/
|
13291 |
-
"aoFooterCallback": [],
|
13292 |
-
|
13293 |
-
/**
|
13294 |
-
* Array of callback functions for draw callback functions
|
13295 |
-
* @type array
|
13296 |
-
* @default []
|
13297 |
-
*/
|
13298 |
-
"aoDrawCallback": [],
|
13299 |
-
|
13300 |
-
/**
|
13301 |
-
* Array of callback functions for row created function
|
13302 |
-
* @type array
|
13303 |
-
* @default []
|
13304 |
-
*/
|
13305 |
-
"aoRowCreatedCallback": [],
|
13306 |
-
|
13307 |
-
/**
|
13308 |
-
* Callback functions for just before the table is redrawn. A return of
|
13309 |
-
* false will be used to cancel the draw.
|
13310 |
-
* @type array
|
13311 |
-
* @default []
|
13312 |
-
*/
|
13313 |
-
"aoPreDrawCallback": [],
|
13314 |
-
|
13315 |
-
/**
|
13316 |
-
* Callback functions for when the table has been initialised.
|
13317 |
-
* @type array
|
13318 |
-
* @default []
|
13319 |
-
*/
|
13320 |
-
"aoInitComplete": [],
|
13321 |
-
|
13322 |
-
|
13323 |
-
/**
|
13324 |
-
* Callbacks for modifying the settings to be stored for state saving, prior to
|
13325 |
-
* saving state.
|
13326 |
-
* @type array
|
13327 |
-
* @default []
|
13328 |
-
*/
|
13329 |
-
"aoStateSaveParams": [],
|
13330 |
-
|
13331 |
-
/**
|
13332 |
-
* Callbacks for modifying the settings that have been stored for state saving
|
13333 |
-
* prior to using the stored values to restore the state.
|
13334 |
-
* @type array
|
13335 |
-
* @default []
|
13336 |
-
*/
|
13337 |
-
"aoStateLoadParams": [],
|
13338 |
-
|
13339 |
-
/**
|
13340 |
-
* Callbacks for operating on the settings object once the saved state has been
|
13341 |
-
* loaded
|
13342 |
-
* @type array
|
13343 |
-
* @default []
|
13344 |
-
*/
|
13345 |
-
"aoStateLoaded": [],
|
13346 |
-
|
13347 |
-
/**
|
13348 |
-
* Cache the table ID for quick access
|
13349 |
-
* @type string
|
13350 |
-
* @default <i>Empty string</i>
|
13351 |
-
*/
|
13352 |
-
"sTableId": "",
|
13353 |
-
|
13354 |
-
/**
|
13355 |
-
* The TABLE node for the main table
|
13356 |
-
* @type node
|
13357 |
-
* @default null
|
13358 |
-
*/
|
13359 |
-
"nTable": null,
|
13360 |
-
|
13361 |
-
/**
|
13362 |
-
* Permanent ref to the thead element
|
13363 |
-
* @type node
|
13364 |
-
* @default null
|
13365 |
-
*/
|
13366 |
-
"nTHead": null,
|
13367 |
-
|
13368 |
-
/**
|
13369 |
-
* Permanent ref to the tfoot element - if it exists
|
13370 |
-
* @type node
|
13371 |
-
* @default null
|
13372 |
-
*/
|
13373 |
-
"nTFoot": null,
|
13374 |
-
|
13375 |
-
/**
|
13376 |
-
* Permanent ref to the tbody element
|
13377 |
-
* @type node
|
13378 |
-
* @default null
|
13379 |
-
*/
|
13380 |
-
"nTBody": null,
|
13381 |
-
|
13382 |
-
/**
|
13383 |
-
* Cache the wrapper node (contains all WFDataTables controlled elements)
|
13384 |
-
* @type node
|
13385 |
-
* @default null
|
13386 |
-
*/
|
13387 |
-
"nTableWrapper": null,
|
13388 |
-
|
13389 |
-
/**
|
13390 |
-
* Indicate if when using server-side processing the loading of data
|
13391 |
-
* should be deferred until the second draw.
|
13392 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13393 |
-
* set a default use {@link WFDataTable.defaults}.
|
13394 |
-
* @type boolean
|
13395 |
-
* @default false
|
13396 |
-
*/
|
13397 |
-
"bDeferLoading": false,
|
13398 |
-
|
13399 |
-
/**
|
13400 |
-
* Indicate if all required information has been read in
|
13401 |
-
* @type boolean
|
13402 |
-
* @default false
|
13403 |
-
*/
|
13404 |
-
"bInitialised": false,
|
13405 |
-
|
13406 |
-
/**
|
13407 |
-
* Information about open rows. Each object in the array has the parameters
|
13408 |
-
* 'nTr' and 'nParent'
|
13409 |
-
* @type array
|
13410 |
-
* @default []
|
13411 |
-
*/
|
13412 |
-
"aoOpenRows": [],
|
13413 |
-
|
13414 |
-
/**
|
13415 |
-
* Dictate the positioning of WFDataTables' control elements - see
|
13416 |
-
* {@link WFDataTable.model.oInit.sDom}.
|
13417 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13418 |
-
* set a default use {@link WFDataTable.defaults}.
|
13419 |
-
* @type string
|
13420 |
-
* @default null
|
13421 |
-
*/
|
13422 |
-
"sDom": null,
|
13423 |
-
|
13424 |
-
/**
|
13425 |
-
* Search delay (in mS)
|
13426 |
-
* @type integer
|
13427 |
-
* @default null
|
13428 |
-
*/
|
13429 |
-
"searchDelay": null,
|
13430 |
-
|
13431 |
-
/**
|
13432 |
-
* Which type of pagination should be used.
|
13433 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13434 |
-
* set a default use {@link WFDataTable.defaults}.
|
13435 |
-
* @type string
|
13436 |
-
* @default two_button
|
13437 |
-
*/
|
13438 |
-
"sPaginationType": "two_button",
|
13439 |
-
|
13440 |
-
/**
|
13441 |
-
* The state duration (for `stateSave`) in seconds.
|
13442 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13443 |
-
* set a default use {@link WFDataTable.defaults}.
|
13444 |
-
* @type int
|
13445 |
-
* @default 0
|
13446 |
-
*/
|
13447 |
-
"iStateDuration": 0,
|
13448 |
-
|
13449 |
-
/**
|
13450 |
-
* Array of callback functions for state saving. Each array element is an
|
13451 |
-
* object with the following parameters:
|
13452 |
-
* <ul>
|
13453 |
-
* <li>function:fn - function to call. Takes two parameters, oSettings
|
13454 |
-
* and the JSON string to save that has been thus far created. Returns
|
13455 |
-
* a JSON string to be inserted into a json object
|
13456 |
-
* (i.e. '"param": [ 0, 1, 2]')</li>
|
13457 |
-
* <li>string:sName - name of callback</li>
|
13458 |
-
* </ul>
|
13459 |
-
* @type array
|
13460 |
-
* @default []
|
13461 |
-
*/
|
13462 |
-
"aoStateSave": [],
|
13463 |
-
|
13464 |
-
/**
|
13465 |
-
* Array of callback functions for state loading. Each array element is an
|
13466 |
-
* object with the following parameters:
|
13467 |
-
* <ul>
|
13468 |
-
* <li>function:fn - function to call. Takes two parameters, oSettings
|
13469 |
-
* and the object stored. May return false to cancel state loading</li>
|
13470 |
-
* <li>string:sName - name of callback</li>
|
13471 |
-
* </ul>
|
13472 |
-
* @type array
|
13473 |
-
* @default []
|
13474 |
-
*/
|
13475 |
-
"aoStateLoad": [],
|
13476 |
-
|
13477 |
-
/**
|
13478 |
-
* State that was saved. Useful for back reference
|
13479 |
-
* @type object
|
13480 |
-
* @default null
|
13481 |
-
*/
|
13482 |
-
"oSavedState": null,
|
13483 |
-
|
13484 |
-
/**
|
13485 |
-
* State that was loaded. Useful for back reference
|
13486 |
-
* @type object
|
13487 |
-
* @default null
|
13488 |
-
*/
|
13489 |
-
"oLoadedState": null,
|
13490 |
-
|
13491 |
-
/**
|
13492 |
-
* Source url for AJAX data for the table.
|
13493 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13494 |
-
* set a default use {@link WFDataTable.defaults}.
|
13495 |
-
* @type string
|
13496 |
-
* @default null
|
13497 |
-
*/
|
13498 |
-
"sAjaxSource": null,
|
13499 |
-
|
13500 |
-
/**
|
13501 |
-
* Property from a given object from which to read the table data from. This
|
13502 |
-
* can be an empty string (when not server-side processing), in which case
|
13503 |
-
* it is assumed an an array is given directly.
|
13504 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13505 |
-
* set a default use {@link WFDataTable.defaults}.
|
13506 |
-
* @type string
|
13507 |
-
*/
|
13508 |
-
"sAjaxDataProp": null,
|
13509 |
-
|
13510 |
-
/**
|
13511 |
-
* Note if draw should be blocked while getting data
|
13512 |
-
* @type boolean
|
13513 |
-
* @default true
|
13514 |
-
*/
|
13515 |
-
"bAjaxDataGet": true,
|
13516 |
-
|
13517 |
-
/**
|
13518 |
-
* The last jQuery XHR object that was used for server-side data gathering.
|
13519 |
-
* This can be used for working with the XHR information in one of the
|
13520 |
-
* callbacks
|
13521 |
-
* @type object
|
13522 |
-
* @default null
|
13523 |
-
*/
|
13524 |
-
"jqXHR": null,
|
13525 |
-
|
13526 |
-
/**
|
13527 |
-
* JSON returned from the server in the last Ajax request
|
13528 |
-
* @type object
|
13529 |
-
* @default undefined
|
13530 |
-
*/
|
13531 |
-
"json": undefined,
|
13532 |
-
|
13533 |
-
/**
|
13534 |
-
* Data submitted as part of the last Ajax request
|
13535 |
-
* @type object
|
13536 |
-
* @default undefined
|
13537 |
-
*/
|
13538 |
-
"oAjaxData": undefined,
|
13539 |
-
|
13540 |
-
/**
|
13541 |
-
* Function to get the server-side data.
|
13542 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13543 |
-
* set a default use {@link WFDataTable.defaults}.
|
13544 |
-
* @type function
|
13545 |
-
*/
|
13546 |
-
"fnServerData": null,
|
13547 |
-
|
13548 |
-
/**
|
13549 |
-
* Functions which are called prior to sending an Ajax request so extra
|
13550 |
-
* parameters can easily be sent to the server
|
13551 |
-
* @type array
|
13552 |
-
* @default []
|
13553 |
-
*/
|
13554 |
-
"aoServerParams": [],
|
13555 |
-
|
13556 |
-
/**
|
13557 |
-
* Send the XHR HTTP method - GET or POST (could be PUT or DELETE if
|
13558 |
-
* required).
|
13559 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13560 |
-
* set a default use {@link WFDataTable.defaults}.
|
13561 |
-
* @type string
|
13562 |
-
*/
|
13563 |
-
"sServerMethod": null,
|
13564 |
-
|
13565 |
-
/**
|
13566 |
-
* Format numbers for display.
|
13567 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13568 |
-
* set a default use {@link WFDataTable.defaults}.
|
13569 |
-
* @type function
|
13570 |
-
*/
|
13571 |
-
"fnFormatNumber": null,
|
13572 |
-
|
13573 |
-
/**
|
13574 |
-
* List of options that can be used for the user selectable length menu.
|
13575 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13576 |
-
* set a default use {@link WFDataTable.defaults}.
|
13577 |
-
* @type array
|
13578 |
-
* @default []
|
13579 |
-
*/
|
13580 |
-
"aLengthMenu": null,
|
13581 |
-
|
13582 |
-
/**
|
13583 |
-
* Counter for the draws that the table does. Also used as a tracker for
|
13584 |
-
* server-side processing
|
13585 |
-
* @type int
|
13586 |
-
* @default 0
|
13587 |
-
*/
|
13588 |
-
"iDraw": 0,
|
13589 |
-
|
13590 |
-
/**
|
13591 |
-
* Indicate if a redraw is being done - useful for Ajax
|
13592 |
-
* @type boolean
|
13593 |
-
* @default false
|
13594 |
-
*/
|
13595 |
-
"bDrawing": false,
|
13596 |
-
|
13597 |
-
/**
|
13598 |
-
* Draw index (iDraw) of the last error when parsing the returned data
|
13599 |
-
* @type int
|
13600 |
-
* @default -1
|
13601 |
-
*/
|
13602 |
-
"iDrawError": -1,
|
13603 |
-
|
13604 |
-
/**
|
13605 |
-
* Paging display length
|
13606 |
-
* @type int
|
13607 |
-
* @default 10
|
13608 |
-
*/
|
13609 |
-
"_iDisplayLength": 10,
|
13610 |
-
|
13611 |
-
/**
|
13612 |
-
* Paging start point - aiDisplay index
|
13613 |
-
* @type int
|
13614 |
-
* @default 0
|
13615 |
-
*/
|
13616 |
-
"_iDisplayStart": 0,
|
13617 |
-
|
13618 |
-
/**
|
13619 |
-
* Server-side processing - number of records in the result set
|
13620 |
-
* (i.e. before filtering), Use fnRecordsTotal rather than
|
13621 |
-
* this property to get the value of the number of records, regardless of
|
13622 |
-
* the server-side processing setting.
|
13623 |
-
* @type int
|
13624 |
-
* @default 0
|
13625 |
-
* @private
|
13626 |
-
*/
|
13627 |
-
"_iRecordsTotal": 0,
|
13628 |
-
|
13629 |
-
/**
|
13630 |
-
* Server-side processing - number of records in the current display set
|
13631 |
-
* (i.e. after filtering). Use fnRecordsDisplay rather than
|
13632 |
-
* this property to get the value of the number of records, regardless of
|
13633 |
-
* the server-side processing setting.
|
13634 |
-
* @type boolean
|
13635 |
-
* @default 0
|
13636 |
-
* @private
|
13637 |
-
*/
|
13638 |
-
"_iRecordsDisplay": 0,
|
13639 |
-
|
13640 |
-
/**
|
13641 |
-
* Flag to indicate if jQuery UI marking and classes should be used.
|
13642 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13643 |
-
* set a default use {@link WFDataTable.defaults}.
|
13644 |
-
* @type boolean
|
13645 |
-
*/
|
13646 |
-
"bJUI": null,
|
13647 |
-
|
13648 |
-
/**
|
13649 |
-
* The classes to use for the table
|
13650 |
-
* @type object
|
13651 |
-
* @default {}
|
13652 |
-
*/
|
13653 |
-
"oClasses": {},
|
13654 |
-
|
13655 |
-
/**
|
13656 |
-
* Flag attached to the settings object so you can check in the draw
|
13657 |
-
* callback if filtering has been done in the draw. Deprecated in favour of
|
13658 |
-
* events.
|
13659 |
-
* @type boolean
|
13660 |
-
* @default false
|
13661 |
-
* @deprecated
|
13662 |
-
*/
|
13663 |
-
"bFiltered": false,
|
13664 |
-
|
13665 |
-
/**
|
13666 |
-
* Flag attached to the settings object so you can check in the draw
|
13667 |
-
* callback if sorting has been done in the draw. Deprecated in favour of
|
13668 |
-
* events.
|
13669 |
-
* @type boolean
|
13670 |
-
* @default false
|
13671 |
-
* @deprecated
|
13672 |
-
*/
|
13673 |
-
"bSorted": false,
|
13674 |
-
|
13675 |
-
/**
|
13676 |
-
* Indicate that if multiple rows are in the header and there is more than
|
13677 |
-
* one unique cell per column, if the top one (true) or bottom one (false)
|
13678 |
-
* should be used for sorting / title by WFDataTables.
|
13679 |
-
* Note that this parameter will be set by the initialisation routine. To
|
13680 |
-
* set a default use {@link WFDataTable.defaults}.
|
13681 |
-
* @type boolean
|
13682 |
-
*/
|
13683 |
-
"bSortCellsTop": null,
|
13684 |
-
|
13685 |
-
/**
|
13686 |
-
* Initialisation object that is used for the table
|
13687 |
-
* @type object
|
13688 |
-
* @default null
|
13689 |
-
*/
|
13690 |
-
"oInit": null,
|
13691 |
-
|
13692 |
-
/**
|
13693 |
-
* Destroy callback functions - for plug-ins to attach themselves to the
|
13694 |
-
* destroy so they can clean up markup and events.
|
13695 |
-
* @type array
|
13696 |
-
* @default []
|
13697 |
-
*/
|
13698 |
-
"aoDestroyCallback": [],
|
13699 |
-
|
13700 |
-
|
13701 |
-
/**
|
13702 |
-
* Get the number of records in the current record set, before filtering
|
13703 |
-
* @type function
|
13704 |
-
*/
|
13705 |
-
"fnRecordsTotal": function ()
|
13706 |
-
{
|
13707 |
-
return _fnDataSource( this ) == 'ssp' ?
|
13708 |
-
this._iRecordsTotal * 1 :
|
13709 |
-
this.aiDisplayMaster.length;
|
13710 |
-
},
|
13711 |
-
|
13712 |
-
/**
|
13713 |
-
* Get the number of records in the current record set, after filtering
|
13714 |
-
* @type function
|
13715 |
-
*/
|
13716 |
-
"fnRecordsDisplay": function ()
|
13717 |
-
{
|
13718 |
-
return _fnDataSource( this ) == 'ssp' ?
|
13719 |
-
this._iRecordsDisplay * 1 :
|
13720 |
-
this.aiDisplay.length;
|
13721 |
-
},
|
13722 |
-
|
13723 |
-
/**
|
13724 |
-
* Get the display end point - aiDisplay index
|
13725 |
-
* @type function
|
13726 |
-
*/
|
13727 |
-
"fnDisplayEnd": function ()
|
13728 |
-
{
|
13729 |
-
var
|
13730 |
-
len = this._iDisplayLength,
|
13731 |
-
start = this._iDisplayStart,
|
13732 |
-
calc = start + len,
|
13733 |
-
records = this.aiDisplay.length,
|
13734 |
-
features = this.oFeatures,
|
13735 |
-
paginate = features.bPaginate;
|
13736 |
-
|
13737 |
-
if ( features.bServerSide ) {
|
13738 |
-
return paginate === false || len === -1 ?
|
13739 |
-
start + records :
|
13740 |
-
Math.min( start+len, this._iRecordsDisplay );
|
13741 |
-
}
|
13742 |
-
else {
|
13743 |
-
return ! paginate || calc>records || len===-1 ?
|
13744 |
-
records :
|
13745 |
-
calc;
|
13746 |
-
}
|
13747 |
-
},
|
13748 |
-
|
13749 |
-
/**
|
13750 |
-
* The WFDataTables object for this table
|
13751 |
-
* @type object
|
13752 |
-
* @default null
|
13753 |
-
*/
|
13754 |
-
"oInstance": null,
|
13755 |
-
|
13756 |
-
/**
|
13757 |
-
* Unique identifier for each instance of the WFDataTables object. If there
|
13758 |
-
* is an ID on the table node, then it takes that value, otherwise an
|
13759 |
-
* incrementing internal counter is used.
|
13760 |
-
* @type string
|
13761 |
-
* @default null
|
13762 |
-
*/
|
13763 |
-
"sInstance": null,
|
13764 |
-
|
13765 |
-
/**
|
13766 |
-
* tabindex attribute value that is added to WFDataTables control elements, allowing
|
13767 |
-
* keyboard navigation of the table and its controls.
|
13768 |
-
*/
|
13769 |
-
"iTabIndex": 0,
|
13770 |
-
|
13771 |
-
/**
|
13772 |
-
* DIV container for the footer scrolling table if scrolling
|
13773 |
-
*/
|
13774 |
-
"nScrollHead": null,
|
13775 |
-
|
13776 |
-
/**
|
13777 |
-
* DIV container for the footer scrolling table if scrolling
|
13778 |
-
*/
|
13779 |
-
"nScrollFoot": null,
|
13780 |
-
|
13781 |
-
/**
|
13782 |
-
* Last applied sort
|
13783 |
-
* @type array
|
13784 |
-
* @default []
|
13785 |
-
*/
|
13786 |
-
"aLastSort": [],
|
13787 |
-
|
13788 |
-
/**
|
13789 |
-
* Stored plug-in instances
|
13790 |
-
* @type object
|
13791 |
-
* @default {}
|
13792 |
-
*/
|
13793 |
-
"oPlugins": {},
|
13794 |
-
|
13795 |
-
/**
|
13796 |
-
* Function used to get a row's id from the row's data
|
13797 |
-
* @type function
|
13798 |
-
* @default null
|
13799 |
-
*/
|
13800 |
-
"rowIdFn": null,
|
13801 |
-
|
13802 |
-
/**
|
13803 |
-
* Data location where to store a row's id
|
13804 |
-
* @type string
|
13805 |
-
* @default null
|
13806 |
-
*/
|
13807 |
-
"rowId": null
|
13808 |
-
};
|
13809 |
-
|
13810 |
-
/**
|
13811 |
-
* Extension object for WFDataTables that is used to provide all extension
|
13812 |
-
* options.
|
13813 |
-
*
|
13814 |
-
* Note that the `WFDataTable.ext` object is available through
|
13815 |
-
* `jQuery.fn.wfDataTable.ext` where it may be accessed and manipulated. It is
|
13816 |
-
* also aliased to `jQuery.fn.wfDataTableExt` for historic reasons.
|
13817 |
-
* @namespace
|
13818 |
-
* @extends WFDataTable.models.ext
|
13819 |
-
*/
|
13820 |
-
|
13821 |
-
|
13822 |
-
/**
|
13823 |
-
* WFDataTables extensions
|
13824 |
-
*
|
13825 |
-
* This namespace acts as a collection area for plug-ins that can be used to
|
13826 |
-
* extend WFDataTables capabilities. Indeed many of the build in methods
|
13827 |
-
* use this method to provide their own capabilities (sorting methods for
|
13828 |
-
* example).
|
13829 |
-
*
|
13830 |
-
* Note that this namespace is aliased to `jQuery.fn.wfDataTableExt` for legacy
|
13831 |
-
* reasons
|
13832 |
-
*
|
13833 |
-
* @namespace
|
13834 |
-
*/
|
13835 |
-
WFDataTable.ext = _ext = {
|
13836 |
-
/**
|
13837 |
-
* Buttons. For use with the Buttons extension for WFDataTables. This is
|
13838 |
-
* defined here so other extensions can define buttons regardless of load
|
13839 |
-
* order. It is _not_ used by WFDataTables core.
|
13840 |
-
*
|
13841 |
-
* @type object
|
13842 |
-
* @default {}
|
13843 |
-
*/
|
13844 |
-
buttons: {},
|
13845 |
-
|
13846 |
-
|
13847 |
-
/**
|
13848 |
-
* Element class names
|
13849 |
-
*
|
13850 |
-
* @type object
|
13851 |
-
* @default {}
|
13852 |
-
*/
|
13853 |
-
classes: {},
|
13854 |
-
|
13855 |
-
|
13856 |
-
/**
|
13857 |
-
* WFDataTables build type (expanded by the download builder)
|
13858 |
-
*
|
13859 |
-
* @type string
|
13860 |
-
*/
|
13861 |
-
build:"dt/dt-1.10.13",
|
13862 |
-
|
13863 |
-
|
13864 |
-
/**
|
13865 |
-
* Error reporting.
|
13866 |
-
*
|
13867 |
-
* How should WFDataTables report an error. Can take the value 'alert',
|
13868 |
-
* 'throw', 'none' or a function.
|
13869 |
-
*
|
13870 |
-
* @type string|function
|
13871 |
-
* @default alert
|
13872 |
-
*/
|
13873 |
-
errMode: "alert",
|
13874 |
-
|
13875 |
-
|
13876 |
-
/**
|
13877 |
-
* Feature plug-ins.
|
13878 |
-
*
|
13879 |
-
* This is an array of objects which describe the feature plug-ins that are
|
13880 |
-
* available to WFDataTables. These feature plug-ins are then available for
|
13881 |
-
* use through the `dom` initialisation option.
|
13882 |
-
*
|
13883 |
-
* Each feature plug-in is described by an object which must have the
|
13884 |
-
* following properties:
|
13885 |
-
*
|
13886 |
-
* * `fnInit` - function that is used to initialise the plug-in,
|
13887 |
-
* * `cFeature` - a character so the feature can be enabled by the `dom`
|
13888 |
-
* instillation option. This is case sensitive.
|
13889 |
-
*
|
13890 |
-
* The `fnInit` function has the following input parameters:
|
13891 |
-
*
|
13892 |
-
* 1. `{object}` WFDataTables settings object: see
|
13893 |
-
* {@link WFDataTable.models.oSettings}
|
13894 |
-
*
|
13895 |
-
* And the following return is expected:
|
13896 |
-
*
|
13897 |
-
* * {node|null} The element which contains your feature. Note that the
|
13898 |
-
* return may also be void if your plug-in does not require to inject any
|
13899 |
-
* DOM elements into WFDataTables control (`dom`) - for example this might
|
13900 |
-
* be useful when developing a plug-in which allows table control via
|
13901 |
-
* keyboard entry
|
13902 |
-
*
|
13903 |
-
* @type array
|
13904 |
-
*
|
13905 |
-
* @example
|
13906 |
-
* $.fn.wfDataTable.ext.features.push( {
|
13907 |
-
* "fnInit": function( oSettings ) {
|
13908 |
-
* return new TableTools( { "oDTSettings": oSettings } );
|
13909 |
-
* },
|
13910 |
-
* "cFeature": "T"
|
13911 |
-
* } );
|
13912 |
-
*/
|
13913 |
-
feature: [],
|
13914 |
-
|
13915 |
-
|
13916 |
-
/**
|
13917 |
-
* Row searching.
|
13918 |
-
*
|
13919 |
-
* This method of searching is complimentary to the default type based
|
13920 |
-
* searching, and a lot more comprehensive as it allows you complete control
|
13921 |
-
* over the searching logic. Each element in this array is a function
|
13922 |
-
* (parameters described below) that is called for every row in the table,
|
13923 |
-
* and your logic decides if it should be included in the searching data set
|
13924 |
-
* or not.
|
13925 |
-
*
|
13926 |
-
* Searching functions have the following input parameters:
|
13927 |
-
*
|
13928 |
-
* 1. `{object}` WFDataTables settings object: see
|
13929 |
-
* {@link WFDataTable.models.oSettings}
|
13930 |
-
* 2. `{array|object}` Data for the row to be processed (same as the
|
13931 |
-
* original format that was passed in as the data source, or an array
|
13932 |
-
* from a DOM data source
|
13933 |
-
* 3. `{int}` Row index ({@link WFDataTable.models.oSettings.aoData}), which
|
13934 |
-
* can be useful to retrieve the `TR` element if you need DOM interaction.
|
13935 |
-
*
|
13936 |
-
* And the following return is expected:
|
13937 |
-
*
|
13938 |
-
* * {boolean} Include the row in the searched result set (true) or not
|
13939 |
-
* (false)
|
13940 |
-
*
|
13941 |
-
* Note that as with the main search ability in WFDataTables, technically this
|
13942 |
-
* is "filtering", since it is subtractive. However, for consistency in
|
13943 |
-
* naming we call it searching here.
|
13944 |
-
*
|
13945 |
-
* @type array
|
13946 |
-
* @default []
|
13947 |
-
*
|
13948 |
-
* @example
|
13949 |
-
* // The following example shows custom search being applied to the
|
13950 |
-
* // fourth column (i.e. the data[3] index) based on two input values
|
13951 |
-
* // from the end-user, matching the data in a certain range.
|
13952 |
-
* $.fn.wfDataTable.ext.search.push(
|
13953 |
-
* function( settings, data, dataIndex ) {
|
13954 |
-
* var min = document.getElementById('min').value * 1;
|
13955 |
-
* var max = document.getElementById('max').value * 1;
|
13956 |
-
* var version = data[3] == "-" ? 0 : data[3]*1;
|
13957 |
-
*
|
13958 |
-
* if ( min == "" && max == "" ) {
|
13959 |
-
* return true;
|
13960 |
-
* }
|
13961 |
-
* else if ( min == "" && version < max ) {
|
13962 |
-
* return true;
|
13963 |
-
* }
|
13964 |
-
* else if ( min < version && "" == max ) {
|
13965 |
-
* return true;
|
13966 |
-
* }
|
13967 |
-
* else if ( min < version && version < max ) {
|
13968 |
-
* return true;
|
13969 |
-
* }
|
13970 |
-
* return false;
|
13971 |
-
* }
|
13972 |
-
* );
|
13973 |
-
*/
|
13974 |
-
search: [],
|
13975 |
-
|
13976 |
-
|
13977 |
-
/**
|
13978 |
-
* Selector extensions
|
13979 |
-
*
|
13980 |
-
* The `selector` option can be used to extend the options available for the
|
13981 |
-
* selector modifier options (`selector-modifier` object data type) that
|
13982 |
-
* each of the three built in selector types offer (row, column and cell +
|
13983 |
-
* their plural counterparts). For example the Select extension uses this
|
13984 |
-
* mechanism to provide an option to select only rows, columns and cells
|
13985 |
-
* that have been marked as selected by the end user (`{selected: true}`),
|
13986 |
-
* which can be used in conjunction with the existing built in selector
|
13987 |
-
* options.
|
13988 |
-
*
|
13989 |
-
* Each property is an array to which functions can be pushed. The functions
|
13990 |
-
* take three attributes:
|
13991 |
-
*
|
13992 |
-
* * Settings object for the host table
|
13993 |
-
* * Options object (`selector-modifier` object type)
|
13994 |
-
* * Array of selected item indexes
|
13995 |
-
*
|
13996 |
-
* The return is an array of the resulting item indexes after the custom
|
13997 |
-
* selector has been applied.
|
13998 |
-
*
|
13999 |
-
* @type object
|
14000 |
-
*/
|
14001 |
-
selector: {
|
14002 |
-
cell: [],
|
14003 |
-
column: [],
|
14004 |
-
row: []
|
14005 |
-
},
|
14006 |
-
|
14007 |
-
|
14008 |
-
/**
|
14009 |
-
* Internal functions, exposed for used in plug-ins.
|
14010 |
-
*
|
14011 |
-
* Please note that you should not need to use the internal methods for
|
14012 |
-
* anything other than a plug-in (and even then, try to avoid if possible).
|
14013 |
-
* The internal function may change between releases.
|
14014 |
-
*
|
14015 |
-
* @type object
|
14016 |
-
* @default {}
|
14017 |
-
*/
|
14018 |
-
internal: {},
|
14019 |
-
|
14020 |
-
|
14021 |
-
/**
|
14022 |
-
* Legacy configuration options. Enable and disable legacy options that
|
14023 |
-
* are available in WFDataTables.
|
14024 |
-
*
|
14025 |
-
* @type object
|
14026 |
-
*/
|
14027 |
-
legacy: {
|
14028 |
-
/**
|
14029 |
-
* Enable / disable WFDataTables 1.9 compatible server-side processing
|
14030 |
-
* requests
|
14031 |
-
*
|
14032 |
-
* @type boolean
|
14033 |
-
* @default null
|
14034 |
-
*/
|
14035 |
-
ajax: null
|
14036 |
-
},
|
14037 |
-
|
14038 |
-
|
14039 |
-
/**
|
14040 |
-
* Pagination plug-in methods.
|
14041 |
-
*
|
14042 |
-
* Each entry in this object is a function and defines which buttons should
|
14043 |
-
* be shown by the pagination rendering method that is used for the table:
|
14044 |
-
* {@link WFDataTable.ext.renderer.pageButton}. The renderer addresses how the
|
14045 |
-
* buttons are displayed in the document, while the functions here tell it
|
14046 |
-
* what buttons to display. This is done by returning an array of button
|
14047 |
-
* descriptions (what each button will do).
|
14048 |
-
*
|
14049 |
-
* Pagination types (the four built in options and any additional plug-in
|
14050 |
-
* options defined here) can be used through the `paginationType`
|
14051 |
-
* initialisation parameter.
|
14052 |
-
*
|
14053 |
-
* The functions defined take two parameters:
|
14054 |
-
*
|
14055 |
-
* 1. `{int} page` The current page index
|
14056 |
-
* 2. `{int} pages` The number of pages in the table
|
14057 |
-
*
|
14058 |
-
* Each function is expected to return an array where each element of the
|
14059 |
-
* array can be one of:
|
14060 |
-
*
|
14061 |
-
* * `first` - Jump to first page when activated
|
14062 |
-
* * `last` - Jump to last page when activated
|
14063 |
-
* * `previous` - Show previous page when activated
|
14064 |
-
* * `next` - Show next page when activated
|
14065 |
-
* * `{int}` - Show page of the index given
|
14066 |
-
* * `{array}` - A nested array containing the above elements to add a
|
14067 |
-
* containing 'DIV' element (might be useful for styling).
|
14068 |
-
*
|
14069 |
-
* Note that WFDataTables v1.9- used this object slightly differently whereby
|
14070 |
-
* an object with two functions would be defined for each plug-in. That
|
14071 |
-
* ability is still supported by WFDataTables 1.10+ to provide backwards
|
14072 |
-
* compatibility, but this option of use is now decremented and no longer
|
14073 |
-
* documented in WFDataTables 1.10+.
|
14074 |
-
*
|
14075 |
-
* @type object
|
14076 |
-
* @default {}
|
14077 |
-
*
|
14078 |
-
* @example
|
14079 |
-
* // Show previous, next and current page buttons only
|
14080 |
-
* $.fn.wfDataTableExt.oPagination.current = function ( page, pages ) {
|
14081 |
-
* return [ 'previous', page, 'next' ];
|
14082 |
-
* };
|
14083 |
-
*/
|
14084 |
-
pager: {},
|
14085 |
-
|
14086 |
-
|
14087 |
-
renderer: {
|
14088 |
-
pageButton: {},
|
14089 |
-
header: {}
|
14090 |
-
},
|
14091 |
-
|
14092 |
-
|
14093 |
-
/**
|
14094 |
-
* Ordering plug-ins - custom data source
|
14095 |
-
*
|
14096 |
-
* The extension options for ordering of data available here is complimentary
|
14097 |
-
* to the default type based ordering that WFDataTables typically uses. It
|
14098 |
-
* allows much greater control over the the data that is being used to
|
14099 |
-
* order a column, but is necessarily therefore more complex.
|
14100 |
-
*
|
14101 |
-
* This type of ordering is useful if you want to do ordering based on data
|
14102 |
-
* live from the DOM (for example the contents of an 'input' element) rather
|
14103 |
-
* than just the static string that WFDataTables knows of.
|
14104 |
-
*
|
14105 |
-
* The way these plug-ins work is that you create an array of the values you
|
14106 |
-
* wish to be ordering for the column in question and then return that
|
14107 |
-
* array. The data in the array much be in the index order of the rows in
|
14108 |
-
* the table (not the currently ordering order!). Which order data gathering
|
14109 |
-
* function is run here depends on the `dt-init columns.orderDataType`
|
14110 |
-
* parameter that is used for the column (if any).
|
14111 |
-
*
|
14112 |
-
* The functions defined take two parameters:
|
14113 |
-
*
|
14114 |
-
* 1. `{object}` WFDataTables settings object: see
|
14115 |
-
* {@link WFDataTable.models.oSettings}
|
14116 |
-
* 2. `{int}` Target column index
|
14117 |
-
*
|
14118 |
-
* Each function is expected to return an array:
|
14119 |
-
*
|
14120 |
-
* * `{array}` Data for the column to be ordering upon
|
14121 |
-
*
|
14122 |
-
* @type array
|
14123 |
-
*
|
14124 |
-
* @example
|
14125 |
-
* // Ordering using `input` node values
|
14126 |
-
* $.fn.wfDataTable.ext.order['dom-text'] = function ( settings, col )
|
14127 |
-
* {
|
14128 |
-
* return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
|
14129 |
-
* return $('input', td).val();
|
14130 |
-
* } );
|
14131 |
-
* }
|
14132 |
-
*/
|
14133 |
-
order: {},
|
14134 |
-
|
14135 |
-
|
14136 |
-
/**
|
14137 |
-
* Type based plug-ins.
|
14138 |
-
*
|
14139 |
-
* Each column in WFDataTables has a type assigned to it, either by automatic
|
14140 |
-
* detection or by direct assignment using the `type` option for the column.
|
14141 |
-
* The type of a column will effect how it is ordering and search (plug-ins
|
14142 |
-
* can also make use of the column type if required).
|
14143 |
-
*
|
14144 |
-
* @namespace
|
14145 |
-
*/
|
14146 |
-
type: {
|
14147 |
-
/**
|
14148 |
-
* Type detection functions.
|
14149 |
-
*
|
14150 |
-
* The functions defined in this object are used to automatically detect
|
14151 |
-
* a column's type, making initialisation of WFDataTables super easy, even
|
14152 |
-
* when complex data is in the table.
|
14153 |
-
*
|
14154 |
-
* The functions defined take two parameters:
|
14155 |
-
*
|
14156 |
-
* 1. `{*}` Data from the column cell to be analysed
|
14157 |
-
* 2. `{settings}` WFDataTables settings object. This can be used to
|
14158 |
-
* perform context specific type detection - for example detection
|
14159 |
-
* based on language settings such as using a comma for a decimal
|
14160 |
-
* place. Generally speaking the options from the settings will not
|
14161 |
-
* be required
|
14162 |
-
*
|
14163 |
-
* Each function is expected to return:
|
14164 |
-
*
|
14165 |
-
* * `{string|null}` Data type detected, or null if unknown (and thus
|
14166 |
-
* pass it on to the other type detection functions.
|
14167 |
-
*
|
14168 |
-
* @type array
|
14169 |
-
*
|
14170 |
-
* @example
|
14171 |
-
* // Currency type detection plug-in:
|
14172 |
-
* $.fn.wfDataTable.ext.type.detect.push(
|
14173 |
-
* function ( data, settings ) {
|
14174 |
-
* // Check the numeric part
|
14175 |
-
* if ( ! $.isNumeric( data.substring(1) ) ) {
|
14176 |
-
* return null;
|
14177 |
-
* }
|
14178 |
-
*
|
14179 |
-
* // Check prefixed by currency
|
14180 |
-
* if ( data.charAt(0) == '$' || data.charAt(0) == '£' ) {
|
14181 |
-
* return 'currency';
|
14182 |
-
* }
|
14183 |
-
* return null;
|
14184 |
-
* }
|
14185 |
-
* );
|
14186 |
-
*/
|
14187 |
-
detect: [],
|
14188 |
-
|
14189 |
-
|
14190 |
-
/**
|
14191 |
-
* Type based search formatting.
|
14192 |
-
*
|
14193 |
-
* The type based searching functions can be used to pre-format the
|
14194 |
-
* data to be search on. For example, it can be used to strip HTML
|
14195 |
-
* tags or to de-format telephone numbers for numeric only searching.
|
14196 |
-
*
|
14197 |
-
* Note that is a search is not defined for a column of a given type,
|
14198 |
-
* no search formatting will be performed.
|
14199 |
-
*
|
14200 |
-
* Pre-processing of searching data plug-ins - When you assign the sType
|
14201 |
-
* for a column (or have it automatically detected for you by WFDataTables
|
14202 |
-
* or a type detection plug-in), you will typically be using this for
|
14203 |
-
* custom sorting, but it can also be used to provide custom searching
|
14204 |
-
* by allowing you to pre-processing the data and returning the data in
|
14205 |
-
* the format that should be searched upon. This is done by adding
|
14206 |
-
* functions this object with a parameter name which matches the sType
|
14207 |
-
* for that target column. This is the corollary of <i>afnSortData</i>
|
14208 |
-
* for searching data.
|
14209 |
-
*
|
14210 |
-
* The functions defined take a single parameter:
|
14211 |
-
*
|
14212 |
-
* 1. `{*}` Data from the column cell to be prepared for searching
|
14213 |
-
*
|
14214 |
-
* Each function is expected to return:
|
14215 |
-
*
|
14216 |
-
* * `{string|null}` Formatted string that will be used for the searching.
|
14217 |
-
*
|
14218 |
-
* @type object
|
14219 |
-
* @default {}
|
14220 |
-
*
|
14221 |
-
* @example
|
14222 |
-
* $.fn.wfDataTable.ext.type.search['title-numeric'] = function ( d ) {
|
14223 |
-
* return d.replace(/\n/g," ").replace( /<.*?>/g, "" );
|
14224 |
-
* }
|
14225 |
-
*/
|
14226 |
-
search: {},
|
14227 |
-
|
14228 |
-
|
14229 |
-
/**
|
14230 |
-
* Type based ordering.
|
14231 |
-
*
|
14232 |
-
* The column type tells WFDataTables what ordering to apply to the table
|
14233 |
-
* when a column is sorted upon. The order for each type that is defined,
|
14234 |
-
* is defined by the functions available in this object.
|
14235 |
-
*
|
14236 |
-
* Each ordering option can be described by three properties added to
|
14237 |
-
* this object:
|
14238 |
-
*
|
14239 |
-
* * `{type}-pre` - Pre-formatting function
|
14240 |
-
* * `{type}-asc` - Ascending order function
|
14241 |
-
* * `{type}-desc` - Descending order function
|
14242 |
-
*
|
14243 |
-
* All three can be used together, only `{type}-pre` or only
|
14244 |
-
* `{type}-asc` and `{type}-desc` together. It is generally recommended
|
14245 |
-
* that only `{type}-pre` is used, as this provides the optimal
|
14246 |
-
* implementation in terms of speed, although the others are provided
|
14247 |
-
* for compatibility with existing Javascript sort functions.
|
14248 |
-
*
|
14249 |
-
* `{type}-pre`: Functions defined take a single parameter:
|
14250 |
-
*
|
14251 |
-
* 1. `{*}` Data from the column cell to be prepared for ordering
|
14252 |
-
*
|
14253 |
-
* And return:
|
14254 |
-
*
|
14255 |
-
* * `{*}` Data to be sorted upon
|
14256 |
-
*
|
14257 |
-
* `{type}-asc` and `{type}-desc`: Functions are typical Javascript sort
|
14258 |
-
* functions, taking two parameters:
|
14259 |
-
*
|
14260 |
-
* 1. `{*}` Data to compare to the second parameter
|
14261 |
-
* 2. `{*}` Data to compare to the first parameter
|
14262 |
-
*
|
14263 |
-
* And returning:
|
14264 |
-
*
|
14265 |
-
* * `{*}` Ordering match: <0 if first parameter should be sorted lower
|
14266 |
-
* than the second parameter, ===0 if the two parameters are equal and
|
14267 |
-
* >0 if the first parameter should be sorted height than the second
|
14268 |
-
* parameter.
|
14269 |
-
*
|
14270 |
-
* @type object
|
14271 |
-
* @default {}
|
14272 |
-
*
|
14273 |
-
* @example
|
14274 |
-
* // Numeric ordering of formatted numbers with a pre-formatter
|
14275 |
-
* $.extend( $.fn.wfDataTable.ext.type.order, {
|
14276 |
-
* "string-pre": function(x) {
|
14277 |
-
* a = (a === "-" || a === "") ? 0 : a.replace( /[^\d\-\.]/g, "" );
|
14278 |
-
* return parseFloat( a );
|
14279 |
-
* }
|
14280 |
-
* } );
|
14281 |
-
*
|
14282 |
-
* @example
|
14283 |
-
* // Case-sensitive string ordering, with no pre-formatting method
|
14284 |
-
* $.extend( $.fn.wfDataTable.ext.order, {
|
14285 |
-
* "string-case-asc": function(x,y) {
|
14286 |
-
* return ((x < y) ? -1 : ((x > y) ? 1 : 0));
|
14287 |
-
* },
|
14288 |
-
* "string-case-desc": function(x,y) {
|
14289 |
-
* return ((x < y) ? 1 : ((x > y) ? -1 : 0));
|
14290 |
-
* }
|
14291 |
-
* } );
|
14292 |
-
*/
|
14293 |
-
order: {}
|
14294 |
-
},
|
14295 |
-
|
14296 |
-
/**
|
14297 |
-
* Unique WFDataTables instance counter
|
14298 |
-
*
|
14299 |
-
* @type int
|
14300 |
-
* @private
|
14301 |
-
*/
|
14302 |
-
_unique: 0,
|
14303 |
-
|
14304 |
-
|
14305 |
-
//
|
14306 |
-
// Depreciated
|
14307 |
-
// The following properties are retained for backwards compatiblity only.
|
14308 |
-
// The should not be used in new projects and will be removed in a future
|
14309 |
-
// version
|
14310 |
-
//
|
14311 |
-
|
14312 |
-
/**
|
14313 |
-
* Version check function.
|
14314 |
-
* @type function
|
14315 |
-
* @depreciated Since 1.10
|
14316 |
-
*/
|
14317 |
-
fnVersionCheck: WFDataTable.fnVersionCheck,
|
14318 |
-
|
14319 |
-
|
14320 |
-
/**
|
14321 |
-
* Index for what 'this' index API functions should use
|
14322 |
-
* @type int
|
14323 |
-
* @deprecated Since v1.10
|
14324 |
-
*/
|
14325 |
-
iApiIndex: 0,
|
14326 |
-
|
14327 |
-
|
14328 |
-
/**
|
14329 |
-
* jQuery UI class container
|
14330 |
-
* @type object
|
14331 |
-
* @deprecated Since v1.10
|
14332 |
-
*/
|
14333 |
-
oJUIClasses: {},
|
14334 |
-
|
14335 |
-
|
14336 |
-
/**
|
14337 |
-
* Software version
|
14338 |
-
* @type string
|
14339 |
-
* @deprecated Since v1.10
|
14340 |
-
*/
|
14341 |
-
sVersion: WFDataTable.version
|
14342 |
-
};
|
14343 |
-
|
14344 |
-
|
14345 |
-
//
|
14346 |
-
// Backwards compatibility. Alias to pre 1.10 Hungarian notation counter parts
|
14347 |
-
//
|
14348 |
-
$.extend( _ext, {
|
14349 |
-
afnFiltering: _ext.search,
|
14350 |
-
aTypes: _ext.type.detect,
|
14351 |
-
ofnSearch: _ext.type.search,
|
14352 |
-
oSort: _ext.type.order,
|
14353 |
-
afnSortData: _ext.order,
|
14354 |
-
aoFeatures: _ext.feature,
|
14355 |
-
oApi: _ext.internal,
|
14356 |
-
oStdClasses: _ext.classes,
|
14357 |
-
oPagination: _ext.pager
|
14358 |
-
} );
|
14359 |
-
|
14360 |
-
|
14361 |
-
$.extend( WFDataTable.ext.classes, {
|
14362 |
-
"sTable": "wf-dataTable",
|
14363 |
-
"sNoFooter": "no-footer",
|
14364 |
-
|
14365 |
-
/* Paging buttons */
|
14366 |
-
"sPageButton": "paginate_button",
|
14367 |
-
"sPageButtonActive": "current",
|
14368 |
-
"sPageButtonDisabled": "disabled",
|
14369 |
-
|
14370 |
-
/* Striping classes */
|
14371 |
-
"sStripeOdd": "odd",
|
14372 |
-
"sStripeEven": "even",
|
14373 |
-
|
14374 |
-
/* Empty row */
|
14375 |
-
"sRowEmpty": "dataTables_empty",
|
14376 |
-
|
14377 |
-
/* Features */
|
14378 |
-
"sWrapper": "wf-dataTables_wrapper",
|
14379 |
-
"sFilter": "dataTables_filter",
|
14380 |
-
"sInfo": "dataTables_info",
|
14381 |
-
"sPaging": "dataTables_paginate paging_", /* Note that the type is postfixed */
|
14382 |
-
"sLength": "dataTables_length",
|
14383 |
-
"sProcessing": "dataTables_processing",
|
14384 |
-
|
14385 |
-
/* Sorting */
|
14386 |
-
"sSortAsc": "sorting_asc",
|
14387 |
-
"sSortDesc": "sorting_desc",
|
14388 |
-
"sSortable": "sorting", /* Sortable in both directions */
|
14389 |
-
"sSortableAsc": "sorting_asc_disabled",
|
14390 |
-
"sSortableDesc": "sorting_desc_disabled",
|
14391 |
-
"sSortableNone": "sorting_disabled",
|
14392 |
-
"sSortColumn": "sorting_", /* Note that an int is postfixed for the sorting order */
|
14393 |
-
|
14394 |
-
/* Filtering */
|
14395 |
-
"sFilterInput": "",
|
14396 |
-
|
14397 |
-
/* Page length */
|
14398 |
-
"sLengthSelect": "",
|
14399 |
-
|
14400 |
-
/* Scrolling */
|
14401 |
-
"sScrollWrapper": "dataTables_scroll",
|
14402 |
-
"sScrollHead": "dataTables_scrollHead",
|
14403 |
-
"sScrollHeadInner": "dataTables_scrollHeadInner",
|
14404 |
-
"sScrollBody": "dataTables_scrollBody",
|
14405 |
-
"sScrollFoot": "dataTables_scrollFoot",
|
14406 |
-
"sScrollFootInner": "dataTables_scrollFootInner",
|
14407 |
-
|
14408 |
-
/* Misc */
|
14409 |
-
"sHeaderTH": "",
|
14410 |
-
"sFooterTH": "",
|
14411 |
-
|
14412 |
-
// Deprecated
|
14413 |
-
"sSortJUIAsc": "",
|
14414 |
-
"sSortJUIDesc": "",
|
14415 |
-
"sSortJUI": "",
|
14416 |
-
"sSortJUIAscAllowed": "",
|
14417 |
-
"sSortJUIDescAllowed": "",
|
14418 |
-
"sSortJUIWrapper": "",
|
14419 |
-
"sSortIcon": "",
|
14420 |
-
"sJUIHeader": "",
|
14421 |
-
"sJUIFooter": ""
|
14422 |
-
} );
|
14423 |
-
|
14424 |
-
|
14425 |
-
(function() {
|
14426 |
-
|
14427 |
-
// Reused strings for better compression. Closure compiler appears to have a
|
14428 |
-
// weird edge case where it is trying to expand strings rather than use the
|
14429 |
-
// variable version. This results in about 200 bytes being added, for very
|
14430 |
-
// little preference benefit since it this run on script load only.
|
14431 |
-
var _empty = '';
|
14432 |
-
_empty = '';
|
14433 |
-
|
14434 |
-
var _stateDefault = _empty + 'ui-state-default';
|
14435 |
-
var _sortIcon = _empty + 'css_right ui-icon ui-icon-';
|
14436 |
-
var _headerFooter = _empty + 'fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix';
|
14437 |
-
|
14438 |
-
$.extend( WFDataTable.ext.oJUIClasses, WFDataTable.ext.classes, {
|
14439 |
-
/* Full numbers paging buttons */
|
14440 |
-
"sPageButton": "fg-button ui-button "+_stateDefault,
|
14441 |
-
"sPageButtonActive": "ui-state-disabled",
|
14442 |
-
"sPageButtonDisabled": "ui-state-disabled",
|
14443 |
-
|
14444 |
-
/* Features */
|
14445 |
-
"sPaging": "dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi "+
|
14446 |
-
"ui-buttonset-multi paging_", /* Note that the type is postfixed */
|
14447 |
-
|
14448 |
-
/* Sorting */
|
14449 |
-
"sSortAsc": _stateDefault+" sorting_asc",
|
14450 |
-
"sSortDesc": _stateDefault+" sorting_desc",
|
14451 |
-
"sSortable": _stateDefault+" sorting",
|
14452 |
-
"sSortableAsc": _stateDefault+" sorting_asc_disabled",
|
14453 |
-
"sSortableDesc": _stateDefault+" sorting_desc_disabled",
|
14454 |
-
"sSortableNone": _stateDefault+" sorting_disabled",
|
14455 |
-
"sSortJUIAsc": _sortIcon+"triangle-1-n",
|
14456 |
-
"sSortJUIDesc": _sortIcon+"triangle-1-s",
|
14457 |
-
"sSortJUI": _sortIcon+"carat-2-n-s",
|
14458 |
-
"sSortJUIAscAllowed": _sortIcon+"carat-1-n",
|
14459 |
-
"sSortJUIDescAllowed": _sortIcon+"carat-1-s",
|
14460 |
-
"sSortJUIWrapper": "WFDataTables_sort_wrapper",
|
14461 |
-
"sSortIcon": "WFDataTables_sort_icon",
|
14462 |
-
|
14463 |
-
/* Scrolling */
|
14464 |
-
"sScrollHead": "dataTables_scrollHead "+_stateDefault,
|
14465 |
-
"sScrollFoot": "dataTables_scrollFoot "+_stateDefault,
|
14466 |
-
|
14467 |
-
/* Misc */
|
14468 |
-
"sHeaderTH": _stateDefault,
|
14469 |
-
"sFooterTH": _stateDefault,
|
14470 |
-
"sJUIHeader": _headerFooter+" ui-corner-tl ui-corner-tr",
|
14471 |
-
"sJUIFooter": _headerFooter+" ui-corner-bl ui-corner-br"
|
14472 |
-
} );
|
14473 |
-
|
14474 |
-
}());
|
14475 |
-
|
14476 |
-
|
14477 |
-
|
14478 |
-
var extPagination = WFDataTable.ext.pager;
|
14479 |
-
|
14480 |
-
function _numbers ( page, pages ) {
|
14481 |
-
var
|
14482 |
-
numbers = [],
|
14483 |
-
buttons = extPagination.numbers_length,
|
14484 |
-
half = Math.floor( buttons / 2 ),
|
14485 |
-
i = 1;
|
14486 |
-
|
14487 |
-
if ( pages <= buttons ) {
|
14488 |
-
numbers = _range( 0, pages );
|
14489 |
-
}
|
14490 |
-
else if ( page <= half ) {
|
14491 |
-
numbers = _range( 0, buttons-2 );
|
14492 |
-
numbers.push( 'ellipsis' );
|
14493 |
-
numbers.push( pages-1 );
|
14494 |
-
}
|
14495 |
-
else if ( page >= pages - 1 - half ) {
|
14496 |
-
numbers = _range( pages-(buttons-2), pages );
|
14497 |
-
numbers.splice( 0, 0, 'ellipsis' ); // no unshift in ie6
|
14498 |
-
numbers.splice( 0, 0, 0 );
|
14499 |
-
}
|
14500 |
-
else {
|
14501 |
-
numbers = _range( page-half+2, page+half-1 );
|
14502 |
-
numbers.push( 'ellipsis' );
|
14503 |
-
numbers.push( pages-1 );
|
14504 |
-
numbers.splice( 0, 0, 'ellipsis' );
|
14505 |
-
numbers.splice( 0, 0, 0 );
|
14506 |
-
}
|
14507 |
-
|
14508 |
-
numbers.DT_el = 'span';
|
14509 |
-
return numbers;
|
14510 |
-
}
|
14511 |
-
|
14512 |
-
|
14513 |
-
$.extend( extPagination, {
|
14514 |
-
simple: function ( page, pages ) {
|
14515 |
-
return [ 'previous', 'next' ];
|
14516 |
-
},
|
14517 |
-
|
14518 |
-
full: function ( page, pages ) {
|
14519 |
-
return [ 'first', 'previous', 'next', 'last' ];
|
14520 |
-
},
|
14521 |
-
|
14522 |
-
numbers: function ( page, pages ) {
|
14523 |
-
return [ _numbers(page, pages) ];
|
14524 |
-
},
|
14525 |
-
|
14526 |
-
simple_numbers: function ( page, pages ) {
|
14527 |
-
return [ 'previous', _numbers(page, pages), 'next' ];
|
14528 |
-
},
|
14529 |
-
|
14530 |
-
full_numbers: function ( page, pages ) {
|
14531 |
-
return [ 'first', 'previous', _numbers(page, pages), 'next', 'last' ];
|
14532 |
-
},
|
14533 |
-
|
14534 |
-
first_last_numbers: function (page, pages) {
|
14535 |
-
return ['first', _numbers(page, pages), 'last'];
|
14536 |
-
},
|
14537 |
-
|
14538 |
-
// For testing and plug-ins to use
|
14539 |
-
_numbers: _numbers,
|
14540 |
-
|
14541 |
-
// Number of number buttons (including ellipsis) to show. _Must be odd!_
|
14542 |
-
numbers_length: 7
|
14543 |
-
} );
|
14544 |
-
|
14545 |
-
|
14546 |
-
$.extend( true, WFDataTable.ext.renderer, {
|
14547 |
-
pageButton: {
|
14548 |
-
_: function ( settings, host, idx, buttons, page, pages ) {
|
14549 |
-
var classes = settings.oClasses;
|
14550 |
-
var lang = settings.oLanguage.oPaginate;
|
14551 |
-
var aria = settings.oLanguage.oAria.paginate || {};
|
14552 |
-
var btnDisplay, btnClass, counter=0;
|
14553 |
-
|
14554 |
-
var attach = function( container, buttons ) {
|
14555 |
-
var i, ien, node, button;
|
14556 |
-
var clickHandler = function ( e ) {
|
14557 |
-
_fnPageChange( settings, e.data.action, true );
|
14558 |
-
};
|
14559 |
-
|
14560 |
-
for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
|
14561 |
-
button = buttons[i];
|
14562 |
-
|
14563 |
-
if ( $.isArray( button ) ) {
|
14564 |
-
var inner = $( '<'+(button.DT_el || 'div')+'/>' )
|
14565 |
-
.appendTo( container );
|
14566 |
-
attach( inner, button );
|
14567 |
-
}
|
14568 |
-
else {
|
14569 |
-
btnDisplay = null;
|
14570 |
-
btnClass = '';
|
14571 |
-
|
14572 |
-
switch ( button ) {
|
14573 |
-
case 'ellipsis':
|
14574 |
-
container.append('<span class="ellipsis">…</span>');
|
14575 |
-
break;
|
14576 |
-
|
14577 |
-
case 'first':
|
14578 |
-
btnDisplay = lang.sFirst;
|
14579 |
-
btnClass = button + (page > 0 ?
|
14580 |
-
'' : ' '+classes.sPageButtonDisabled);
|
14581 |
-
break;
|
14582 |
-
|
14583 |
-
case 'previous':
|
14584 |
-
btnDisplay = lang.sPrevious;
|
14585 |
-
btnClass = button + (page > 0 ?
|
14586 |
-
'' : ' '+classes.sPageButtonDisabled);
|
14587 |
-
break;
|
14588 |
-
|
14589 |
-
case 'next':
|
14590 |
-
btnDisplay = lang.sNext;
|
14591 |
-
btnClass = button + (page < pages-1 ?
|
14592 |
-
'' : ' '+classes.sPageButtonDisabled);
|
14593 |
-
break;
|
14594 |
-
|
14595 |
-
case 'last':
|
14596 |
-
btnDisplay = lang.sLast;
|
14597 |
-
btnClass = button + (page < pages-1 ?
|
14598 |
-
'' : ' '+classes.sPageButtonDisabled);
|
14599 |
-
break;
|
14600 |
-
|
14601 |
-
default:
|
14602 |
-
btnDisplay = button + 1;
|
14603 |
-
btnClass = page === button ?
|
14604 |
-
classes.sPageButtonActive : '';
|
14605 |
-
break;
|
14606 |
-
}
|
14607 |
-
|
14608 |
-
if ( btnDisplay !== null ) {
|
14609 |
-
node = $('<a>', {
|
14610 |
-
'class': classes.sPageButton+' '+btnClass,
|
14611 |
-
'aria-controls': settings.sTableId,
|
14612 |
-
'aria-label': aria[ button ],
|
14613 |
-
'data-dt-idx': counter,
|
14614 |
-
'tabindex': settings.iTabIndex,
|
14615 |
-
'id': idx === 0 && typeof button === 'string' ?
|
14616 |
-
settings.sTableId +'_'+ button :
|
14617 |
-
null
|
14618 |
-
} )
|
14619 |
-
.html( btnDisplay )
|
14620 |
-
.appendTo( container );
|
14621 |
-
|
14622 |
-
_fnBindAction(
|
14623 |
-
node, {action: button}, clickHandler
|
14624 |
-
);
|
14625 |
-
|
14626 |
-
counter++;
|
14627 |
-
}
|
14628 |
-
}
|
14629 |
-
}
|
14630 |
-
};
|
14631 |
-
|
14632 |
-
// IE9 throws an 'unknown error' if document.activeElement is used
|
14633 |
-
// inside an iframe or frame. Try / catch the error. Not good for
|
14634 |
-
// accessibility, but neither are frames.
|
14635 |
-
var activeEl;
|
14636 |
-
|
14637 |
-
try {
|
14638 |
-
// Because this approach is destroying and recreating the paging
|
14639 |
-
// elements, focus is lost on the select button which is bad for
|
14640 |
-
// accessibility. So we want to restore focus once the draw has
|
14641 |
-
// completed
|
14642 |
-
activeEl = $(host).find(document.activeElement).data('dt-idx');
|
14643 |
-
}
|
14644 |
-
catch (e) {}
|
14645 |
-
|
14646 |
-
attach( $(host).empty(), buttons );
|
14647 |
-
|
14648 |
-
if ( activeEl !== undefined ) {
|
14649 |
-
$(host).find( '[data-dt-idx='+activeEl+']' ).focus();
|
14650 |
-
}
|
14651 |
-
}
|
14652 |
-
}
|
14653 |
-
} );
|
14654 |
-
|
14655 |
-
|
14656 |
-
|
14657 |
-
// Built in type detection. See model.ext.aTypes for information about
|
14658 |
-
// what is required from this methods.
|
14659 |
-
$.extend( WFDataTable.ext.type.detect, [
|
14660 |
-
// Plain numbers - first since V8 detects some plain numbers as dates
|
14661 |
-
// e.g. Date.parse('55') (but not all, e.g. Date.parse('22')...).
|
14662 |
-
function ( d, settings )
|
14663 |
-
{
|
14664 |
-
var decimal = settings.oLanguage.sDecimal;
|
14665 |
-
return _isNumber( d, decimal ) ? 'num'+decimal : null;
|
14666 |
-
},
|
14667 |
-
|
14668 |
-
// Dates (only those recognised by the browser's Date.parse)
|
14669 |
-
function ( d, settings )
|
14670 |
-
{
|
14671 |
-
// V8 tries _very_ hard to make a string passed into `Date.parse()`
|
14672 |
-
// valid, so we need to use a regex to restrict date formats. Use a
|
14673 |
-
// plug-in for anything other than ISO8601 style strings
|
14674 |
-
if ( d && !(d instanceof Date) && ! _re_date.test(d) ) {
|
14675 |
-
return null;
|
14676 |
-
}
|
14677 |
-
var parsed = Date.parse(d);
|
14678 |
-
return (parsed !== null && !isNaN(parsed)) || _empty(d) ? 'date' : null;
|
14679 |
-
},
|
14680 |
-
|
14681 |
-
// Formatted numbers
|
14682 |
-
function ( d, settings )
|
14683 |
-
{
|
14684 |
-
var decimal = settings.oLanguage.sDecimal;
|
14685 |
-
return _isNumber( d, decimal, true ) ? 'num-fmt'+decimal : null;
|
14686 |
-
},
|
14687 |
-
|
14688 |
-
// HTML numeric
|
14689 |
-
function ( d, settings )
|
14690 |
-
{
|
14691 |
-
var decimal = settings.oLanguage.sDecimal;
|
14692 |
-
return _htmlNumeric( d, decimal ) ? 'html-num'+decimal : null;
|
14693 |
-
},
|
14694 |
-
|
14695 |
-
// HTML numeric, formatted
|
14696 |
-
function ( d, settings )
|
14697 |
-
{
|
14698 |
-
var decimal = settings.oLanguage.sDecimal;
|
14699 |
-
return _htmlNumeric( d, decimal, true ) ? 'html-num-fmt'+decimal : null;
|
14700 |
-
},
|
14701 |
-
|
14702 |
-
// HTML (this is strict checking - there must be html)
|
14703 |
-
function ( d, settings )
|
14704 |
-
{
|
14705 |
-
return _empty( d ) || (typeof d === 'string' && d.indexOf('<') !== -1) ?
|
14706 |
-
'html' : null;
|
14707 |
-
}
|
14708 |
-
] );
|
14709 |
-
|
14710 |
-
|
14711 |
-
|
14712 |
-
// Filter formatting functions. See model.ext.ofnSearch for information about
|
14713 |
-
// what is required from these methods.
|
14714 |
-
//
|
14715 |
-
// Note that additional search methods are added for the html numbers and
|
14716 |
-
// html formatted numbers by `_addNumericSort()` when we know what the decimal
|
14717 |
-
// place is
|
14718 |
-
|
14719 |
-
|
14720 |
-
$.extend( WFDataTable.ext.type.search, {
|
14721 |
-
html: function ( data ) {
|
14722 |
-
return _empty(data) ?
|
14723 |
-
data :
|
14724 |
-
typeof data === 'string' ?
|
14725 |
-
data
|
14726 |
-
.replace( _re_new_lines, " " )
|
14727 |
-
.replace( _re_html, "" ) :
|
14728 |
-
'';
|
14729 |
-
},
|
14730 |
-
|
14731 |
-
string: function ( data ) {
|
14732 |
-
return _empty(data) ?
|
14733 |
-
data :
|
14734 |
-
typeof data === 'string' ?
|
14735 |
-
data.replace( _re_new_lines, " " ) :
|
14736 |
-
data;
|
14737 |
-
}
|
14738 |
-
} );
|
14739 |
-
|
14740 |
-
|
14741 |
-
|
14742 |
-
var __numericReplace = function ( d, decimalPlace, re1, re2 ) {
|
14743 |
-
if ( d !== 0 && (!d || d === '-') ) {
|
14744 |
-
return -Infinity;
|
14745 |
-
}
|
14746 |
-
|
14747 |
-
// If a decimal place other than `.` is used, it needs to be given to the
|
14748 |
-
// function so we can detect it and replace with a `.` which is the only
|
14749 |
-
// decimal place Javascript recognises - it is not locale aware.
|
14750 |
-
if ( decimalPlace ) {
|
14751 |
-
d = _numToDecimal( d, decimalPlace );
|
14752 |
-
}
|
14753 |
-
|
14754 |
-
if ( d.replace ) {
|
14755 |
-
if ( re1 ) {
|
14756 |
-
d = d.replace( re1, '' );
|
14757 |
-
}
|
14758 |
-
|
14759 |
-
if ( re2 ) {
|
14760 |
-
d = d.replace( re2, '' );
|
14761 |
-
}
|
14762 |
-
}
|
14763 |
-
|
14764 |
-
return d * 1;
|
14765 |
-
};
|
14766 |
-
|
14767 |
-
|
14768 |
-
// Add the numeric 'deformatting' functions for sorting and search. This is done
|
14769 |
-
// in a function to provide an easy ability for the language options to add
|
14770 |
-
// additional methods if a non-period decimal place is used.
|
14771 |
-
function _addNumericSort ( decimalPlace ) {
|
14772 |
-
$.each(
|
14773 |
-
{
|
14774 |
-
// Plain numbers
|
14775 |
-
"num": function ( d ) {
|
14776 |
-
return __numericReplace( d, decimalPlace );
|
14777 |
-
},
|
14778 |
-
|
14779 |
-
// Formatted numbers
|
14780 |
-
"num-fmt": function ( d ) {
|
14781 |
-
return __numericReplace( d, decimalPlace, _re_formatted_numeric );
|
14782 |
-
},
|
14783 |
-
|
14784 |
-
// HTML numeric
|
14785 |
-
"html-num": function ( d ) {
|
14786 |
-
return __numericReplace( d, decimalPlace, _re_html );
|
14787 |
-
},
|
14788 |
-
|
14789 |
-
// HTML numeric, formatted
|
14790 |
-
"html-num-fmt": function ( d ) {
|
14791 |
-
return __numericReplace( d, decimalPlace, _re_html, _re_formatted_numeric );
|
14792 |
-
}
|
14793 |
-
},
|
14794 |
-
function ( key, fn ) {
|
14795 |
-
// Add the ordering method
|
14796 |
-
_ext.type.order[ key+decimalPlace+'-pre' ] = fn;
|
14797 |
-
|
14798 |
-
// For HTML types add a search formatter that will strip the HTML
|
14799 |
-
if ( key.match(/^html\-/) ) {
|
14800 |
-
_ext.type.search[ key+decimalPlace ] = _ext.type.search.html;
|
14801 |
-
}
|
14802 |
-
}
|
14803 |
-
);
|
14804 |
-
}
|
14805 |
-
|
14806 |
-
|
14807 |
-
// Default sort methods
|
14808 |
-
$.extend( _ext.type.order, {
|
14809 |
-
// Dates
|
14810 |
-
"date-pre": function ( d ) {
|
14811 |
-
return Date.parse( d ) || -Infinity;
|
14812 |
-
},
|
14813 |
-
|
14814 |
-
// html
|
14815 |
-
"html-pre": function ( a ) {
|
14816 |
-
return _empty(a) ?
|
14817 |
-
'' :
|
14818 |
-
a.replace ?
|
14819 |
-
a.replace( /<.*?>/g, "" ).toLowerCase() :
|
14820 |
-
a+'';
|
14821 |
-
},
|
14822 |
-
|
14823 |
-
// string
|
14824 |
-
"string-pre": function ( a ) {
|
14825 |
-
// This is a little complex, but faster than always calling toString,
|
14826 |
-
// http://jsperf.com/tostring-v-check
|
14827 |
-
return _empty(a) ?
|
14828 |
-
'' :
|
14829 |
-
typeof a === 'string' ?
|
14830 |
-
a.toLowerCase() :
|
14831 |
-
! a.toString ?
|
14832 |
-
'' :
|
14833 |
-
a.toString();
|
14834 |
-
},
|
14835 |
-
|
14836 |
-
// string-asc and -desc are retained only for compatibility with the old
|
14837 |
-
// sort methods
|
14838 |
-
"string-asc": function ( x, y ) {
|
14839 |
-
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
|
14840 |
-
},
|
14841 |
-
|
14842 |
-
"string-desc": function ( x, y ) {
|
14843 |
-
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
|
14844 |
-
}
|
14845 |
-
} );
|
14846 |
-
|
14847 |
-
|
14848 |
-
// Numeric sorting types - order doesn't matter here
|
14849 |
-
_addNumericSort( '' );
|
14850 |
-
|
14851 |
-
|
14852 |
-
$.extend( true, WFDataTable.ext.renderer, {
|
14853 |
-
header: {
|
14854 |
-
_: function ( settings, cell, column, classes ) {
|
14855 |
-
// No additional mark-up required
|
14856 |
-
// Attach a sort listener to update on sort - note that using the
|
14857 |
-
// `DT` namespace will allow the event to be removed automatically
|
14858 |
-
// on destroy, while the `dt` namespaced event is the one we are
|
14859 |
-
// listening for
|
14860 |
-
$(settings.nTable).on( 'order.dt.DT', function ( e, ctx, sorting, columns ) {
|
14861 |
-
if ( settings !== ctx ) { // need to check this this is the host
|
14862 |
-
return; // table, not a nested one
|
14863 |
-
}
|
14864 |
-
|
14865 |
-
var colIdx = column.idx;
|
14866 |
-
|
14867 |
-
cell
|
14868 |
-
.removeClass(
|
14869 |
-
column.sSortingClass +' '+
|
14870 |
-
classes.sSortAsc +' '+
|
14871 |
-
classes.sSortDesc
|
14872 |
-
)
|
14873 |
-
.addClass( columns[ colIdx ] == 'asc' ?
|
14874 |
-
classes.sSortAsc : columns[ colIdx ] == 'desc' ?
|
14875 |
-
classes.sSortDesc :
|
14876 |
-
column.sSortingClass
|
14877 |
-
);
|
14878 |
-
} );
|
14879 |
-
},
|
14880 |
-
|
14881 |
-
jqueryui: function ( settings, cell, column, classes ) {
|
14882 |
-
$('<div/>')
|
14883 |
-
.addClass( classes.sSortJUIWrapper )
|
14884 |
-
.append( cell.contents() )
|
14885 |
-
.append( $('<span/>')
|
14886 |
-
.addClass( classes.sSortIcon+' '+column.sSortingClassJUI )
|
14887 |
-
)
|
14888 |
-
.appendTo( cell );
|
14889 |
-
|
14890 |
-
// Attach a sort listener to update on sort
|
14891 |
-
$(settings.nTable).on( 'order.dt.DT', function ( e, ctx, sorting, columns ) {
|
14892 |
-
if ( settings !== ctx ) {
|
14893 |
-
return;
|
14894 |
-
}
|
14895 |
-
|
14896 |
-
var colIdx = column.idx;
|
14897 |
-
|
14898 |
-
cell
|
14899 |
-
.removeClass( classes.sSortAsc +" "+classes.sSortDesc )
|
14900 |
-
.addClass( columns[ colIdx ] == 'asc' ?
|
14901 |
-
classes.sSortAsc : columns[ colIdx ] == 'desc' ?
|
14902 |
-
classes.sSortDesc :
|
14903 |
-
column.sSortingClass
|
14904 |
-
);
|
14905 |
-
|
14906 |
-
cell
|
14907 |
-
.find( 'span.'+classes.sSortIcon )
|
14908 |
-
.removeClass(
|
14909 |
-
classes.sSortJUIAsc +" "+
|
14910 |
-
classes.sSortJUIDesc +" "+
|
14911 |
-
classes.sSortJUI +" "+
|
14912 |
-
classes.sSortJUIAscAllowed +" "+
|
14913 |
-
classes.sSortJUIDescAllowed
|
14914 |
-
)
|
14915 |
-
.addClass( columns[ colIdx ] == 'asc' ?
|
14916 |
-
classes.sSortJUIAsc : columns[ colIdx ] == 'desc' ?
|
14917 |
-
classes.sSortJUIDesc :
|
14918 |
-
column.sSortingClassJUI
|
14919 |
-
);
|
14920 |
-
} );
|
14921 |
-
}
|
14922 |
-
}
|
14923 |
-
} );
|
14924 |
-
|
14925 |
-
/*
|
14926 |
-
* Public helper functions. These aren't used internally by WFDataTables, or
|
14927 |
-
* called by any of the options passed into WFDataTables, but they can be used
|
14928 |
-
* externally by developers working with WFDataTables. They are helper functions
|
14929 |
-
* to make working with WFDataTables a little bit easier.
|
14930 |
-
*/
|
14931 |
-
|
14932 |
-
var __htmlEscapeEntities = function ( d ) {
|
14933 |
-
return typeof d === 'string' ?
|
14934 |
-
d.replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"') :
|
14935 |
-
d;
|
14936 |
-
};
|
14937 |
-
|
14938 |
-
/**
|
14939 |
-
* Helpers for `columns.render`.
|
14940 |
-
*
|
14941 |
-
* The options defined here can be used with the `columns.render` initialisation
|
14942 |
-
* option to provide a display renderer. The following functions are defined:
|
14943 |
-
*
|
14944 |
-
* * `number` - Will format numeric data (defined by `columns.data`) for
|
14945 |
-
* display, retaining the original unformatted data for sorting and filtering.
|
14946 |
-
* It takes 5 parameters:
|
14947 |
-
* * `string` - Thousands grouping separator
|
14948 |
-
* * `string` - Decimal point indicator
|
14949 |
-
* * `integer` - Number of decimal points to show
|
14950 |
-
* * `string` (optional) - Prefix.
|
14951 |
-
* * `string` (optional) - Postfix (/suffix).
|
14952 |
-
* * `text` - Escape HTML to help prevent XSS attacks. It has no optional
|
14953 |
-
* parameters.
|
14954 |
-
*
|
14955 |
-
* @example
|
14956 |
-
* // Column definition using the number renderer
|
14957 |
-
* {
|
14958 |
-
* data: "salary",
|
14959 |
-
* render: $.fn.wfDataTable.render.number( '\'', '.', 0, '$' )
|
14960 |
-
* }
|
14961 |
-
*
|
14962 |
-
* @namespace
|
14963 |
-
*/
|
14964 |
-
WFDataTable.render = {
|
14965 |
-
number: function ( thousands, decimal, precision, prefix, postfix ) {
|
14966 |
-
return {
|
14967 |
-
display: function ( d ) {
|
14968 |
-
if ( typeof d !== 'number' && typeof d !== 'string' ) {
|
14969 |
-
return d;
|
14970 |
-
}
|
14971 |
-
|
14972 |
-
var negative = d < 0 ? '-' : '';
|
14973 |
-
var flo = parseFloat( d );
|
14974 |
-
|
14975 |
-
// If NaN then there isn't much formatting that we can do - just
|
14976 |
-
// return immediately, escaping any HTML (this was supposed to
|
14977 |
-
// be a number after all)
|
14978 |
-
if ( isNaN( flo ) ) {
|
14979 |
-
return __htmlEscapeEntities( d );
|
14980 |
-
}
|
14981 |
-
|
14982 |
-
flo = flo.toFixed( precision );
|
14983 |
-
d = Math.abs( flo );
|
14984 |
-
|
14985 |
-
var intPart = parseInt( d, 10 );
|
14986 |
-
var floatPart = precision ?
|
14987 |
-
decimal+(d - intPart).toFixed( precision ).substring( 2 ):
|
14988 |
-
'';
|
14989 |
-
|
14990 |
-
return negative + (prefix||'') +
|
14991 |
-
intPart.toString().replace(
|
14992 |
-
/\B(?=(\d{3})+(?!\d))/g, thousands
|
14993 |
-
) +
|
14994 |
-
floatPart +
|
14995 |
-
(postfix||'');
|
14996 |
-
}
|
14997 |
-
};
|
14998 |
-
},
|
14999 |
-
|
15000 |
-
text: function () {
|
15001 |
-
return {
|
15002 |
-
display: __htmlEscapeEntities
|
15003 |
-
};
|
15004 |
-
}
|
15005 |
-
};
|
15006 |
-
|
15007 |
-
|
15008 |
-
/*
|
15009 |
-
* This is really a good bit rubbish this method of exposing the internal methods
|
15010 |
-
* publicly... - To be fixed in 2.0 using methods on the prototype
|
15011 |
-
*/
|
15012 |
-
|
15013 |
-
|
15014 |
-
/**
|
15015 |
-
* Create a wrapper function for exporting an internal functions to an external API.
|
15016 |
-
* @param {string} fn API function name
|
15017 |
-
* @returns {function} wrapped function
|
15018 |
-
* @memberof WFDataTable#internal
|
15019 |
-
*/
|
15020 |
-
function _fnExternApiFunc (fn)
|
15021 |
-
{
|
15022 |
-
return function() {
|
15023 |
-
var args = [_fnSettingsFromNode( this[WFDataTable.ext.iApiIndex] )].concat(
|
15024 |
-
Array.prototype.slice.call(arguments)
|
15025 |
-
);
|
15026 |
-
return WFDataTable.ext.internal[fn].apply( this, args );
|
15027 |
-
};
|
15028 |
-
}
|
15029 |
-
|
15030 |
-
|
15031 |
-
/**
|
15032 |
-
* Reference to internal functions for use by plug-in developers. Note that
|
15033 |
-
* these methods are references to internal functions and are considered to be
|
15034 |
-
* private. If you use these methods, be aware that they are liable to change
|
15035 |
-
* between versions.
|
15036 |
-
* @namespace
|
15037 |
-
*/
|
15038 |
-
$.extend( WFDataTable.ext.internal, {
|
15039 |
-
_fnExternApiFunc: _fnExternApiFunc,
|
15040 |
-
_fnBuildAjax: _fnBuildAjax,
|
15041 |
-
_fnAjaxUpdate: _fnAjaxUpdate,
|
15042 |
-
_fnAjaxParameters: _fnAjaxParameters,
|
15043 |
-
_fnAjaxUpdateDraw: _fnAjaxUpdateDraw,
|
15044 |
-
_fnAjaxDataSrc: _fnAjaxDataSrc,
|
15045 |
-
_fnAddColumn: _fnAddColumn,
|
15046 |
-
_fnColumnOptions: _fnColumnOptions,
|
15047 |
-
_fnAdjustColumnSizing: _fnAdjustColumnSizing,
|
15048 |
-
_fnVisibleToColumnIndex: _fnVisibleToColumnIndex,
|
15049 |
-
_fnColumnIndexToVisible: _fnColumnIndexToVisible,
|
15050 |
-
_fnVisbleColumns: _fnVisbleColumns,
|
15051 |
-
_fnGetColumns: _fnGetColumns,
|
15052 |
-
_fnColumnTypes: _fnColumnTypes,
|
15053 |
-
_fnApplyColumnDefs: _fnApplyColumnDefs,
|
15054 |
-
_fnHungarianMap: _fnHungarianMap,
|
15055 |
-
_fnCamelToHungarian: _fnCamelToHungarian,
|
15056 |
-
_fnLanguageCompat: _fnLanguageCompat,
|
15057 |
-
_fnBrowserDetect: _fnBrowserDetect,
|
15058 |
-
_fnAddData: _fnAddData,
|
15059 |
-
_fnAddTr: _fnAddTr,
|
15060 |
-
_fnNodeToDataIndex: _fnNodeToDataIndex,
|
15061 |
-
_fnNodeToColumnIndex: _fnNodeToColumnIndex,
|
15062 |
-
_fnGetCellData: _fnGetCellData,
|
15063 |
-
_fnSetCellData: _fnSetCellData,
|
15064 |
-
_fnSplitObjNotation: _fnSplitObjNotation,
|
15065 |
-
_fnGetObjectDataFn: _fnGetObjectDataFn,
|
15066 |
-
_fnSetObjectDataFn: _fnSetObjectDataFn,
|
15067 |
-
_fnGetDataMaster: _fnGetDataMaster,
|
15068 |
-
_fnClearTable: _fnClearTable,
|
15069 |
-
_fnDeleteIndex: _fnDeleteIndex,
|
15070 |
-
_fnInvalidate: _fnInvalidate,
|
15071 |
-
_fnGetRowElements: _fnGetRowElements,
|
15072 |
-
_fnCreateTr: _fnCreateTr,
|
15073 |
-
_fnBuildHead: _fnBuildHead,
|
15074 |
-
_fnDrawHead: _fnDrawHead,
|
15075 |
-
_fnDraw: _fnDraw,
|
15076 |
-
_fnReDraw: _fnReDraw,
|
15077 |
-
_fnAddOptionsHtml: _fnAddOptionsHtml,
|
15078 |
-
_fnDetectHeader: _fnDetectHeader,
|
15079 |
-
_fnGetUniqueThs: _fnGetUniqueThs,
|
15080 |
-
_fnFeatureHtmlFilter: _fnFeatureHtmlFilter,
|
15081 |
-
_fnFilterComplete: _fnFilterComplete,
|
15082 |
-
_fnFilterCustom: _fnFilterCustom,
|
15083 |
-
_fnFilterColumn: _fnFilterColumn,
|
15084 |
-
_fnFilter: _fnFilter,
|
15085 |
-
_fnFilterCreateSearch: _fnFilterCreateSearch,
|
15086 |
-
_fnEscapeRegex: _fnEscapeRegex,
|
15087 |
-
_fnFilterData: _fnFilterData,
|
15088 |
-
_fnFeatureHtmlInfo: _fnFeatureHtmlInfo,
|
15089 |
-
_fnUpdateInfo: _fnUpdateInfo,
|
15090 |
-
_fnInfoMacros: _fnInfoMacros,
|
15091 |
-
_fnInitialise: _fnInitialise,
|
15092 |
-
_fnInitComplete: _fnInitComplete,
|
15093 |
-
_fnLengthChange: _fnLengthChange,
|
15094 |
-
_fnFeatureHtmlLength: _fnFeatureHtmlLength,
|
15095 |
-
_fnFeatureHtmlPaginate: _fnFeatureHtmlPaginate,
|
15096 |
-
_fnPageChange: _fnPageChange,
|
15097 |
-
_fnFeatureHtmlProcessing: _fnFeatureHtmlProcessing,
|
15098 |
-
_fnProcessingDisplay: _fnProcessingDisplay,
|
15099 |
-
_fnFeatureHtmlTable: _fnFeatureHtmlTable,
|
15100 |
-
_fnScrollDraw: _fnScrollDraw,
|
15101 |
-
_fnApplyToChildren: _fnApplyToChildren,
|
15102 |
-
_fnCalculateColumnWidths: _fnCalculateColumnWidths,
|
15103 |
-
_fnThrottle: _fnThrottle,
|
15104 |
-
_fnConvertToWidth: _fnConvertToWidth,
|
15105 |
-
_fnGetWidestNode: _fnGetWidestNode,
|
15106 |
-
_fnGetMaxLenString: _fnGetMaxLenString,
|
15107 |
-
_fnStringToCss: _fnStringToCss,
|
15108 |
-
_fnSortFlatten: _fnSortFlatten,
|
15109 |
-
_fnSort: _fnSort,
|
15110 |
-
_fnSortAria: _fnSortAria,
|
15111 |
-
_fnSortListener: _fnSortListener,
|
15112 |
-
_fnSortAttachListener: _fnSortAttachListener,
|
15113 |
-
_fnSortingClasses: _fnSortingClasses,
|
15114 |
-
_fnSortData: _fnSortData,
|
15115 |
-
_fnSaveState: _fnSaveState,
|
15116 |
-
_fnLoadState: _fnLoadState,
|
15117 |
-
_fnSettingsFromNode: _fnSettingsFromNode,
|
15118 |
-
_fnLog: _fnLog,
|
15119 |
-
_fnMap: _fnMap,
|
15120 |
-
_fnBindAction: _fnBindAction,
|
15121 |
-
_fnCallbackReg: _fnCallbackReg,
|
15122 |
-
_fnCallbackFire: _fnCallbackFire,
|
15123 |
-
_fnLengthOverflow: _fnLengthOverflow,
|
15124 |
-
_fnRenderer: _fnRenderer,
|
15125 |
-
_fnDataSource: _fnDataSource,
|
15126 |
-
_fnRowAttributes: _fnRowAttributes,
|
15127 |
-
_fnCalculateEnd: function () {} // Used by a lot of plug-ins, but redundant
|
15128 |
-
// in 1.10, so this dead-end function is
|
15129 |
-
// added to prevent errors
|
15130 |
-
} );
|
15131 |
-
|
15132 |
-
|
15133 |
-
// jQuery access
|
15134 |
-
$.fn.wfDataTable = WFDataTable;
|
15135 |
-
|
15136 |
-
// Provide access to the host jQuery object (circular reference)
|
15137 |
-
WFDataTable.$ = $;
|
15138 |
-
|
15139 |
-
// Legacy aliases
|
15140 |
-
$.fn.wfDataTableSettings = WFDataTable.settings;
|
15141 |
-
$.fn.wfDataTableExt = WFDataTable.ext;
|
15142 |
-
|
15143 |
-
// With a capital `D` we return a WFDataTables API instance rather than a
|
15144 |
-
// jQuery object
|
15145 |
-
$.fn.WFDataTable = function ( opts ) {
|
15146 |
-
return $(this).wfDataTable( opts ).api();
|
15147 |
-
};
|
15148 |
-
|
15149 |
-
// All properties that are available to $.fn.wfDataTable should also be
|
15150 |
-
// available on $.fn.WFDataTable
|
15151 |
-
$.each( WFDataTable, function ( prop, val ) {
|
15152 |
-
$.fn.WFDataTable[ prop ] = val;
|
15153 |
-
} );
|
15154 |
-
|
15155 |
-
|
15156 |
-
// Information about events fired by WFDataTables - for documentation.
|
15157 |
-
/**
|
15158 |
-
* Draw event, fired whenever the table is redrawn on the page, at the same
|
15159 |
-
* point as fnDrawCallback. This may be useful for binding events or
|
15160 |
-
* performing calculations when the table is altered at all.
|
15161 |
-
* @name WFDataTable#draw.dt
|
15162 |
-
* @event
|
15163 |
-
* @param {event} e jQuery event object
|
15164 |
-
* @param {object} o WFDataTables settings object {@link WFDataTable.models.oSettings}
|
15165 |
-
*/
|
15166 |
-
|
15167 |
-
/**
|
15168 |
-
* Search event, fired when the searching applied to the table (using the
|
15169 |
-
* built-in global search, or column filters) is altered.
|
15170 |
-
* @name WFDataTable#search.dt
|
15171 |
-
* @event
|
15172 |
-
* @param {event} e jQuery event object
|
15173 |
-
* @param {object} o WFDataTables settings object {@link WFDataTable.models.oSettings}
|
15174 |
-
*/
|
15175 |
-
|
15176 |
-
/**
|
15177 |
-
* Page change event, fired when the paging of the table is altered.
|
15178 |
-
* @name WFDataTable#page.dt
|
15179 |
-
* @event
|
15180 |
-
* @param {event} e jQuery event object
|
15181 |
-
* @param {object} o WFDataTables settings object {@link WFDataTable.models.oSettings}
|
15182 |
-
*/
|
15183 |
-
|
15184 |
-
/**
|
15185 |
-
* Order event, fired when the ordering applied to the table is altered.
|
15186 |
-
* @name WFDataTable#order.dt
|
15187 |
-
* @event
|
15188 |
-
* @param {event} e jQuery event object
|
15189 |
-
* @param {object} o WFDataTables settings object {@link WFDataTable.models.oSettings}
|
15190 |
-
*/
|
15191 |
-
|
15192 |
-
/**
|
15193 |
-
* WFDataTables initialisation complete event, fired when the table is fully
|
15194 |
-
* drawn, including Ajax data loaded, if Ajax data is required.
|
15195 |
-
* @name WFDataTable#init.dt
|
15196 |
-
* @event
|
15197 |
-
* @param {event} e jQuery event object
|
15198 |
-
* @param {object} oSettings WFDataTables settings object
|
15199 |
-
* @param {object} json The JSON object request from the server - only
|
15200 |
-
* present if client-side Ajax sourced data is used</li></ol>
|
15201 |
-
*/
|
15202 |
-
|
15203 |
-
/**
|
15204 |
-
* State save event, fired when the table has changed state a new state save
|
15205 |
-
* is required. This event allows modification of the state saving object
|
15206 |
-
* prior to actually doing the save, including addition or other state
|
15207 |
-
* properties (for plug-ins) or modification of a WFDataTables core property.
|
15208 |
-
* @name WFDataTable#stateSaveParams.dt
|
15209 |
-
* @event
|
15210 |
-
* @param {event} e jQuery event object
|
15211 |
-
* @param {object} oSettings WFDataTables settings object
|
15212 |
-
* @param {object} json The state information to be saved
|
15213 |
-
*/
|
15214 |
-
|
15215 |
-
/**
|
15216 |
-
* State load event, fired when the table is loading state from the stored
|
15217 |
-
* data, but prior to the settings object being modified by the saved state
|
15218 |
-
* - allowing modification of the saved state is required or loading of
|
15219 |
-
* state for a plug-in.
|
15220 |
-
* @name WFDataTable#stateLoadParams.dt
|
15221 |
-
* @event
|
15222 |
-
* @param {event} e jQuery event object
|
15223 |
-
* @param {object} oSettings WFDataTables settings object
|
15224 |
-
* @param {object} json The saved state information
|
15225 |
-
*/
|
15226 |
-
|
15227 |
-
/**
|
15228 |
-
* State loaded event, fired when state has been loaded from stored data and
|
15229 |
-
* the settings object has been modified by the loaded data.
|
15230 |
-
* @name WFDataTable#stateLoaded.dt
|
15231 |
-
* @event
|
15232 |
-
* @param {event} e jQuery event object
|
15233 |
-
* @param {object} oSettings WFDataTables settings object
|
15234 |
-
* @param {object} json The saved state information
|
15235 |
-
*/
|
15236 |
-
|
15237 |
-
/**
|
15238 |
-
* Processing event, fired when WFDataTables is doing some kind of processing
|
15239 |
-
* (be it, order, searcg or anything else). It can be used to indicate to
|
15240 |
-
* the end user that there is something happening, or that something has
|
15241 |
-
* finished.
|
15242 |
-
* @name WFDataTable#processing.dt
|
15243 |
-
* @event
|
15244 |
-
* @param {event} e jQuery event object
|
15245 |
-
* @param {object} oSettings WFDataTables settings object
|
15246 |
-
* @param {boolean} bShow Flag for if WFDataTables is doing processing or not
|
15247 |
-
*/
|
15248 |
-
|
15249 |
-
/**
|
15250 |
-
* Ajax (XHR) event, fired whenever an Ajax request is completed from a
|
15251 |
-
* request to made to the server for new data. This event is called before
|
15252 |
-
* WFDataTables processed the returned data, so it can also be used to pre-
|
15253 |
-
* process the data returned from the server, if needed.
|
15254 |
-
*
|
15255 |
-
* Note that this trigger is called in `fnServerData`, if you override
|
15256 |
-
* `fnServerData` and which to use this event, you need to trigger it in you
|
15257 |
-
* success function.
|
15258 |
-
* @name WFDataTable#xhr.dt
|
15259 |
-
* @event
|
15260 |
-
* @param {event} e jQuery event object
|
15261 |
-
* @param {object} o WFDataTables settings object {@link WFDataTable.models.oSettings}
|
15262 |
-
* @param {object} json JSON returned from the server
|
15263 |
-
*
|
15264 |
-
* @example
|
15265 |
-
* // Use a custom property returned from the server in another DOM element
|
15266 |
-
* $('#table').wfDataTable().on('xhr.dt', function (e, settings, json) {
|
15267 |
-
* $('#status').html( json.status );
|
15268 |
-
* } );
|
15269 |
-
*
|
15270 |
-
* @example
|
15271 |
-
* // Pre-process the data returned from the server
|
15272 |
-
* $('#table').wfDataTable().on('xhr.dt', function (e, settings, json) {
|
15273 |
-
* for ( var i=0, ien=json.aaData.length ; i<ien ; i++ ) {
|
15274 |
-
* json.aaData[i].sum = json.aaData[i].one + json.aaData[i].two;
|
15275 |
-
* }
|
15276 |
-
* // Note no return - manipulate the data directly in the JSON object.
|
15277 |
-
* } );
|
15278 |
-
*/
|
15279 |
-
|
15280 |
-
/**
|
15281 |
-
* Destroy event, fired when the WFDataTable is destroyed by calling fnDestroy
|
15282 |
-
* or passing the bDestroy:true parameter in the initialisation object. This
|
15283 |
-
* can be used to remove bound events, added DOM nodes, etc.
|
15284 |
-
* @name WFDataTable#destroy.dt
|
15285 |
-
* @event
|
15286 |
-
* @param {event} e jQuery event object
|
15287 |
-
* @param {object} o WFDataTables settings object {@link WFDataTable.models.oSettings}
|
15288 |
-
*/
|
15289 |
-
|
15290 |
-
/**
|
15291 |
-
* Page length change event, fired when number of records to show on each
|
15292 |
-
* page (the length) is changed.
|
15293 |
-
* @name WFDataTable#length.dt
|
15294 |
-
* @event
|
15295 |
-
* @param {event} e jQuery event object
|
15296 |
-
* @param {object} o WFDataTables settings object {@link WFDataTable.models.oSettings}
|
15297 |
-
* @param {integer} len New length
|
15298 |
-
*/
|
15299 |
-
|
15300 |
-
/**
|
15301 |
-
* Column sizing has changed.
|
15302 |
-
* @name WFDataTable#column-sizing.dt
|
15303 |
-
* @event
|
15304 |
-
* @param {event} e jQuery event object
|
15305 |
-
* @param {object} o WFDataTables settings object {@link WFDataTable.models.oSettings}
|
15306 |
-
*/
|
15307 |
-
|
15308 |
-
/**
|
15309 |
-
* Column visibility has changed.
|
15310 |
-
* @name WFDataTable#column-visibility.dt
|
15311 |
-
* @event
|
15312 |
-
* @param {event} e jQuery event object
|
15313 |
-
* @param {object} o WFDataTables settings object {@link WFDataTable.models.oSettings}
|
15314 |
-
* @param {int} column Column index
|
15315 |
-
* @param {bool} vis `false` if column now hidden, or `true` if visible
|
15316 |
-
*/
|
15317 |
-
|
15318 |
-
return $.fn.wfDataTable;
|
15319 |
-
}));
|
15320 |
-
|
15321 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/jquery.dataTables.min.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/*
|
2 |
-
* File: jquery.dataTables.min.js
|
3 |
* Version: 1.8.2
|
4 |
* Author: Allan Jardine (www.sprymedia.co.uk)
|
5 |
* Info: www.datatables.net
|
@@ -13,139 +13,4 @@
|
|
13 |
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
14 |
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
|
15 |
*/
|
16 |
-
(function(i,za,p){i.fn.dataTableSettings=[];var D=i.fn.dataTableSettings;i.fn.dataTableExt={};var n=i.fn.dataTableExt;n.sVersion="1.8.2";n.sErrMode="alert";n.iApiIndex=0;n.oApi={};n.afnFiltering=[];n.aoFeatures=[];n.ofnSearch={};n.afnSortData=[];n.oStdClasses={sPagePrevEnabled:"paginate_enabled_previous",sPagePrevDisabled:"paginate_disabled_previous",sPageNextEnabled:"paginate_enabled_next",sPageNextDisabled:"paginate_disabled_next",sPageJUINext:"",sPageJUIPrev:"",sPageButton:"paginate_button",sPageButtonActive:"paginate_active",
|
17 |
-
sPageButtonStaticDisabled:"paginate_button paginate_button_disabled",sPageFirst:"first",sPagePrevious:"previous",sPageNext:"next",sPageLast:"last",sStripeOdd:"odd",sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled",
|
18 |
-
sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:""};n.oJUIClasses={sPagePrevEnabled:"fg-button ui-button ui-state-default ui-corner-left",
|
19 |
-
sPagePrevDisabled:"fg-button ui-button ui-state-default ui-corner-left ui-state-disabled",sPageNextEnabled:"fg-button ui-button ui-state-default ui-corner-right",sPageNextDisabled:"fg-button ui-button ui-state-default ui-corner-right ui-state-disabled",sPageJUINext:"ui-icon ui-icon-circle-arrow-e",sPageJUIPrev:"ui-icon ui-icon-circle-arrow-w",sPageButton:"fg-button ui-button ui-state-default",sPageButtonActive:"fg-button ui-button ui-state-default ui-state-disabled",sPageButtonStaticDisabled:"fg-button ui-button ui-state-default ui-state-disabled",
|
20 |
-
sPageFirst:"first ui-corner-tl ui-corner-bl",sPagePrevious:"previous",sPageNext:"next",sPageLast:"last ui-corner-tr ui-corner-br",sStripeOdd:"odd",sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"ui-state-default",sSortDesc:"ui-state-default",sSortable:"ui-state-default",
|
21 |
-
sSortableAsc:"ui-state-default",sSortableDesc:"ui-state-default",sSortableNone:"ui-state-default",sSortColumn:"sorting_",sSortJUIAsc:"css_right ui-icon ui-icon-triangle-1-n",sSortJUIDesc:"css_right ui-icon ui-icon-triangle-1-s",sSortJUI:"css_right ui-icon ui-icon-carat-2-n-s",sSortJUIAscAllowed:"css_right ui-icon ui-icon-carat-1-n",sSortJUIDescAllowed:"css_right ui-icon ui-icon-carat-1-s",sSortJUIWrapper:"DataTables_sort_wrapper",sSortIcon:"DataTables_sort_icon",sScrollWrapper:"dataTables_scroll",
|
22 |
-
sScrollHead:"dataTables_scrollHead ui-state-default",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot ui-state-default",sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:"ui-state-default"};n.oPagination={two_button:{fnInit:function(g,l,s){var t,w,y;if(g.bJUI){t=p.createElement("a");w=p.createElement("a");y=p.createElement("span");y.className=g.oClasses.sPageJUINext;w.appendChild(y);y=p.createElement("span");y.className=g.oClasses.sPageJUIPrev;
|
23 |
-
t.appendChild(y)}else{t=p.createElement("div");w=p.createElement("div")}t.className=g.oClasses.sPagePrevDisabled;w.className=g.oClasses.sPageNextDisabled;t.title=g.oLanguage.oPaginate.sPrevious;w.title=g.oLanguage.oPaginate.sNext;l.appendChild(t);l.appendChild(w);i(t).bind("click.DT",function(){g.oApi._fnPageChange(g,"previous")&&s(g)});i(w).bind("click.DT",function(){g.oApi._fnPageChange(g,"next")&&s(g)});i(t).bind("selectstart.DT",function(){return false});i(w).bind("selectstart.DT",function(){return false});
|
24 |
-
if(g.sTableId!==""&&typeof g.aanFeatures.p=="undefined"){l.setAttribute("id",g.sTableId+"_paginate");t.setAttribute("id",g.sTableId+"_previous");w.setAttribute("id",g.sTableId+"_next")}},fnUpdate:function(g){if(g.aanFeatures.p)for(var l=g.aanFeatures.p,s=0,t=l.length;s<t;s++)if(l[s].childNodes.length!==0){l[s].childNodes[0].className=g._iDisplayStart===0?g.oClasses.sPagePrevDisabled:g.oClasses.sPagePrevEnabled;l[s].childNodes[1].className=g.fnDisplayEnd()==g.fnRecordsDisplay()?g.oClasses.sPageNextDisabled:
|
25 |
-
g.oClasses.sPageNextEnabled}}},iFullNumbersShowPages:5,full_numbers:{fnInit:function(g,l,s){var t=p.createElement("span"),w=p.createElement("span"),y=p.createElement("span"),F=p.createElement("span"),x=p.createElement("span");t.innerHTML=g.oLanguage.oPaginate.sFirst;w.innerHTML=g.oLanguage.oPaginate.sPrevious;F.innerHTML=g.oLanguage.oPaginate.sNext;x.innerHTML=g.oLanguage.oPaginate.sLast;var v=g.oClasses;t.className=v.sPageButton+" "+v.sPageFirst;w.className=v.sPageButton+" "+v.sPagePrevious;F.className=
|
26 |
-
v.sPageButton+" "+v.sPageNext;x.className=v.sPageButton+" "+v.sPageLast;l.appendChild(t);l.appendChild(w);l.appendChild(y);l.appendChild(F);l.appendChild(x);i(t).bind("click.DT",function(){g.oApi._fnPageChange(g,"first")&&s(g)});i(w).bind("click.DT",function(){g.oApi._fnPageChange(g,"previous")&&s(g)});i(F).bind("click.DT",function(){g.oApi._fnPageChange(g,"next")&&s(g)});i(x).bind("click.DT",function(){g.oApi._fnPageChange(g,"last")&&s(g)});i("span",l).bind("mousedown.DT",function(){return false}).bind("selectstart.DT",
|
27 |
-
function(){return false});if(g.sTableId!==""&&typeof g.aanFeatures.p=="undefined"){l.setAttribute("id",g.sTableId+"_paginate");t.setAttribute("id",g.sTableId+"_first");w.setAttribute("id",g.sTableId+"_previous");F.setAttribute("id",g.sTableId+"_next");x.setAttribute("id",g.sTableId+"_last")}},fnUpdate:function(g,l){if(g.aanFeatures.p){var s=n.oPagination.iFullNumbersShowPages,t=Math.floor(s/2),w=Math.ceil(g.fnRecordsDisplay()/g._iDisplayLength),y=Math.ceil(g._iDisplayStart/g._iDisplayLength)+1,F=
|
28 |
-
"",x,v=g.oClasses;if(w<s){t=1;x=w}else if(y<=t){t=1;x=s}else if(y>=w-t){t=w-s+1;x=w}else{t=y-Math.ceil(s/2)+1;x=t+s-1}for(s=t;s<=x;s++)F+=y!=s?'<span class="'+v.sPageButton+'">'+s+"</span>":'<span class="'+v.sPageButtonActive+'">'+s+"</span>";x=g.aanFeatures.p;var z,$=function(M){g._iDisplayStart=(this.innerHTML*1-1)*g._iDisplayLength;l(g);M.preventDefault()},X=function(){return false};s=0;for(t=x.length;s<t;s++)if(x[s].childNodes.length!==0){z=i("span:eq(2)",x[s]);z.html(F);i("span",z).bind("click.DT",
|
29 |
-
$).bind("mousedown.DT",X).bind("selectstart.DT",X);z=x[s].getElementsByTagName("span");z=[z[0],z[1],z[z.length-2],z[z.length-1]];i(z).removeClass(v.sPageButton+" "+v.sPageButtonActive+" "+v.sPageButtonStaticDisabled);if(y==1){z[0].className+=" "+v.sPageButtonStaticDisabled;z[1].className+=" "+v.sPageButtonStaticDisabled}else{z[0].className+=" "+v.sPageButton;z[1].className+=" "+v.sPageButton}if(w===0||y==w||g._iDisplayLength==-1){z[2].className+=" "+v.sPageButtonStaticDisabled;z[3].className+=" "+
|
30 |
-
v.sPageButtonStaticDisabled}else{z[2].className+=" "+v.sPageButton;z[3].className+=" "+v.sPageButton}}}}}};n.oSort={"string-asc":function(g,l){if(typeof g!="string")g="";if(typeof l!="string")l="";g=g.toLowerCase();l=l.toLowerCase();return g<l?-1:g>l?1:0},"string-desc":function(g,l){if(typeof g!="string")g="";if(typeof l!="string")l="";g=g.toLowerCase();l=l.toLowerCase();return g<l?1:g>l?-1:0},"html-asc":function(g,l){g=g.replace(/<.*?>/g,"").toLowerCase();l=l.replace(/<.*?>/g,"").toLowerCase();return g<
|
31 |
-
l?-1:g>l?1:0},"html-desc":function(g,l){g=g.replace(/<.*?>/g,"").toLowerCase();l=l.replace(/<.*?>/g,"").toLowerCase();return g<l?1:g>l?-1:0},"date-asc":function(g,l){g=Date.parse(g);l=Date.parse(l);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(l)||l==="")l=Date.parse("01/01/1970 00:00:00");return g-l},"date-desc":function(g,l){g=Date.parse(g);l=Date.parse(l);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(l)||l==="")l=Date.parse("01/01/1970 00:00:00");return l-
|
32 |
-
g},"numeric-asc":function(g,l){return(g=="-"||g===""?0:g*1)-(l=="-"||l===""?0:l*1)},"numeric-desc":function(g,l){return(l=="-"||l===""?0:l*1)-(g=="-"||g===""?0:g*1)}};n.aTypes=[function(g){if(typeof g=="number")return"numeric";else if(typeof g!="string")return null;var l,s=false;l=g.charAt(0);if("0123456789-".indexOf(l)==-1)return null;for(var t=1;t<g.length;t++){l=g.charAt(t);if("0123456789.".indexOf(l)==-1)return null;if(l=="."){if(s)return null;s=true}}return"numeric"},function(g){var l=Date.parse(g);
|
33 |
-
if(l!==null&&!isNaN(l)||typeof g=="string"&&g.length===0)return"date";return null},function(g){if(typeof g=="string"&&g.indexOf("<")!=-1&&g.indexOf(">")!=-1)return"html";return null}];n.fnVersionCheck=function(g){var l=function(x,v){for(;x.length<v;)x+="0";return x},s=n.sVersion.split(".");g=g.split(".");for(var t="",w="",y=0,F=g.length;y<F;y++){t+=l(s[y],3);w+=l(g[y],3)}return parseInt(t,10)>=parseInt(w,10)};n._oExternConfig={iNextUnique:0};i.fn.dataTable=function(g){function l(){this.fnRecordsTotal=
|
34 |
-
function(){return this.oFeatures.bServerSide?parseInt(this._iRecordsTotal,10):this.aiDisplayMaster.length};this.fnRecordsDisplay=function(){return this.oFeatures.bServerSide?parseInt(this._iRecordsDisplay,10):this.aiDisplay.length};this.fnDisplayEnd=function(){return this.oFeatures.bServerSide?this.oFeatures.bPaginate===false||this._iDisplayLength==-1?this._iDisplayStart+this.aiDisplay.length:Math.min(this._iDisplayStart+this._iDisplayLength,this._iRecordsDisplay):this._iDisplayEnd};this.sInstance=
|
35 |
-
this.oInstance=null;this.oFeatures={bPaginate:true,bLengthChange:true,bFilter:true,bSort:true,bInfo:true,bAutoWidth:true,bProcessing:false,bSortClasses:true,bStateSave:false,bServerSide:false,bDeferRender:false};this.oScroll={sX:"",sXInner:"",sY:"",bCollapse:false,bInfinite:false,iLoadGap:100,iBarWidth:0,bAutoCss:true};this.aanFeatures=[];this.oLanguage={sProcessing:"Processing...",sLengthMenu:"Show _MENU_ entries",sZeroRecords:"No matching records found",sEmptyTable:"No data available in table",
|
36 |
-
sLoadingRecords:"Loading...",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sInfoThousands:",",sSearch:"Search:",sUrl:"",oPaginate:{sFirst:"First",sPrevious:"Previous",sNext:"Next",sLast:"Last"},fnInfoCallback:null};this.aoData=[];this.aiDisplay=[];this.aiDisplayMaster=[];this.aoColumns=[];this.aoHeader=[];this.aoFooter=[];this.iNextId=0;this.asDataSearch=[];this.oPreviousSearch={sSearch:"",
|
37 |
-
bRegex:false,bSmart:true};this.aoPreSearchCols=[];this.aaSorting=[[0,"asc",0]];this.aaSortingFixed=null;this.asStripeClasses=[];this.asDestroyStripes=[];this.sDestroyWidth=0;this.fnFooterCallback=this.fnHeaderCallback=this.fnRowCallback=null;this.aoDrawCallback=[];this.fnInitComplete=this.fnPreDrawCallback=null;this.sTableId="";this.nTableWrapper=this.nTBody=this.nTFoot=this.nTHead=this.nTable=null;this.bInitialised=this.bDeferLoading=false;this.aoOpenRows=[];this.sDom="lfrtip";this.sPaginationType=
|
38 |
-
"two_button";this.iCookieDuration=7200;this.sCookiePrefix="SpryMedia_DataTables_";this.fnCookieCallback=null;this.aoStateSave=[];this.aoStateLoad=[];this.sAjaxSource=this.oLoadedState=null;this.sAjaxDataProp="aaData";this.bAjaxDataGet=true;this.jqXHR=null;this.fnServerData=function(a,b,c,d){d.jqXHR=i.ajax({url:a,data:b,success:function(f){i(d.oInstance).trigger("xhr",d);c(f)},dataType:"json",cache:false,error:function(f,e){e=="parsererror"&&alert("DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.")}})};
|
39 |
-
this.aoServerParams=[];this.fnFormatNumber=function(a){if(a<1E3)return a;else{var b=a+"";a=b.split("");var c="";b=b.length;for(var d=0;d<b;d++){if(d%3===0&&d!==0)c=this.oLanguage.sInfoThousands+c;c=a[b-d-1]+c}}return c};this.aLengthMenu=[10,25,50,100];this.bDrawing=this.iDraw=0;this.iDrawError=-1;this._iDisplayLength=10;this._iDisplayStart=0;this._iDisplayEnd=10;this._iRecordsDisplay=this._iRecordsTotal=0;this.bJUI=false;this.oClasses=n.oStdClasses;this.bSortCellsTop=this.bSorted=this.bFiltered=false;
|
40 |
-
this.oInit=null;this.aoDestroyCallback=[]}function s(a){return function(){var b=[A(this[n.iApiIndex])].concat(Array.prototype.slice.call(arguments));return n.oApi[a].apply(this,b)}}function t(a){var b,c,d=a.iInitDisplayStart;if(a.bInitialised===false)setTimeout(function(){t(a)},200);else{Aa(a);X(a);M(a,a.aoHeader);a.nTFoot&&M(a,a.aoFooter);K(a,true);a.oFeatures.bAutoWidth&&ga(a);b=0;for(c=a.aoColumns.length;b<c;b++)if(a.aoColumns[b].sWidth!==null)a.aoColumns[b].nTh.style.width=q(a.aoColumns[b].sWidth);
|
41 |
-
if(a.oFeatures.bSort)R(a);else if(a.oFeatures.bFilter)N(a,a.oPreviousSearch);else{a.aiDisplay=a.aiDisplayMaster.slice();E(a);C(a)}if(a.sAjaxSource!==null&&!a.oFeatures.bServerSide){c=[];ha(a,c);a.fnServerData.call(a.oInstance,a.sAjaxSource,c,function(f){var e=f;if(a.sAjaxDataProp!=="")e=aa(a.sAjaxDataProp)(f);for(b=0;b<e.length;b++)v(a,e[b]);a.iInitDisplayStart=d;if(a.oFeatures.bSort)R(a);else{a.aiDisplay=a.aiDisplayMaster.slice();E(a);C(a)}K(a,false);w(a,f)},a)}else if(!a.oFeatures.bServerSide){K(a,
|
42 |
-
false);w(a)}}}function w(a,b){a._bInitComplete=true;if(typeof a.fnInitComplete=="function")typeof b!="undefined"?a.fnInitComplete.call(a.oInstance,a,b):a.fnInitComplete.call(a.oInstance,a)}function y(a,b,c){a.oLanguage=i.extend(true,a.oLanguage,b);typeof b.sEmptyTable=="undefined"&&typeof b.sZeroRecords!="undefined"&&o(a.oLanguage,b,"sZeroRecords","sEmptyTable");typeof b.sLoadingRecords=="undefined"&&typeof b.sZeroRecords!="undefined"&&o(a.oLanguage,b,"sZeroRecords","sLoadingRecords");c&&t(a)}function F(a,
|
43 |
-
b){var c=a.aoColumns.length;b={sType:null,_bAutoType:true,bVisible:true,bSearchable:true,bSortable:true,asSorting:["asc","desc"],sSortingClass:a.oClasses.sSortable,sSortingClassJUI:a.oClasses.sSortJUI,sTitle:b?b.innerHTML:"",sName:"",sWidth:null,sWidthOrig:null,sClass:null,fnRender:null,bUseRendered:true,iDataSort:c,mDataProp:c,fnGetData:null,fnSetData:null,sSortDataType:"std",sDefaultContent:null,sContentPadding:"",nTh:b?b:p.createElement("th"),nTf:null};a.aoColumns.push(b);if(typeof a.aoPreSearchCols[c]==
|
44 |
-
"undefined"||a.aoPreSearchCols[c]===null)a.aoPreSearchCols[c]={sSearch:"",bRegex:false,bSmart:true};else{if(typeof a.aoPreSearchCols[c].bRegex=="undefined")a.aoPreSearchCols[c].bRegex=true;if(typeof a.aoPreSearchCols[c].bSmart=="undefined")a.aoPreSearchCols[c].bSmart=true}x(a,c,null)}function x(a,b,c){b=a.aoColumns[b];if(typeof c!="undefined"&&c!==null){if(typeof c.sType!="undefined"){b.sType=c.sType;b._bAutoType=false}o(b,c,"bVisible");o(b,c,"bSearchable");o(b,c,"bSortable");o(b,c,"sTitle");o(b,
|
45 |
-
c,"sName");o(b,c,"sWidth");o(b,c,"sWidth","sWidthOrig");o(b,c,"sClass");o(b,c,"fnRender");o(b,c,"bUseRendered");o(b,c,"iDataSort");o(b,c,"mDataProp");o(b,c,"asSorting");o(b,c,"sSortDataType");o(b,c,"sDefaultContent");o(b,c,"sContentPadding")}b.fnGetData=aa(b.mDataProp);b.fnSetData=Ba(b.mDataProp);if(!a.oFeatures.bSort)b.bSortable=false;if(!b.bSortable||i.inArray("asc",b.asSorting)==-1&&i.inArray("desc",b.asSorting)==-1){b.sSortingClass=a.oClasses.sSortableNone;b.sSortingClassJUI=""}else if(b.bSortable||
|
46 |
-
i.inArray("asc",b.asSorting)==-1&&i.inArray("desc",b.asSorting)==-1){b.sSortingClass=a.oClasses.sSortable;b.sSortingClassJUI=a.oClasses.sSortJUI}else if(i.inArray("asc",b.asSorting)!=-1&&i.inArray("desc",b.asSorting)==-1){b.sSortingClass=a.oClasses.sSortableAsc;b.sSortingClassJUI=a.oClasses.sSortJUIAscAllowed}else if(i.inArray("asc",b.asSorting)==-1&&i.inArray("desc",b.asSorting)!=-1){b.sSortingClass=a.oClasses.sSortableDesc;b.sSortingClassJUI=a.oClasses.sSortJUIDescAllowed}}function v(a,b){var c;
|
47 |
-
c=i.isArray(b)?b.slice():i.extend(true,{},b);b=a.aoData.length;var d={nTr:null,_iId:a.iNextId++,_aData:c,_anHidden:[],_sRowStripe:""};a.aoData.push(d);for(var f,e=0,h=a.aoColumns.length;e<h;e++){c=a.aoColumns[e];typeof c.fnRender=="function"&&c.bUseRendered&&c.mDataProp!==null&&O(a,b,e,c.fnRender({iDataRow:b,iDataColumn:e,aData:d._aData,oSettings:a}));if(c._bAutoType&&c.sType!="string"){f=G(a,b,e,"type");if(f!==null&&f!==""){f=ia(f);if(c.sType===null)c.sType=f;else if(c.sType!=f&&c.sType!="html")c.sType=
|
48 |
-
"string"}}}a.aiDisplayMaster.push(b);a.oFeatures.bDeferRender||z(a,b);return b}function z(a,b){var c=a.aoData[b],d;if(c.nTr===null){c.nTr=p.createElement("tr");typeof c._aData.DT_RowId!="undefined"&&c.nTr.setAttribute("id",c._aData.DT_RowId);typeof c._aData.DT_RowClass!="undefined"&&i(c.nTr).addClass(c._aData.DT_RowClass);for(var f=0,e=a.aoColumns.length;f<e;f++){var h=a.aoColumns[f];d=p.createElement("td");d.innerHTML=typeof h.fnRender=="function"&&(!h.bUseRendered||h.mDataProp===null)?h.fnRender({iDataRow:b,
|
49 |
-
iDataColumn:f,aData:c._aData,oSettings:a}):G(a,b,f,"display");if(h.sClass!==null)d.className=h.sClass;if(h.bVisible){c.nTr.appendChild(d);c._anHidden[f]=null}else c._anHidden[f]=d}}}function $(a){var b,c,d,f,e,h,j,k,m;if(a.bDeferLoading||a.sAjaxSource===null){j=a.nTBody.childNodes;b=0;for(c=j.length;b<c;b++)if(j[b].nodeName.toUpperCase()=="TR"){k=a.aoData.length;a.aoData.push({nTr:j[b],_iId:a.iNextId++,_aData:[],_anHidden:[],_sRowStripe:""});a.aiDisplayMaster.push(k);h=j[b].childNodes;d=e=0;for(f=
|
50 |
-
h.length;d<f;d++){m=h[d].nodeName.toUpperCase();if(m=="TD"||m=="TH"){O(a,k,e,i.trim(h[d].innerHTML));e++}}}}j=ba(a);h=[];b=0;for(c=j.length;b<c;b++){d=0;for(f=j[b].childNodes.length;d<f;d++){e=j[b].childNodes[d];m=e.nodeName.toUpperCase();if(m=="TD"||m=="TH")h.push(e)}}h.length!=j.length*a.aoColumns.length&&J(a,1,"Unexpected number of TD elements. Expected "+j.length*a.aoColumns.length+" and got "+h.length+". DataTables does not support rowspan / colspan in the table body, and there must be one cell for each row/column combination.");
|
51 |
-
d=0;for(f=a.aoColumns.length;d<f;d++){if(a.aoColumns[d].sTitle===null)a.aoColumns[d].sTitle=a.aoColumns[d].nTh.innerHTML;j=a.aoColumns[d]._bAutoType;m=typeof a.aoColumns[d].fnRender=="function";e=a.aoColumns[d].sClass!==null;k=a.aoColumns[d].bVisible;var u,r;if(j||m||e||!k){b=0;for(c=a.aoData.length;b<c;b++){u=h[b*f+d];if(j&&a.aoColumns[d].sType!="string"){r=G(a,b,d,"type");if(r!==""){r=ia(r);if(a.aoColumns[d].sType===null)a.aoColumns[d].sType=r;else if(a.aoColumns[d].sType!=r&&a.aoColumns[d].sType!=
|
52 |
-
"html")a.aoColumns[d].sType="string"}}if(m){r=a.aoColumns[d].fnRender({iDataRow:b,iDataColumn:d,aData:a.aoData[b]._aData,oSettings:a});u.innerHTML=r;a.aoColumns[d].bUseRendered&&O(a,b,d,r)}if(e)u.className+=" "+a.aoColumns[d].sClass;if(k)a.aoData[b]._anHidden[d]=null;else{a.aoData[b]._anHidden[d]=u;u.parentNode.removeChild(u)}}}}}function X(a){var b,c,d;a.nTHead.getElementsByTagName("tr");if(a.nTHead.getElementsByTagName("th").length!==0){b=0;for(d=a.aoColumns.length;b<d;b++){c=a.aoColumns[b].nTh;
|
53 |
-
a.aoColumns[b].sClass!==null&&i(c).addClass(a.aoColumns[b].sClass);if(a.aoColumns[b].sTitle!=c.innerHTML)c.innerHTML=a.aoColumns[b].sTitle}}else{var f=p.createElement("tr");b=0;for(d=a.aoColumns.length;b<d;b++){c=a.aoColumns[b].nTh;c.innerHTML=a.aoColumns[b].sTitle;a.aoColumns[b].sClass!==null&&i(c).addClass(a.aoColumns[b].sClass);f.appendChild(c)}i(a.nTHead).html("")[0].appendChild(f);Y(a.aoHeader,a.nTHead)}if(a.bJUI){b=0;for(d=a.aoColumns.length;b<d;b++){c=a.aoColumns[b].nTh;f=p.createElement("div");
|
54 |
-
f.className=a.oClasses.sSortJUIWrapper;i(c).contents().appendTo(f);var e=p.createElement("span");e.className=a.oClasses.sSortIcon;f.appendChild(e);c.appendChild(f)}}d=function(){this.onselectstart=function(){return false};return false};if(a.oFeatures.bSort)for(b=0;b<a.aoColumns.length;b++)if(a.aoColumns[b].bSortable!==false){ja(a,a.aoColumns[b].nTh,b);i(a.aoColumns[b].nTh).bind("mousedown.DT",d)}else i(a.aoColumns[b].nTh).addClass(a.oClasses.sSortableNone);a.oClasses.sFooterTH!==""&&i(a.nTFoot).children("tr").children("th").addClass(a.oClasses.sFooterTH);
|
55 |
-
if(a.nTFoot!==null){c=S(a,null,a.aoFooter);b=0;for(d=a.aoColumns.length;b<d;b++)if(typeof c[b]!="undefined")a.aoColumns[b].nTf=c[b]}}function M(a,b,c){var d,f,e,h=[],j=[],k=a.aoColumns.length;if(typeof c=="undefined")c=false;d=0;for(f=b.length;d<f;d++){h[d]=b[d].slice();h[d].nTr=b[d].nTr;for(e=k-1;e>=0;e--)!a.aoColumns[e].bVisible&&!c&&h[d].splice(e,1);j.push([])}d=0;for(f=h.length;d<f;d++){if(h[d].nTr){a=0;for(e=h[d].nTr.childNodes.length;a<e;a++)h[d].nTr.removeChild(h[d].nTr.childNodes[0])}e=0;
|
56 |
-
for(b=h[d].length;e<b;e++){k=c=1;if(typeof j[d][e]=="undefined"){h[d].nTr.appendChild(h[d][e].cell);for(j[d][e]=1;typeof h[d+c]!="undefined"&&h[d][e].cell==h[d+c][e].cell;){j[d+c][e]=1;c++}for(;typeof h[d][e+k]!="undefined"&&h[d][e].cell==h[d][e+k].cell;){for(a=0;a<c;a++)j[d+a][e+k]=1;k++}h[d][e].cell.rowSpan=c;h[d][e].cell.colSpan=k}}}}function C(a){var b,c,d=[],f=0,e=false;b=a.asStripeClasses.length;c=a.aoOpenRows.length;if(!(a.fnPreDrawCallback!==null&&a.fnPreDrawCallback.call(a.oInstance,a)===
|
57 |
-
false)){a.bDrawing=true;if(typeof a.iInitDisplayStart!="undefined"&&a.iInitDisplayStart!=-1){a._iDisplayStart=a.oFeatures.bServerSide?a.iInitDisplayStart:a.iInitDisplayStart>=a.fnRecordsDisplay()?0:a.iInitDisplayStart;a.iInitDisplayStart=-1;E(a)}if(a.bDeferLoading){a.bDeferLoading=false;a.iDraw++}else if(a.oFeatures.bServerSide){if(!a.bDestroying&&!Ca(a))return}else a.iDraw++;if(a.aiDisplay.length!==0){var h=a._iDisplayStart,j=a._iDisplayEnd;if(a.oFeatures.bServerSide){h=0;j=a.aoData.length}for(h=
|
58 |
-
h;h<j;h++){var k=a.aoData[a.aiDisplay[h]];k.nTr===null&&z(a,a.aiDisplay[h]);var m=k.nTr;if(b!==0){var u=a.asStripeClasses[f%b];if(k._sRowStripe!=u){i(m).removeClass(k._sRowStripe).addClass(u);k._sRowStripe=u}}if(typeof a.fnRowCallback=="function"){m=a.fnRowCallback.call(a.oInstance,m,a.aoData[a.aiDisplay[h]]._aData,f,h);if(!m&&!e){J(a,0,"A node was not returned by fnRowCallback");e=true}}d.push(m);f++;if(c!==0)for(k=0;k<c;k++)m==a.aoOpenRows[k].nParent&&d.push(a.aoOpenRows[k].nTr)}}else{d[0]=p.createElement("tr");
|
59 |
-
if(typeof a.asStripeClasses[0]!="undefined")d[0].className=a.asStripeClasses[0];e=a.oLanguage.sZeroRecords.replace("_MAX_",a.fnFormatNumber(a.fnRecordsTotal()));if(a.iDraw==1&&a.sAjaxSource!==null&&!a.oFeatures.bServerSide)e=a.oLanguage.sLoadingRecords;else if(typeof a.oLanguage.sEmptyTable!="undefined"&&a.fnRecordsTotal()===0)e=a.oLanguage.sEmptyTable;b=p.createElement("td");b.setAttribute("valign","top");b.colSpan=Z(a);b.className=a.oClasses.sRowEmpty;b.innerHTML=e;d[f].appendChild(b)}typeof a.fnHeaderCallback==
|
60 |
-
"function"&&a.fnHeaderCallback.call(a.oInstance,i(a.nTHead).children("tr")[0],ca(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay);typeof a.fnFooterCallback=="function"&&a.fnFooterCallback.call(a.oInstance,i(a.nTFoot).children("tr")[0],ca(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay);f=p.createDocumentFragment();b=p.createDocumentFragment();if(a.nTBody){e=a.nTBody.parentNode;b.appendChild(a.nTBody);if(!a.oScroll.bInfinite||!a._bInitComplete||a.bSorted||a.bFiltered){c=a.nTBody.childNodes;for(b=
|
61 |
-
c.length-1;b>=0;b--)c[b].parentNode.removeChild(c[b])}b=0;for(c=d.length;b<c;b++)f.appendChild(d[b]);a.nTBody.appendChild(f);e!==null&&e.appendChild(a.nTBody)}for(b=a.aoDrawCallback.length-1;b>=0;b--)a.aoDrawCallback[b].fn.call(a.oInstance,a);i(a.oInstance).trigger("draw",a);a.bSorted=false;a.bFiltered=false;a.bDrawing=false;if(a.oFeatures.bServerSide){K(a,false);typeof a._bInitComplete=="undefined"&&w(a)}}}function da(a){if(a.oFeatures.bSort)R(a,a.oPreviousSearch);else if(a.oFeatures.bFilter)N(a,
|
62 |
-
a.oPreviousSearch);else{E(a);C(a)}}function Ca(a){if(a.bAjaxDataGet){a.iDraw++;K(a,true);var b=Da(a);ha(a,b);a.fnServerData.call(a.oInstance,a.sAjaxSource,b,function(c){Ea(a,c)},a);return false}else return true}function Da(a){var b=a.aoColumns.length,c=[],d,f;c.push({name:"sEcho",value:a.iDraw});c.push({name:"iColumns",value:b});c.push({name:"sColumns",value:ka(a)});c.push({name:"iDisplayStart",value:a._iDisplayStart});c.push({name:"iDisplayLength",value:a.oFeatures.bPaginate!==false?a._iDisplayLength:
|
63 |
-
-1});for(f=0;f<b;f++){d=a.aoColumns[f].mDataProp;c.push({name:"mDataProp_"+f,value:typeof d=="function"?"function":d})}if(a.oFeatures.bFilter!==false){c.push({name:"sSearch",value:a.oPreviousSearch.sSearch});c.push({name:"bRegex",value:a.oPreviousSearch.bRegex});for(f=0;f<b;f++){c.push({name:"sSearch_"+f,value:a.aoPreSearchCols[f].sSearch});c.push({name:"bRegex_"+f,value:a.aoPreSearchCols[f].bRegex});c.push({name:"bSearchable_"+f,value:a.aoColumns[f].bSearchable})}}if(a.oFeatures.bSort!==false){d=
|
64 |
-
a.aaSortingFixed!==null?a.aaSortingFixed.length:0;var e=a.aaSorting.length;c.push({name:"iSortingCols",value:d+e});for(f=0;f<d;f++){c.push({name:"iSortCol_"+f,value:a.aaSortingFixed[f][0]});c.push({name:"sSortDir_"+f,value:a.aaSortingFixed[f][1]})}for(f=0;f<e;f++){c.push({name:"iSortCol_"+(f+d),value:a.aaSorting[f][0]});c.push({name:"sSortDir_"+(f+d),value:a.aaSorting[f][1]})}for(f=0;f<b;f++)c.push({name:"bSortable_"+f,value:a.aoColumns[f].bSortable})}return c}function ha(a,b){for(var c=0,d=a.aoServerParams.length;c<
|
65 |
-
d;c++)a.aoServerParams[c].fn.call(a.oInstance,b)}function Ea(a,b){if(typeof b.sEcho!="undefined")if(b.sEcho*1<a.iDraw)return;else a.iDraw=b.sEcho*1;if(!a.oScroll.bInfinite||a.oScroll.bInfinite&&(a.bSorted||a.bFiltered))la(a);a._iRecordsTotal=b.iTotalRecords;a._iRecordsDisplay=b.iTotalDisplayRecords;var c=ka(a);if(c=typeof b.sColumns!="undefined"&&c!==""&&b.sColumns!=c)var d=Fa(a,b.sColumns);b=aa(a.sAjaxDataProp)(b);for(var f=0,e=b.length;f<e;f++)if(c){for(var h=[],j=0,k=a.aoColumns.length;j<k;j++)h.push(b[f][d[j]]);
|
66 |
-
v(a,h)}else v(a,b[f]);a.aiDisplay=a.aiDisplayMaster.slice();a.bAjaxDataGet=false;C(a);a.bAjaxDataGet=true;K(a,false)}function Aa(a){var b=p.createElement("div");a.nTable.parentNode.insertBefore(b,a.nTable);a.nTableWrapper=p.createElement("div");a.nTableWrapper.className=a.oClasses.sWrapper;a.sTableId!==""&&a.nTableWrapper.setAttribute("id",a.sTableId+"_wrapper");a.nTableReinsertBefore=a.nTable.nextSibling;for(var c=a.nTableWrapper,d=a.sDom.split(""),f,e,h,j,k,m,u,r=0;r<d.length;r++){e=0;h=d[r];if(h==
|
67 |
-
"<"){j=p.createElement("div");k=d[r+1];if(k=="'"||k=='"'){m="";for(u=2;d[r+u]!=k;){m+=d[r+u];u++}if(m=="H")m="fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix";else if(m=="F")m="fg-toolbar ui-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix";if(m.indexOf(".")!=-1){k=m.split(".");j.setAttribute("id",k[0].substr(1,k[0].length-1));j.className=k[1]}else if(m.charAt(0)=="#")j.setAttribute("id",m.substr(1,m.length-1));else j.className=m;r+=u}c.appendChild(j);
|
68 |
-
c=j}else if(h==">")c=c.parentNode;else if(h=="l"&&a.oFeatures.bPaginate&&a.oFeatures.bLengthChange){f=Ga(a);e=1}else if(h=="f"&&a.oFeatures.bFilter){f=Ha(a);e=1}else if(h=="r"&&a.oFeatures.bProcessing){f=Ia(a);e=1}else if(h=="t"){f=Ja(a);e=1}else if(h=="i"&&a.oFeatures.bInfo){f=Ka(a);e=1}else if(h=="p"&&a.oFeatures.bPaginate){f=La(a);e=1}else if(n.aoFeatures.length!==0){j=n.aoFeatures;u=0;for(k=j.length;u<k;u++)if(h==j[u].cFeature){if(f=j[u].fnInit(a))e=1;break}}if(e==1&&f!==null){if(typeof a.aanFeatures[h]!=
|
69 |
-
"object")a.aanFeatures[h]=[];a.aanFeatures[h].push(f);c.appendChild(f)}}b.parentNode.replaceChild(a.nTableWrapper,b)}function Ja(a){if(a.oScroll.sX===""&&a.oScroll.sY==="")return a.nTable;var b=p.createElement("div"),c=p.createElement("div"),d=p.createElement("div"),f=p.createElement("div"),e=p.createElement("div"),h=p.createElement("div"),j=a.nTable.cloneNode(false),k=a.nTable.cloneNode(false),m=a.nTable.getElementsByTagName("thead")[0],u=a.nTable.getElementsByTagName("tfoot").length===0?null:a.nTable.getElementsByTagName("tfoot")[0],
|
70 |
-
r=typeof g.bJQueryUI!="undefined"&&g.bJQueryUI?n.oJUIClasses:n.oStdClasses;c.appendChild(d);e.appendChild(h);f.appendChild(a.nTable);b.appendChild(c);b.appendChild(f);d.appendChild(j);j.appendChild(m);if(u!==null){b.appendChild(e);h.appendChild(k);k.appendChild(u)}b.className=r.sScrollWrapper;c.className=r.sScrollHead;d.className=r.sScrollHeadInner;f.className=r.sScrollBody;e.className=r.sScrollFoot;h.className=r.sScrollFootInner;if(a.oScroll.bAutoCss){c.style.overflow="hidden";c.style.position="relative";
|
71 |
-
e.style.overflow="hidden";f.style.overflow="auto"}c.style.border="0";c.style.width="100%";e.style.border="0";d.style.width="150%";j.removeAttribute("id");j.style.marginLeft="0";a.nTable.style.marginLeft="0";if(u!==null){k.removeAttribute("id");k.style.marginLeft="0"}d=i(a.nTable).children("caption");h=0;for(k=d.length;h<k;h++)j.appendChild(d[h]);if(a.oScroll.sX!==""){c.style.width=q(a.oScroll.sX);f.style.width=q(a.oScroll.sX);if(u!==null)e.style.width=q(a.oScroll.sX);i(f).scroll(function(){c.scrollLeft=
|
72 |
-
this.scrollLeft;if(u!==null)e.scrollLeft=this.scrollLeft})}if(a.oScroll.sY!=="")f.style.height=q(a.oScroll.sY);a.aoDrawCallback.push({fn:Ma,sName:"scrolling"});a.oScroll.bInfinite&&i(f).scroll(function(){if(!a.bDrawing)if(i(this).scrollTop()+i(this).height()>i(a.nTable).height()-a.oScroll.iLoadGap)if(a.fnDisplayEnd()<a.fnRecordsDisplay()){ma(a,"next");E(a);C(a)}});a.nScrollHead=c;a.nScrollFoot=e;return b}function Ma(a){var b=a.nScrollHead.getElementsByTagName("div")[0],c=b.getElementsByTagName("table")[0],
|
73 |
-
d=a.nTable.parentNode,f,e,h,j,k,m,u,r,H=[],L=a.nTFoot!==null?a.nScrollFoot.getElementsByTagName("div")[0]:null,T=a.nTFoot!==null?L.getElementsByTagName("table")[0]:null,B=i.browser.msie&&i.browser.version<=7;h=a.nTable.getElementsByTagName("thead");h.length>0&&a.nTable.removeChild(h[0]);if(a.nTFoot!==null){k=a.nTable.getElementsByTagName("tfoot");k.length>0&&a.nTable.removeChild(k[0])}h=a.nTHead.cloneNode(true);a.nTable.insertBefore(h,a.nTable.childNodes[0]);if(a.nTFoot!==null){k=a.nTFoot.cloneNode(true);
|
74 |
-
a.nTable.insertBefore(k,a.nTable.childNodes[1])}if(a.oScroll.sX===""){d.style.width="100%";b.parentNode.style.width="100%"}var U=S(a,h);f=0;for(e=U.length;f<e;f++){u=Na(a,f);U[f].style.width=a.aoColumns[u].sWidth}a.nTFoot!==null&&P(function(I){I.style.width=""},k.getElementsByTagName("tr"));f=i(a.nTable).outerWidth();if(a.oScroll.sX===""){a.nTable.style.width="100%";if(B&&(d.scrollHeight>d.offsetHeight||i(d).css("overflow-y")=="scroll"))a.nTable.style.width=q(i(a.nTable).outerWidth()-a.oScroll.iBarWidth)}else if(a.oScroll.sXInner!==
|
75 |
-
"")a.nTable.style.width=q(a.oScroll.sXInner);else if(f==i(d).width()&&i(d).height()<i(a.nTable).height()){a.nTable.style.width=q(f-a.oScroll.iBarWidth);if(i(a.nTable).outerWidth()>f-a.oScroll.iBarWidth)a.nTable.style.width=q(f)}else a.nTable.style.width=q(f);f=i(a.nTable).outerWidth();e=a.nTHead.getElementsByTagName("tr");h=h.getElementsByTagName("tr");P(function(I,na){m=I.style;m.paddingTop="0";m.paddingBottom="0";m.borderTopWidth="0";m.borderBottomWidth="0";m.height=0;r=i(I).width();na.style.width=
|
76 |
-
q(r);H.push(r)},h,e);i(h).height(0);if(a.nTFoot!==null){j=k.getElementsByTagName("tr");k=a.nTFoot.getElementsByTagName("tr");P(function(I,na){m=I.style;m.paddingTop="0";m.paddingBottom="0";m.borderTopWidth="0";m.borderBottomWidth="0";m.height=0;r=i(I).width();na.style.width=q(r);H.push(r)},j,k);i(j).height(0)}P(function(I){I.innerHTML="";I.style.width=q(H.shift())},h);a.nTFoot!==null&&P(function(I){I.innerHTML="";I.style.width=q(H.shift())},j);if(i(a.nTable).outerWidth()<f){j=d.scrollHeight>d.offsetHeight||
|
77 |
-
i(d).css("overflow-y")=="scroll"?f+a.oScroll.iBarWidth:f;if(B&&(d.scrollHeight>d.offsetHeight||i(d).css("overflow-y")=="scroll"))a.nTable.style.width=q(j-a.oScroll.iBarWidth);d.style.width=q(j);b.parentNode.style.width=q(j);if(a.nTFoot!==null)L.parentNode.style.width=q(j);if(a.oScroll.sX==="")J(a,1,"The table cannot fit into the current element which will cause column misalignment. The table has been drawn at its minimum possible width.");else a.oScroll.sXInner!==""&&J(a,1,"The table cannot fit into the current element which will cause column misalignment. Increase the sScrollXInner value or remove it to allow automatic calculation")}else{d.style.width=
|
78 |
-
q("100%");b.parentNode.style.width=q("100%");if(a.nTFoot!==null)L.parentNode.style.width=q("100%")}if(a.oScroll.sY==="")if(B)d.style.height=q(a.nTable.offsetHeight+a.oScroll.iBarWidth);if(a.oScroll.sY!==""&&a.oScroll.bCollapse){d.style.height=q(a.oScroll.sY);B=a.oScroll.sX!==""&&a.nTable.offsetWidth>d.offsetWidth?a.oScroll.iBarWidth:0;if(a.nTable.offsetHeight<d.offsetHeight)d.style.height=q(i(a.nTable).height()+B)}B=i(a.nTable).outerWidth();c.style.width=q(B);b.style.width=q(B+a.oScroll.iBarWidth);
|
79 |
-
if(a.nTFoot!==null){L.style.width=q(a.nTable.offsetWidth+a.oScroll.iBarWidth);T.style.width=q(a.nTable.offsetWidth)}if(a.bSorted||a.bFiltered)d.scrollTop=0}function ea(a){if(a.oFeatures.bAutoWidth===false)return false;ga(a);for(var b=0,c=a.aoColumns.length;b<c;b++)a.aoColumns[b].nTh.style.width=a.aoColumns[b].sWidth}function Ha(a){var b=a.oLanguage.sSearch;b=b.indexOf("_INPUT_")!==-1?b.replace("_INPUT_",'<input type="text" />'):b===""?'<input type="text" />':b+' <input type="text" />';var c=p.createElement("div");
|
80 |
-
c.className=a.oClasses.sFilter;c.innerHTML="<label>"+b+"</label>";a.sTableId!==""&&typeof a.aanFeatures.f=="undefined"&&c.setAttribute("id",a.sTableId+"_filter");b=i("input",c);b.val(a.oPreviousSearch.sSearch.replace('"',"""));b.bind("keyup.DT",function(){for(var d=a.aanFeatures.f,f=0,e=d.length;f<e;f++)d[f]!=i(this).parents("div.dataTables_filter")[0]&&i("input",d[f]).val(this.value);this.value!=a.oPreviousSearch.sSearch&&N(a,{sSearch:this.value,bRegex:a.oPreviousSearch.bRegex,bSmart:a.oPreviousSearch.bSmart})});
|
81 |
-
b.bind("keypress.DT",function(d){if(d.keyCode==13)return false});return c}function N(a,b,c){Oa(a,b.sSearch,c,b.bRegex,b.bSmart);for(b=0;b<a.aoPreSearchCols.length;b++)Pa(a,a.aoPreSearchCols[b].sSearch,b,a.aoPreSearchCols[b].bRegex,a.aoPreSearchCols[b].bSmart);n.afnFiltering.length!==0&&Qa(a);a.bFiltered=true;i(a.oInstance).trigger("filter",a);a._iDisplayStart=0;E(a);C(a);oa(a,0)}function Qa(a){for(var b=n.afnFiltering,c=0,d=b.length;c<d;c++)for(var f=0,e=0,h=a.aiDisplay.length;e<h;e++){var j=a.aiDisplay[e-
|
82 |
-
f];if(!b[c](a,fa(a,j,"filter"),j)){a.aiDisplay.splice(e-f,1);f++}}}function Pa(a,b,c,d,f){if(b!==""){var e=0;b=pa(b,d,f);for(d=a.aiDisplay.length-1;d>=0;d--){f=qa(G(a,a.aiDisplay[d],c,"filter"),a.aoColumns[c].sType);if(!b.test(f)){a.aiDisplay.splice(d,1);e++}}}}function Oa(a,b,c,d,f){var e=pa(b,d,f);if(typeof c=="undefined"||c===null)c=0;if(n.afnFiltering.length!==0)c=1;if(b.length<=0){a.aiDisplay.splice(0,a.aiDisplay.length);a.aiDisplay=a.aiDisplayMaster.slice()}else if(a.aiDisplay.length==a.aiDisplayMaster.length||
|
83 |
-
a.oPreviousSearch.sSearch.length>b.length||c==1||b.indexOf(a.oPreviousSearch.sSearch)!==0){a.aiDisplay.splice(0,a.aiDisplay.length);oa(a,1);for(c=0;c<a.aiDisplayMaster.length;c++)e.test(a.asDataSearch[c])&&a.aiDisplay.push(a.aiDisplayMaster[c])}else{var h=0;for(c=0;c<a.asDataSearch.length;c++)if(!e.test(a.asDataSearch[c])){a.aiDisplay.splice(c-h,1);h++}}a.oPreviousSearch.sSearch=b;a.oPreviousSearch.bRegex=d;a.oPreviousSearch.bSmart=f}function oa(a,b){if(!a.oFeatures.bServerSide){a.asDataSearch.splice(0,
|
84 |
-
a.asDataSearch.length);b=typeof b!="undefined"&&b==1?a.aiDisplayMaster:a.aiDisplay;for(var c=0,d=b.length;c<d;c++)a.asDataSearch[c]=ra(a,fa(a,b[c],"filter"))}}function ra(a,b){var c="";if(typeof a.__nTmpFilter=="undefined")a.__nTmpFilter=p.createElement("div");for(var d=a.__nTmpFilter,f=0,e=a.aoColumns.length;f<e;f++)if(a.aoColumns[f].bSearchable)c+=qa(b[f],a.aoColumns[f].sType)+" ";if(c.indexOf("&")!==-1){d.innerHTML=c;c=d.textContent?d.textContent:d.innerText;c=c.replace(/\n/g," ").replace(/\r/g,
|
85 |
-
"")}return c}function pa(a,b,c){if(c){a=b?a.split(" "):sa(a).split(" ");a="^(?=.*?"+a.join(")(?=.*?")+").*$";return new RegExp(a,"i")}else{a=b?a:sa(a);return new RegExp(a,"i")}}function qa(a,b){if(typeof n.ofnSearch[b]=="function")return n.ofnSearch[b](a);else if(b=="html")return a.replace(/\n/g," ").replace(/<.*?>/g,"");else if(typeof a=="string")return a.replace(/\n/g," ");else if(a===null)return"";return a}function R(a,b){var c,d,f,e,h=[],j=[],k=n.oSort;d=a.aoData;var m=a.aoColumns;if(!a.oFeatures.bServerSide&&
|
86 |
-
(a.aaSorting.length!==0||a.aaSortingFixed!==null)){h=a.aaSortingFixed!==null?a.aaSortingFixed.concat(a.aaSorting):a.aaSorting.slice();for(c=0;c<h.length;c++){var u=h[c][0];f=ta(a,u);e=a.aoColumns[u].sSortDataType;if(typeof n.afnSortData[e]!="undefined"){var r=n.afnSortData[e](a,u,f);f=0;for(e=d.length;f<e;f++)O(a,f,u,r[f])}}c=0;for(d=a.aiDisplayMaster.length;c<d;c++)j[a.aiDisplayMaster[c]]=c;var H=h.length;a.aiDisplayMaster.sort(function(L,T){var B,U;for(c=0;c<H;c++){B=m[h[c][0]].iDataSort;U=m[B].sType;
|
87 |
-
B=k[(U?U:"string")+"-"+h[c][1]](G(a,L,B,"sort"),G(a,T,B,"sort"));if(B!==0)return B}return k["numeric-asc"](j[L],j[T])})}if((typeof b=="undefined"||b)&&!a.oFeatures.bDeferRender)V(a);a.bSorted=true;i(a.oInstance).trigger("sort",a);if(a.oFeatures.bFilter)N(a,a.oPreviousSearch,1);else{a.aiDisplay=a.aiDisplayMaster.slice();a._iDisplayStart=0;E(a);C(a)}}function ja(a,b,c,d){i(b).bind("click.DT",function(f){if(a.aoColumns[c].bSortable!==false){var e=function(){var h,j;if(f.shiftKey){for(var k=false,m=0;m<
|
88 |
-
a.aaSorting.length;m++)if(a.aaSorting[m][0]==c){k=true;h=a.aaSorting[m][0];j=a.aaSorting[m][2]+1;if(typeof a.aoColumns[h].asSorting[j]=="undefined")a.aaSorting.splice(m,1);else{a.aaSorting[m][1]=a.aoColumns[h].asSorting[j];a.aaSorting[m][2]=j}break}k===false&&a.aaSorting.push([c,a.aoColumns[c].asSorting[0],0])}else if(a.aaSorting.length==1&&a.aaSorting[0][0]==c){h=a.aaSorting[0][0];j=a.aaSorting[0][2]+1;if(typeof a.aoColumns[h].asSorting[j]=="undefined")j=0;a.aaSorting[0][1]=a.aoColumns[h].asSorting[j];
|
89 |
-
a.aaSorting[0][2]=j}else{a.aaSorting.splice(0,a.aaSorting.length);a.aaSorting.push([c,a.aoColumns[c].asSorting[0],0])}R(a)};if(a.oFeatures.bProcessing){K(a,true);setTimeout(function(){e();a.oFeatures.bServerSide||K(a,false)},0)}else e();typeof d=="function"&&d(a)}})}function V(a){var b,c,d,f,e,h=a.aoColumns.length,j=a.oClasses;for(b=0;b<h;b++)a.aoColumns[b].bSortable&&i(a.aoColumns[b].nTh).removeClass(j.sSortAsc+" "+j.sSortDesc+" "+a.aoColumns[b].sSortingClass);f=a.aaSortingFixed!==null?a.aaSortingFixed.concat(a.aaSorting):
|
90 |
-
a.aaSorting.slice();for(b=0;b<a.aoColumns.length;b++)if(a.aoColumns[b].bSortable){e=a.aoColumns[b].sSortingClass;d=-1;for(c=0;c<f.length;c++)if(f[c][0]==b){e=f[c][1]=="asc"?j.sSortAsc:j.sSortDesc;d=c;break}i(a.aoColumns[b].nTh).addClass(e);if(a.bJUI){c=i("span",a.aoColumns[b].nTh);c.removeClass(j.sSortJUIAsc+" "+j.sSortJUIDesc+" "+j.sSortJUI+" "+j.sSortJUIAscAllowed+" "+j.sSortJUIDescAllowed);c.addClass(d==-1?a.aoColumns[b].sSortingClassJUI:f[d][1]=="asc"?j.sSortJUIAsc:j.sSortJUIDesc)}}else i(a.aoColumns[b].nTh).addClass(a.aoColumns[b].sSortingClass);
|
91 |
-
e=j.sSortColumn;if(a.oFeatures.bSort&&a.oFeatures.bSortClasses){d=Q(a);if(a.oFeatures.bDeferRender)i(d).removeClass(e+"1 "+e+"2 "+e+"3");else if(d.length>=h)for(b=0;b<h;b++)if(d[b].className.indexOf(e+"1")!=-1){c=0;for(a=d.length/h;c<a;c++)d[h*c+b].className=i.trim(d[h*c+b].className.replace(e+"1",""))}else if(d[b].className.indexOf(e+"2")!=-1){c=0;for(a=d.length/h;c<a;c++)d[h*c+b].className=i.trim(d[h*c+b].className.replace(e+"2",""))}else if(d[b].className.indexOf(e+"3")!=-1){c=0;for(a=d.length/
|
92 |
-
h;c<a;c++)d[h*c+b].className=i.trim(d[h*c+b].className.replace(" "+e+"3",""))}j=1;var k;for(b=0;b<f.length;b++){k=parseInt(f[b][0],10);c=0;for(a=d.length/h;c<a;c++)d[h*c+k].className+=" "+e+j;j<3&&j++}}}function La(a){if(a.oScroll.bInfinite)return null;var b=p.createElement("div");b.className=a.oClasses.sPaging+a.sPaginationType;n.oPagination[a.sPaginationType].fnInit(a,b,function(c){E(c);C(c)});typeof a.aanFeatures.p=="undefined"&&a.aoDrawCallback.push({fn:function(c){n.oPagination[c.sPaginationType].fnUpdate(c,
|
93 |
-
function(d){E(d);C(d)})},sName:"pagination"});return b}function ma(a,b){var c=a._iDisplayStart;if(b=="first")a._iDisplayStart=0;else if(b=="previous"){a._iDisplayStart=a._iDisplayLength>=0?a._iDisplayStart-a._iDisplayLength:0;if(a._iDisplayStart<0)a._iDisplayStart=0}else if(b=="next")if(a._iDisplayLength>=0){if(a._iDisplayStart+a._iDisplayLength<a.fnRecordsDisplay())a._iDisplayStart+=a._iDisplayLength}else a._iDisplayStart=0;else if(b=="last")if(a._iDisplayLength>=0){b=parseInt((a.fnRecordsDisplay()-
|
94 |
-
1)/a._iDisplayLength,10)+1;a._iDisplayStart=(b-1)*a._iDisplayLength}else a._iDisplayStart=0;else J(a,0,"Unknown paging action: "+b);i(a.oInstance).trigger("page",a);return c!=a._iDisplayStart}function Ka(a){var b=p.createElement("div");b.className=a.oClasses.sInfo;if(typeof a.aanFeatures.i=="undefined"){a.aoDrawCallback.push({fn:Ra,sName:"information"});a.sTableId!==""&&b.setAttribute("id",a.sTableId+"_info")}return b}function Ra(a){if(!(!a.oFeatures.bInfo||a.aanFeatures.i.length===0)){var b=a._iDisplayStart+
|
95 |
-
1,c=a.fnDisplayEnd(),d=a.fnRecordsTotal(),f=a.fnRecordsDisplay(),e=a.fnFormatNumber(b),h=a.fnFormatNumber(c),j=a.fnFormatNumber(d),k=a.fnFormatNumber(f);if(a.oScroll.bInfinite)e=a.fnFormatNumber(1);e=a.fnRecordsDisplay()===0&&a.fnRecordsDisplay()==a.fnRecordsTotal()?a.oLanguage.sInfoEmpty+a.oLanguage.sInfoPostFix:a.fnRecordsDisplay()===0?a.oLanguage.sInfoEmpty+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",j)+a.oLanguage.sInfoPostFix:a.fnRecordsDisplay()==a.fnRecordsTotal()?a.oLanguage.sInfo.replace("_START_",
|
96 |
-
e).replace("_END_",h).replace("_TOTAL_",k)+a.oLanguage.sInfoPostFix:a.oLanguage.sInfo.replace("_START_",e).replace("_END_",h).replace("_TOTAL_",k)+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",a.fnFormatNumber(a.fnRecordsTotal()))+a.oLanguage.sInfoPostFix;if(a.oLanguage.fnInfoCallback!==null)e=a.oLanguage.fnInfoCallback(a,b,c,d,f,e);a=a.aanFeatures.i;b=0;for(c=a.length;b<c;b++)i(a[b]).html(e)}}function Ga(a){if(a.oScroll.bInfinite)return null;var b='<select size="1" '+(a.sTableId===""?"":'name="'+
|
97 |
-
a.sTableId+'_length"')+">",c,d;if(a.aLengthMenu.length==2&&typeof a.aLengthMenu[0]=="object"&&typeof a.aLengthMenu[1]=="object"){c=0;for(d=a.aLengthMenu[0].length;c<d;c++)b+='<option value="'+a.aLengthMenu[0][c]+'">'+a.aLengthMenu[1][c]+"</option>"}else{c=0;for(d=a.aLengthMenu.length;c<d;c++)b+='<option value="'+a.aLengthMenu[c]+'">'+a.aLengthMenu[c]+"</option>"}b+="</select>";var f=p.createElement("div");a.sTableId!==""&&typeof a.aanFeatures.l=="undefined"&&f.setAttribute("id",a.sTableId+"_length");
|
98 |
-
f.className=a.oClasses.sLength;f.innerHTML="<label>"+a.oLanguage.sLengthMenu.replace("_MENU_",b)+"</label>";i('select option[value="'+a._iDisplayLength+'"]',f).attr("selected",true);i("select",f).bind("change.DT",function(){var e=i(this).val(),h=a.aanFeatures.l;c=0;for(d=h.length;c<d;c++)h[c]!=this.parentNode&&i("select",h[c]).val(e);a._iDisplayLength=parseInt(e,10);E(a);if(a.fnDisplayEnd()==a.fnRecordsDisplay()){a._iDisplayStart=a.fnDisplayEnd()-a._iDisplayLength;if(a._iDisplayStart<0)a._iDisplayStart=
|
99 |
-
0}if(a._iDisplayLength==-1)a._iDisplayStart=0;C(a)});return f}function Ia(a){var b=p.createElement("div");a.sTableId!==""&&typeof a.aanFeatures.r=="undefined"&&b.setAttribute("id",a.sTableId+"_processing");b.innerHTML=a.oLanguage.sProcessing;b.className=a.oClasses.sProcessing;a.nTable.parentNode.insertBefore(b,a.nTable);return b}function K(a,b){if(a.oFeatures.bProcessing){a=a.aanFeatures.r;for(var c=0,d=a.length;c<d;c++)a[c].style.visibility=b?"visible":"hidden"}}function Na(a,b){for(var c=-1,d=0;d<
|
100 |
-
a.aoColumns.length;d++){a.aoColumns[d].bVisible===true&&c++;if(c==b)return d}return null}function ta(a,b){for(var c=-1,d=0;d<a.aoColumns.length;d++){a.aoColumns[d].bVisible===true&&c++;if(d==b)return a.aoColumns[d].bVisible===true?c:null}return null}function W(a,b){var c,d;c=a._iDisplayStart;for(d=a._iDisplayEnd;c<d;c++)if(a.aoData[a.aiDisplay[c]].nTr==b)return a.aiDisplay[c];c=0;for(d=a.aoData.length;c<d;c++)if(a.aoData[c].nTr==b)return c;return null}function Z(a){for(var b=0,c=0;c<a.aoColumns.length;c++)a.aoColumns[c].bVisible===
|
101 |
-
true&&b++;return b}function E(a){a._iDisplayEnd=a.oFeatures.bPaginate===false?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength>a.aiDisplay.length||a._iDisplayLength==-1?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength}function Sa(a,b){if(!a||a===null||a==="")return 0;if(typeof b=="undefined")b=p.getElementsByTagName("body")[0];var c=p.createElement("div");c.style.width=q(a);b.appendChild(c);a=c.offsetWidth;b.removeChild(c);return a}function ga(a){var b=0,c,d=0,f=a.aoColumns.length,e,h=i("th",
|
102 |
-
a.nTHead);for(e=0;e<f;e++)if(a.aoColumns[e].bVisible){d++;if(a.aoColumns[e].sWidth!==null){c=Sa(a.aoColumns[e].sWidthOrig,a.nTable.parentNode);if(c!==null)a.aoColumns[e].sWidth=q(c);b++}}if(f==h.length&&b===0&&d==f&&a.oScroll.sX===""&&a.oScroll.sY==="")for(e=0;e<a.aoColumns.length;e++){c=i(h[e]).width();if(c!==null)a.aoColumns[e].sWidth=q(c)}else{b=a.nTable.cloneNode(false);e=a.nTHead.cloneNode(true);d=p.createElement("tbody");c=p.createElement("tr");b.removeAttribute("id");b.appendChild(e);if(a.nTFoot!==
|
103 |
-
null){b.appendChild(a.nTFoot.cloneNode(true));P(function(k){k.style.width=""},b.getElementsByTagName("tr"))}b.appendChild(d);d.appendChild(c);d=i("thead th",b);if(d.length===0)d=i("tbody tr:eq(0)>td",b);h=S(a,e);for(e=d=0;e<f;e++){var j=a.aoColumns[e];if(j.bVisible&&j.sWidthOrig!==null&&j.sWidthOrig!=="")h[e-d].style.width=q(j.sWidthOrig);else if(j.bVisible)h[e-d].style.width="";else d++}for(e=0;e<f;e++)if(a.aoColumns[e].bVisible){d=Ta(a,e);if(d!==null){d=d.cloneNode(true);if(a.aoColumns[e].sContentPadding!==
|
104 |
-
"")d.innerHTML+=a.aoColumns[e].sContentPadding;c.appendChild(d)}}f=a.nTable.parentNode;f.appendChild(b);if(a.oScroll.sX!==""&&a.oScroll.sXInner!=="")b.style.width=q(a.oScroll.sXInner);else if(a.oScroll.sX!==""){b.style.width="";if(i(b).width()<f.offsetWidth)b.style.width=q(f.offsetWidth)}else if(a.oScroll.sY!=="")b.style.width=q(f.offsetWidth);b.style.visibility="hidden";Ua(a,b);f=i("tbody tr:eq(0)",b).children();if(f.length===0)f=S(a,i("thead",b)[0]);if(a.oScroll.sX!==""){for(e=d=c=0;e<a.aoColumns.length;e++)if(a.aoColumns[e].bVisible){c+=
|
105 |
-
a.aoColumns[e].sWidthOrig===null?i(f[d]).outerWidth():parseInt(a.aoColumns[e].sWidth.replace("px",""),10)+(i(f[d]).outerWidth()-i(f[d]).width());d++}b.style.width=q(c);a.nTable.style.width=q(c)}for(e=d=0;e<a.aoColumns.length;e++)if(a.aoColumns[e].bVisible){c=i(f[d]).width();if(c!==null&&c>0)a.aoColumns[e].sWidth=q(c);d++}a.nTable.style.width=q(i(b).outerWidth());b.parentNode.removeChild(b)}}function Ua(a,b){if(a.oScroll.sX===""&&a.oScroll.sY!==""){i(b).width();b.style.width=q(i(b).outerWidth()-a.oScroll.iBarWidth)}else if(a.oScroll.sX!==
|
106 |
-
"")b.style.width=q(i(b).outerWidth())}function Ta(a,b){var c=Va(a,b);if(c<0)return null;if(a.aoData[c].nTr===null){var d=p.createElement("td");d.innerHTML=G(a,c,b,"");return d}return Q(a,c)[b]}function Va(a,b){for(var c=-1,d=-1,f=0;f<a.aoData.length;f++){var e=G(a,f,b,"display")+"";e=e.replace(/<.*?>/g,"");if(e.length>c){c=e.length;d=f}}return d}function q(a){if(a===null)return"0px";if(typeof a=="number"){if(a<0)return"0px";return a+"px"}var b=a.charCodeAt(a.length-1);if(b<48||b>57)return a;return a+
|
107 |
-
"px"}function Za(a,b){if(a.length!=b.length)return 1;for(var c=0;c<a.length;c++)if(a[c]!=b[c])return 2;return 0}function ia(a){for(var b=n.aTypes,c=b.length,d=0;d<c;d++){var f=b[d](a);if(f!==null)return f}return"string"}function A(a){for(var b=0;b<D.length;b++)if(D[b].nTable==a)return D[b];return null}function ca(a){for(var b=[],c=a.aoData.length,d=0;d<c;d++)b.push(a.aoData[d]._aData);return b}function ba(a){for(var b=[],c=0,d=a.aoData.length;c<d;c++)a.aoData[c].nTr!==null&&b.push(a.aoData[c].nTr);
|
108 |
-
return b}function Q(a,b){var c=[],d,f,e,h,j;f=0;var k=a.aoData.length;if(typeof b!="undefined"){f=b;k=b+1}for(f=f;f<k;f++){j=a.aoData[f];if(j.nTr!==null){b=[];e=0;for(h=j.nTr.childNodes.length;e<h;e++){d=j.nTr.childNodes[e].nodeName.toLowerCase();if(d=="td"||d=="th")b.push(j.nTr.childNodes[e])}e=d=0;for(h=a.aoColumns.length;e<h;e++)if(a.aoColumns[e].bVisible)c.push(b[e-d]);else{c.push(j._anHidden[e]);d++}}}return c}function sa(a){return a.replace(new RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\|\\$|\\^)",
|
109 |
-
"g"),"\\$1")}function ua(a,b){for(var c=-1,d=0,f=a.length;d<f;d++)if(a[d]==b)c=d;else a[d]>b&&a[d]--;c!=-1&&a.splice(c,1)}function Fa(a,b){b=b.split(",");for(var c=[],d=0,f=a.aoColumns.length;d<f;d++)for(var e=0;e<f;e++)if(a.aoColumns[d].sName==b[e]){c.push(e);break}return c}function ka(a){for(var b="",c=0,d=a.aoColumns.length;c<d;c++)b+=a.aoColumns[c].sName+",";if(b.length==d)return"";return b.slice(0,-1)}function J(a,b,c){a=a.sTableId===""?"DataTables warning: "+c:"DataTables warning (table id = '"+
|
110 |
-
a.sTableId+"'): "+c;if(b===0)if(n.sErrMode=="alert")alert(a);else throw a;else typeof console!="undefined"&&typeof console.log!="undefined"&&console.log(a)}function la(a){a.aoData.splice(0,a.aoData.length);a.aiDisplayMaster.splice(0,a.aiDisplayMaster.length);a.aiDisplay.splice(0,a.aiDisplay.length);E(a)}function va(a){if(!(!a.oFeatures.bStateSave||typeof a.bDestroying!="undefined")){var b,c,d,f="{";f+='"iCreate":'+(new Date).getTime()+",";f+='"iStart":'+(a.oScroll.bInfinite?0:a._iDisplayStart)+",";
|
111 |
-
f+='"iEnd":'+(a.oScroll.bInfinite?a._iDisplayLength:a._iDisplayEnd)+",";f+='"iLength":'+a._iDisplayLength+",";f+='"sFilter":"'+encodeURIComponent(a.oPreviousSearch.sSearch)+'",';f+='"sFilterEsc":'+!a.oPreviousSearch.bRegex+",";f+='"aaSorting":[ ';for(b=0;b<a.aaSorting.length;b++)f+="["+a.aaSorting[b][0]+',"'+a.aaSorting[b][1]+'"],';f=f.substring(0,f.length-1);f+="],";f+='"aaSearchCols":[ ';for(b=0;b<a.aoPreSearchCols.length;b++)f+='["'+encodeURIComponent(a.aoPreSearchCols[b].sSearch)+'",'+!a.aoPreSearchCols[b].bRegex+
|
112 |
-
"],";f=f.substring(0,f.length-1);f+="],";f+='"abVisCols":[ ';for(b=0;b<a.aoColumns.length;b++)f+=a.aoColumns[b].bVisible+",";f=f.substring(0,f.length-1);f+="]";b=0;for(c=a.aoStateSave.length;b<c;b++){d=a.aoStateSave[b].fn(a,f);if(d!=="")f=d}f+="}";Wa(a.sCookiePrefix+a.sInstance,f,a.iCookieDuration,a.sCookiePrefix,a.fnCookieCallback)}}function Xa(a,b){if(a.oFeatures.bStateSave){var c,d,f;d=wa(a.sCookiePrefix+a.sInstance);if(d!==null&&d!==""){try{c=typeof i.parseJSON=="function"?i.parseJSON(d.replace(/'/g,
|
113 |
-
'"')):eval("("+d+")")}catch(e){return}d=0;for(f=a.aoStateLoad.length;d<f;d++)if(!a.aoStateLoad[d].fn(a,c))return;a.oLoadedState=i.extend(true,{},c);a._iDisplayStart=c.iStart;a.iInitDisplayStart=c.iStart;a._iDisplayEnd=c.iEnd;a._iDisplayLength=c.iLength;a.oPreviousSearch.sSearch=decodeURIComponent(c.sFilter);a.aaSorting=c.aaSorting.slice();a.saved_aaSorting=c.aaSorting.slice();if(typeof c.sFilterEsc!="undefined")a.oPreviousSearch.bRegex=!c.sFilterEsc;if(typeof c.aaSearchCols!="undefined")for(d=0;d<
|
114 |
-
c.aaSearchCols.length;d++)a.aoPreSearchCols[d]={sSearch:decodeURIComponent(c.aaSearchCols[d][0]),bRegex:!c.aaSearchCols[d][1]};if(typeof c.abVisCols!="undefined"){b.saved_aoColumns=[];for(d=0;d<c.abVisCols.length;d++){b.saved_aoColumns[d]={};b.saved_aoColumns[d].bVisible=c.abVisCols[d]}}}}}function Wa(a,b,c,d,f){var e=new Date;e.setTime(e.getTime()+c*1E3);c=za.location.pathname.split("/");a=a+"_"+c.pop().replace(/[\/:]/g,"").toLowerCase();var h;if(f!==null){h=typeof i.parseJSON=="function"?i.parseJSON(b):
|
115 |
-
eval("("+b+")");b=f(a,h,e.toGMTString(),c.join("/")+"/")}else b=a+"="+encodeURIComponent(b)+"; expires="+e.toGMTString()+"; path="+c.join("/")+"/";f="";e=9999999999999;if((wa(a)!==null?p.cookie.length:b.length+p.cookie.length)+10>4096){a=p.cookie.split(";");for(var j=0,k=a.length;j<k;j++)if(a[j].indexOf(d)!=-1){var m=a[j].split("=");try{h=eval("("+decodeURIComponent(m[1])+")")}catch(u){continue}if(typeof h.iCreate!="undefined"&&h.iCreate<e){f=m[0];e=h.iCreate}}if(f!=="")p.cookie=f+"=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path="+
|
116 |
-
c.join("/")+"/"}p.cookie=b}function wa(a){var b=za.location.pathname.split("/");a=a+"_"+b[b.length-1].replace(/[\/:]/g,"").toLowerCase()+"=";b=p.cookie.split(";");for(var c=0;c<b.length;c++){for(var d=b[c];d.charAt(0)==" ";)d=d.substring(1,d.length);if(d.indexOf(a)===0)return decodeURIComponent(d.substring(a.length,d.length))}return null}function Y(a,b){b=i(b).children("tr");var c,d,f,e,h,j,k,m,u=function(L,T,B){for(;typeof L[T][B]!="undefined";)B++;return B};a.splice(0,a.length);d=0;for(j=b.length;d<
|
117 |
-
j;d++)a.push([]);d=0;for(j=b.length;d<j;d++){f=0;for(k=b[d].childNodes.length;f<k;f++){c=b[d].childNodes[f];if(c.nodeName.toUpperCase()=="TD"||c.nodeName.toUpperCase()=="TH"){var r=c.getAttribute("colspan")*1,H=c.getAttribute("rowspan")*1;r=!r||r===0||r===1?1:r;H=!H||H===0||H===1?1:H;m=u(a,d,0);for(h=0;h<r;h++)for(e=0;e<H;e++){a[d+e][m+h]={cell:c,unique:r==1?true:false};a[d+e].nTr=b[d]}}}}}function S(a,b,c){var d=[];if(typeof c=="undefined"){c=a.aoHeader;if(typeof b!="undefined"){c=[];Y(c,b)}}b=0;
|
118 |
-
for(var f=c.length;b<f;b++)for(var e=0,h=c[b].length;e<h;e++)if(c[b][e].unique&&(typeof d[e]=="undefined"||!a.bSortCellsTop))d[e]=c[b][e].cell;return d}function Ya(){var a=p.createElement("p"),b=a.style;b.width="100%";b.height="200px";b.padding="0px";var c=p.createElement("div");b=c.style;b.position="absolute";b.top="0px";b.left="0px";b.visibility="hidden";b.width="200px";b.height="150px";b.padding="0px";b.overflow="hidden";c.appendChild(a);p.body.appendChild(c);b=a.offsetWidth;c.style.overflow="scroll";
|
119 |
-
a=a.offsetWidth;if(b==a)a=c.clientWidth;p.body.removeChild(c);return b-a}function P(a,b,c){for(var d=0,f=b.length;d<f;d++)for(var e=0,h=b[d].childNodes.length;e<h;e++)if(b[d].childNodes[e].nodeType==1)typeof c!="undefined"?a(b[d].childNodes[e],c[d].childNodes[e]):a(b[d].childNodes[e])}function o(a,b,c,d){if(typeof d=="undefined")d=c;if(typeof b[c]!="undefined")a[d]=b[c]}function fa(a,b,c){for(var d=[],f=0,e=a.aoColumns.length;f<e;f++)d.push(G(a,b,f,c));return d}function G(a,b,c,d){var f=a.aoColumns[c];
|
120 |
-
if((c=f.fnGetData(a.aoData[b]._aData))===undefined){if(a.iDrawError!=a.iDraw&&f.sDefaultContent===null){J(a,0,"Requested unknown parameter '"+f.mDataProp+"' from the data source for row "+b);a.iDrawError=a.iDraw}return f.sDefaultContent}if(c===null&&f.sDefaultContent!==null)c=f.sDefaultContent;else if(typeof c=="function")return c();if(d=="display"&&c===null)return"";return c}function O(a,b,c,d){a.aoColumns[c].fnSetData(a.aoData[b]._aData,d)}function aa(a){if(a===null)return function(){return null};
|
121 |
-
else if(typeof a=="function")return function(c){return a(c)};else if(typeof a=="string"&&a.indexOf(".")!=-1){var b=a.split(".");return b.length==2?function(c){return c[b[0]][b[1]]}:b.length==3?function(c){return c[b[0]][b[1]][b[2]]}:function(c){for(var d=0,f=b.length;d<f;d++)c=c[b[d]];return c}}else return function(c){return c[a]}}function Ba(a){if(a===null)return function(){};else if(typeof a=="function")return function(c,d){return a(c,d)};else if(typeof a=="string"&&a.indexOf(".")!=-1){var b=a.split(".");
|
122 |
-
return b.length==2?function(c,d){c[b[0]][b[1]]=d}:b.length==3?function(c,d){c[b[0]][b[1]][b[2]]=d}:function(c,d){for(var f=0,e=b.length-1;f<e;f++)c=c[b[f]];c[b[b.length-1]]=d}}else return function(c,d){c[a]=d}}this.oApi={};this.fnDraw=function(a){var b=A(this[n.iApiIndex]);if(typeof a!="undefined"&&a===false){E(b);C(b)}else da(b)};this.fnFilter=function(a,b,c,d,f){var e=A(this[n.iApiIndex]);if(e.oFeatures.bFilter){if(typeof c=="undefined")c=false;if(typeof d=="undefined")d=true;if(typeof f=="undefined")f=
|
123 |
-
true;if(typeof b=="undefined"||b===null){N(e,{sSearch:a,bRegex:c,bSmart:d},1);if(f&&typeof e.aanFeatures.f!="undefined"){b=e.aanFeatures.f;c=0;for(d=b.length;c<d;c++)i("input",b[c]).val(a)}}else{e.aoPreSearchCols[b].sSearch=a;e.aoPreSearchCols[b].bRegex=c;e.aoPreSearchCols[b].bSmart=d;N(e,e.oPreviousSearch,1)}}};this.fnSettings=function(){return A(this[n.iApiIndex])};this.fnVersionCheck=n.fnVersionCheck;this.fnSort=function(a){var b=A(this[n.iApiIndex]);b.aaSorting=a;R(b)};this.fnSortListener=function(a,
|
124 |
-
b,c){ja(A(this[n.iApiIndex]),a,b,c)};this.fnAddData=function(a,b){if(a.length===0)return[];var c=[],d,f=A(this[n.iApiIndex]);if(typeof a[0]=="object")for(var e=0;e<a.length;e++){d=v(f,a[e]);if(d==-1)return c;c.push(d)}else{d=v(f,a);if(d==-1)return c;c.push(d)}f.aiDisplay=f.aiDisplayMaster.slice();if(typeof b=="undefined"||b)da(f);return c};this.fnDeleteRow=function(a,b,c){var d=A(this[n.iApiIndex]);a=typeof a=="object"?W(d,a):a;var f=d.aoData.splice(a,1),e=i.inArray(a,d.aiDisplay);d.asDataSearch.splice(e,
|
125 |
-
1);ua(d.aiDisplayMaster,a);ua(d.aiDisplay,a);typeof b=="function"&&b.call(this,d,f);if(d._iDisplayStart>=d.aiDisplay.length){d._iDisplayStart-=d._iDisplayLength;if(d._iDisplayStart<0)d._iDisplayStart=0}if(typeof c=="undefined"||c){E(d);C(d)}return f};this.fnClearTable=function(a){var b=A(this[n.iApiIndex]);la(b);if(typeof a=="undefined"||a)C(b)};this.fnOpen=function(a,b,c){var d=A(this[n.iApiIndex]);this.fnClose(a);var f=p.createElement("tr"),e=p.createElement("td");f.appendChild(e);e.className=c;
|
126 |
-
e.colSpan=Z(d);if(typeof b.jquery!="undefined"||typeof b=="object")e.appendChild(b);else e.innerHTML=b;b=i("tr",d.nTBody);i.inArray(a,b)!=-1&&i(f).insertAfter(a);d.aoOpenRows.push({nTr:f,nParent:a});return f};this.fnClose=function(a){for(var b=A(this[n.iApiIndex]),c=0;c<b.aoOpenRows.length;c++)if(b.aoOpenRows[c].nParent==a){(a=b.aoOpenRows[c].nTr.parentNode)&&a.removeChild(b.aoOpenRows[c].nTr);b.aoOpenRows.splice(c,1);return 0}return 1};this.fnGetData=function(a,b){var c=A(this[n.iApiIndex]);if(typeof a!=
|
127 |
-
"undefined"){a=typeof a=="object"?W(c,a):a;if(typeof b!="undefined")return G(c,a,b,"");return typeof c.aoData[a]!="undefined"?c.aoData[a]._aData:null}return ca(c)};this.fnGetNodes=function(a){var b=A(this[n.iApiIndex]);if(typeof a!="undefined")return typeof b.aoData[a]!="undefined"?b.aoData[a].nTr:null;return ba(b)};this.fnGetPosition=function(a){var b=A(this[n.iApiIndex]),c=a.nodeName.toUpperCase();if(c=="TR")return W(b,a);else if(c=="TD"||c=="TH"){c=W(b,a.parentNode);for(var d=Q(b,c),f=0;f<b.aoColumns.length;f++)if(d[f]==
|
128 |
-
a)return[c,ta(b,f),f]}return null};this.fnUpdate=function(a,b,c,d,f){var e=A(this[n.iApiIndex]);b=typeof b=="object"?W(e,b):b;if(i.isArray(a)&&typeof a=="object"){e.aoData[b]._aData=a.slice();for(c=0;c<e.aoColumns.length;c++)this.fnUpdate(G(e,b,c),b,c,false,false)}else if(a!==null&&typeof a=="object"){e.aoData[b]._aData=i.extend(true,{},a);for(c=0;c<e.aoColumns.length;c++)this.fnUpdate(G(e,b,c),b,c,false,false)}else{a=a;O(e,b,c,a);if(e.aoColumns[c].fnRender!==null){a=e.aoColumns[c].fnRender({iDataRow:b,
|
129 |
-
iDataColumn:c,aData:e.aoData[b]._aData,oSettings:e});e.aoColumns[c].bUseRendered&&O(e,b,c,a)}if(e.aoData[b].nTr!==null)Q(e,b)[c].innerHTML=a}c=i.inArray(b,e.aiDisplay);e.asDataSearch[c]=ra(e,fa(e,b,"filter"));if(typeof f=="undefined"||f)ea(e);if(typeof d=="undefined"||d)da(e);return 0};this.fnSetColumnVis=function(a,b,c){var d=A(this[n.iApiIndex]),f,e;e=d.aoColumns.length;var h,j;if(d.aoColumns[a].bVisible!=b){if(b){for(f=j=0;f<a;f++)d.aoColumns[f].bVisible&&j++;j=j>=Z(d);if(!j)for(f=a;f<e;f++)if(d.aoColumns[f].bVisible){h=
|
130 |
-
f;break}f=0;for(e=d.aoData.length;f<e;f++)if(d.aoData[f].nTr!==null)j?d.aoData[f].nTr.appendChild(d.aoData[f]._anHidden[a]):d.aoData[f].nTr.insertBefore(d.aoData[f]._anHidden[a],Q(d,f)[h])}else{f=0;for(e=d.aoData.length;f<e;f++)if(d.aoData[f].nTr!==null){h=Q(d,f)[a];d.aoData[f]._anHidden[a]=h;h.parentNode.removeChild(h)}}d.aoColumns[a].bVisible=b;M(d,d.aoHeader);d.nTFoot&&M(d,d.aoFooter);f=0;for(e=d.aoOpenRows.length;f<e;f++)d.aoOpenRows[f].nTr.colSpan=Z(d);if(typeof c=="undefined"||c){ea(d);C(d)}va(d)}};
|
131 |
-
this.fnPageChange=function(a,b){var c=A(this[n.iApiIndex]);ma(c,a);E(c);if(typeof b=="undefined"||b)C(c)};this.fnDestroy=function(){var a=A(this[n.iApiIndex]),b=a.nTableWrapper.parentNode,c=a.nTBody,d,f;a.bDestroying=true;d=0;for(f=a.aoDestroyCallback.length;d<f;d++)a.aoDestroyCallback[d].fn();d=0;for(f=a.aoColumns.length;d<f;d++)a.aoColumns[d].bVisible===false&&this.fnSetColumnVis(d,true);i(a.nTableWrapper).find("*").andSelf().unbind(".DT");i("tbody>tr>td."+a.oClasses.sRowEmpty,a.nTable).parent().remove();
|
132 |
-
if(a.nTable!=a.nTHead.parentNode){i(a.nTable).children("thead").remove();a.nTable.appendChild(a.nTHead)}if(a.nTFoot&&a.nTable!=a.nTFoot.parentNode){i(a.nTable).children("tfoot").remove();a.nTable.appendChild(a.nTFoot)}a.nTable.parentNode.removeChild(a.nTable);i(a.nTableWrapper).remove();a.aaSorting=[];a.aaSortingFixed=[];V(a);i(ba(a)).removeClass(a.asStripeClasses.join(" "));if(a.bJUI){i("th",a.nTHead).removeClass([n.oStdClasses.sSortable,n.oJUIClasses.sSortableAsc,n.oJUIClasses.sSortableDesc,n.oJUIClasses.sSortableNone].join(" "));
|
133 |
-
i("th span."+n.oJUIClasses.sSortIcon,a.nTHead).remove();i("th",a.nTHead).each(function(){var e=i("div."+n.oJUIClasses.sSortJUIWrapper,this),h=e.contents();i(this).append(h);e.remove()})}else i("th",a.nTHead).removeClass([n.oStdClasses.sSortable,n.oStdClasses.sSortableAsc,n.oStdClasses.sSortableDesc,n.oStdClasses.sSortableNone].join(" "));a.nTableReinsertBefore?b.insertBefore(a.nTable,a.nTableReinsertBefore):b.appendChild(a.nTable);d=0;for(f=a.aoData.length;d<f;d++)a.aoData[d].nTr!==null&&c.appendChild(a.aoData[d].nTr);
|
134 |
-
if(a.oFeatures.bAutoWidth===true)a.nTable.style.width=q(a.sDestroyWidth);i(c).children("tr:even").addClass(a.asDestroyStripes[0]);i(c).children("tr:odd").addClass(a.asDestroyStripes[1]);d=0;for(f=D.length;d<f;d++)D[d]==a&&D.splice(d,1);a=null};this.fnAdjustColumnSizing=function(a){var b=A(this[n.iApiIndex]);ea(b);if(typeof a=="undefined"||a)this.fnDraw(false);else if(b.oScroll.sX!==""||b.oScroll.sY!=="")this.oApi._fnScrollDraw(b)};for(var xa in n.oApi)if(xa)this[xa]=s(xa);this.oApi._fnExternApiFunc=
|
135 |
-
s;this.oApi._fnInitialise=t;this.oApi._fnInitComplete=w;this.oApi._fnLanguageProcess=y;this.oApi._fnAddColumn=F;this.oApi._fnColumnOptions=x;this.oApi._fnAddData=v;this.oApi._fnCreateTr=z;this.oApi._fnGatherData=$;this.oApi._fnBuildHead=X;this.oApi._fnDrawHead=M;this.oApi._fnDraw=C;this.oApi._fnReDraw=da;this.oApi._fnAjaxUpdate=Ca;this.oApi._fnAjaxParameters=Da;this.oApi._fnAjaxUpdateDraw=Ea;this.oApi._fnServerParams=ha;this.oApi._fnAddOptionsHtml=Aa;this.oApi._fnFeatureHtmlTable=Ja;this.oApi._fnScrollDraw=
|
136 |
-
Ma;this.oApi._fnAdjustColumnSizing=ea;this.oApi._fnFeatureHtmlFilter=Ha;this.oApi._fnFilterComplete=N;this.oApi._fnFilterCustom=Qa;this.oApi._fnFilterColumn=Pa;this.oApi._fnFilter=Oa;this.oApi._fnBuildSearchArray=oa;this.oApi._fnBuildSearchRow=ra;this.oApi._fnFilterCreateSearch=pa;this.oApi._fnDataToSearch=qa;this.oApi._fnSort=R;this.oApi._fnSortAttachListener=ja;this.oApi._fnSortingClasses=V;this.oApi._fnFeatureHtmlPaginate=La;this.oApi._fnPageChange=ma;this.oApi._fnFeatureHtmlInfo=Ka;this.oApi._fnUpdateInfo=
|
137 |
-
Ra;this.oApi._fnFeatureHtmlLength=Ga;this.oApi._fnFeatureHtmlProcessing=Ia;this.oApi._fnProcessingDisplay=K;this.oApi._fnVisibleToColumnIndex=Na;this.oApi._fnColumnIndexToVisible=ta;this.oApi._fnNodeToDataIndex=W;this.oApi._fnVisbleColumns=Z;this.oApi._fnCalculateEnd=E;this.oApi._fnConvertToWidth=Sa;this.oApi._fnCalculateColumnWidths=ga;this.oApi._fnScrollingWidthAdjust=Ua;this.oApi._fnGetWidestNode=Ta;this.oApi._fnGetMaxLenString=Va;this.oApi._fnStringToCss=q;this.oApi._fnArrayCmp=Za;this.oApi._fnDetectType=
|
138 |
-
ia;this.oApi._fnSettingsFromNode=A;this.oApi._fnGetDataMaster=ca;this.oApi._fnGetTrNodes=ba;this.oApi._fnGetTdNodes=Q;this.oApi._fnEscapeRegex=sa;this.oApi._fnDeleteIndex=ua;this.oApi._fnReOrderIndex=Fa;this.oApi._fnColumnOrdering=ka;this.oApi._fnLog=J;this.oApi._fnClearTable=la;this.oApi._fnSaveState=va;this.oApi._fnLoadState=Xa;this.oApi._fnCreateCookie=Wa;this.oApi._fnReadCookie=wa;this.oApi._fnDetectHeader=Y;this.oApi._fnGetUniqueThs=S;this.oApi._fnScrollBarWidth=Ya;this.oApi._fnApplyToChildren=
|
139 |
-
P;this.oApi._fnMap=o;this.oApi._fnGetRowData=fa;this.oApi._fnGetCellData=G;this.oApi._fnSetCellData=O;this.oApi._fnGetObjectDataFn=aa;this.oApi._fnSetObjectDataFn=Ba;var ya=this;return this.each(function(){var a=0,b,c,d,f;a=0;for(b=D.length;a<b;a++){if(D[a].nTable==this)if(typeof g=="undefined"||typeof g.bRetrieve!="undefined"&&g.bRetrieve===true)return D[a].oInstance;else if(typeof g.bDestroy!="undefined"&&g.bDestroy===true){D[a].oInstance.fnDestroy();break}else{J(D[a],0,"Cannot reinitialise DataTable.\n\nTo retrieve the DataTables object for this table, please pass either no arguments to the dataTable() function, or set bRetrieve to true. Alternatively, to destory the old table and create a new one, set bDestroy to true (note that a lot of changes to the configuration can be made through the API which is usually much faster).");
|
140 |
-
return}if(D[a].sTableId!==""&&D[a].sTableId==this.getAttribute("id")){D.splice(a,1);break}}var e=new l;D.push(e);var h=false,j=false;a=this.getAttribute("id");if(a!==null){e.sTableId=a;e.sInstance=a}else e.sInstance=n._oExternConfig.iNextUnique++;if(this.nodeName.toLowerCase()!="table")J(e,0,"Attempted to initialise DataTables on a node which is not a table: "+this.nodeName);else{e.nTable=this;e.oInstance=ya.length==1?ya:i(this).dataTable();e.oApi=ya.oApi;e.sDestroyWidth=i(this).width();if(typeof g!=
|
141 |
-
"undefined"&&g!==null){e.oInit=g;o(e.oFeatures,g,"bPaginate");o(e.oFeatures,g,"bLengthChange");o(e.oFeatures,g,"bFilter");o(e.oFeatures,g,"bSort");o(e.oFeatures,g,"bInfo");o(e.oFeatures,g,"bProcessing");o(e.oFeatures,g,"bAutoWidth");o(e.oFeatures,g,"bSortClasses");o(e.oFeatures,g,"bServerSide");o(e.oFeatures,g,"bDeferRender");o(e.oScroll,g,"sScrollX","sX");o(e.oScroll,g,"sScrollXInner","sXInner");o(e.oScroll,g,"sScrollY","sY");o(e.oScroll,g,"bScrollCollapse","bCollapse");o(e.oScroll,g,"bScrollInfinite",
|
142 |
-
"bInfinite");o(e.oScroll,g,"iScrollLoadGap","iLoadGap");o(e.oScroll,g,"bScrollAutoCss","bAutoCss");o(e,g,"asStripClasses","asStripeClasses");o(e,g,"asStripeClasses");o(e,g,"fnPreDrawCallback");o(e,g,"fnRowCallback");o(e,g,"fnHeaderCallback");o(e,g,"fnFooterCallback");o(e,g,"fnCookieCallback");o(e,g,"fnInitComplete");o(e,g,"fnServerData");o(e,g,"fnFormatNumber");o(e,g,"aaSorting");o(e,g,"aaSortingFixed");o(e,g,"aLengthMenu");o(e,g,"sPaginationType");o(e,g,"sAjaxSource");o(e,g,"sAjaxDataProp");o(e,
|
143 |
-
g,"iCookieDuration");o(e,g,"sCookiePrefix");o(e,g,"sDom");o(e,g,"bSortCellsTop");o(e,g,"oSearch","oPreviousSearch");o(e,g,"aoSearchCols","aoPreSearchCols");o(e,g,"iDisplayLength","_iDisplayLength");o(e,g,"bJQueryUI","bJUI");o(e.oLanguage,g,"fnInfoCallback");typeof g.fnDrawCallback=="function"&&e.aoDrawCallback.push({fn:g.fnDrawCallback,sName:"user"});typeof g.fnServerParams=="function"&&e.aoServerParams.push({fn:g.fnServerParams,sName:"user"});typeof g.fnStateSaveCallback=="function"&&e.aoStateSave.push({fn:g.fnStateSaveCallback,
|
144 |
-
sName:"user"});typeof g.fnStateLoadCallback=="function"&&e.aoStateLoad.push({fn:g.fnStateLoadCallback,sName:"user"});if(e.oFeatures.bServerSide&&e.oFeatures.bSort&&e.oFeatures.bSortClasses)e.aoDrawCallback.push({fn:V,sName:"server_side_sort_classes"});else e.oFeatures.bDeferRender&&e.aoDrawCallback.push({fn:V,sName:"defer_sort_classes"});if(typeof g.bJQueryUI!="undefined"&&g.bJQueryUI){e.oClasses=n.oJUIClasses;if(typeof g.sDom=="undefined")e.sDom='<"H"lfr>t<"F"ip>'}if(e.oScroll.sX!==""||e.oScroll.sY!==
|
145 |
-
"")e.oScroll.iBarWidth=Ya();if(typeof g.iDisplayStart!="undefined"&&typeof e.iInitDisplayStart=="undefined"){e.iInitDisplayStart=g.iDisplayStart;e._iDisplayStart=g.iDisplayStart}if(typeof g.bStateSave!="undefined"){e.oFeatures.bStateSave=g.bStateSave;Xa(e,g);e.aoDrawCallback.push({fn:va,sName:"state_save"})}if(typeof g.iDeferLoading!="undefined"){e.bDeferLoading=true;e._iRecordsTotal=g.iDeferLoading;e._iRecordsDisplay=g.iDeferLoading}if(typeof g.aaData!="undefined")j=true;if(typeof g!="undefined"&&
|
146 |
-
typeof g.aoData!="undefined")g.aoColumns=g.aoData;if(typeof g.oLanguage!="undefined")if(typeof g.oLanguage.sUrl!="undefined"&&g.oLanguage.sUrl!==""){e.oLanguage.sUrl=g.oLanguage.sUrl;i.getJSON(e.oLanguage.sUrl,null,function(u){y(e,u,true)});h=true}else y(e,g.oLanguage,false)}else g={};if(typeof g.asStripClasses=="undefined"&&typeof g.asStripeClasses=="undefined"){e.asStripeClasses.push(e.oClasses.sStripeOdd);e.asStripeClasses.push(e.oClasses.sStripeEven)}c=false;d=i(this).children("tbody").children("tr");
|
147 |
-
a=0;for(b=e.asStripeClasses.length;a<b;a++)if(d.filter(":lt(2)").hasClass(e.asStripeClasses[a])){c=true;break}if(c){e.asDestroyStripes=["",""];if(i(d[0]).hasClass(e.oClasses.sStripeOdd))e.asDestroyStripes[0]+=e.oClasses.sStripeOdd+" ";if(i(d[0]).hasClass(e.oClasses.sStripeEven))e.asDestroyStripes[0]+=e.oClasses.sStripeEven;if(i(d[1]).hasClass(e.oClasses.sStripeOdd))e.asDestroyStripes[1]+=e.oClasses.sStripeOdd+" ";if(i(d[1]).hasClass(e.oClasses.sStripeEven))e.asDestroyStripes[1]+=e.oClasses.sStripeEven;
|
148 |
-
d.removeClass(e.asStripeClasses.join(" "))}c=[];var k;a=this.getElementsByTagName("thead");if(a.length!==0){Y(e.aoHeader,a[0]);c=S(e)}if(typeof g.aoColumns=="undefined"){k=[];a=0;for(b=c.length;a<b;a++)k.push(null)}else k=g.aoColumns;a=0;for(b=k.length;a<b;a++){if(typeof g.saved_aoColumns!="undefined"&&g.saved_aoColumns.length==b){if(k[a]===null)k[a]={};k[a].bVisible=g.saved_aoColumns[a].bVisible}F(e,c?c[a]:null)}if(typeof g.aoColumnDefs!="undefined")for(a=g.aoColumnDefs.length-1;a>=0;a--){var m=
|
149 |
-
g.aoColumnDefs[a].aTargets;i.isArray(m)||J(e,1,"aTargets must be an array of targets, not a "+typeof m);c=0;for(d=m.length;c<d;c++)if(typeof m[c]=="number"&&m[c]>=0){for(;e.aoColumns.length<=m[c];)F(e);x(e,m[c],g.aoColumnDefs[a])}else if(typeof m[c]=="number"&&m[c]<0)x(e,e.aoColumns.length+m[c],g.aoColumnDefs[a]);else if(typeof m[c]=="string"){b=0;for(f=e.aoColumns.length;b<f;b++)if(m[c]=="_all"||i(e.aoColumns[b].nTh).hasClass(m[c]))x(e,b,g.aoColumnDefs[a])}}if(typeof k!="undefined"){a=0;for(b=k.length;a<
|
150 |
-
b;a++)x(e,a,k[a])}a=0;for(b=e.aaSorting.length;a<b;a++){if(e.aaSorting[a][0]>=e.aoColumns.length)e.aaSorting[a][0]=0;k=e.aoColumns[e.aaSorting[a][0]];if(typeof e.aaSorting[a][2]=="undefined")e.aaSorting[a][2]=0;if(typeof g.aaSorting=="undefined"&&typeof e.saved_aaSorting=="undefined")e.aaSorting[a][1]=k.asSorting[0];c=0;for(d=k.asSorting.length;c<d;c++)if(e.aaSorting[a][1]==k.asSorting[c]){e.aaSorting[a][2]=c;break}}V(e);a=i(this).children("thead");if(a.length===0){a=[p.createElement("thead")];this.appendChild(a[0])}e.nTHead=
|
151 |
-
a[0];a=i(this).children("tbody");if(a.length===0){a=[p.createElement("tbody")];this.appendChild(a[0])}e.nTBody=a[0];a=i(this).children("tfoot");if(a.length>0){e.nTFoot=a[0];Y(e.aoFooter,e.nTFoot)}if(j)for(a=0;a<g.aaData.length;a++)v(e,g.aaData[a]);else $(e);e.aiDisplay=e.aiDisplayMaster.slice();e.bInitialised=true;h===false&&t(e)}})}})(jQuery,window,document);
|
1 |
/*
|
2 |
+
* File: jquery.dataTables.min.js (prefixed)
|
3 |
* Version: 1.8.2
|
4 |
* Author: Allan Jardine (www.sprymedia.co.uk)
|
5 |
* Info: www.datatables.net
|
13 |
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
14 |
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
|
15 |
*/
|
16 |
+
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],function(e){return t(e,window,document)}):"object"==typeof exports?module.exports=function(e,n){return e||(e=window),n||(n="undefined"!=typeof window?require("jquery"):require("jquery")(e)),t(n,e,e.document)}:t(jQuery,window,document)}(function(t,e,n,a){"use strict";function r(e){var n,a,o={};t.each(e,function(t,i){(n=t.match(/^([^A-Z]+?)([A-Z])/))&&-1!=="a aa ai ao as b fn i m o s ".indexOf(n[1]+" ")&&(a=t.replace(n[0],n[2].toLowerCase()),o[a]=t,"o"===n[1]&&r(e[t]))}),e._hungarianMap=o}function o(e,n,i){e._hungarianMap||r(e);var s;t.each(n,function(r,l){(s=e._hungarianMap[r])===a||!i&&n[s]!==a||("o"===s.charAt(0)?(n[s]||(n[s]={}),t.extend(!0,n[s],n[r]),o(e[s],n[s],i)):n[s]=n[r])})}function i(t){var e=qt.defaults.oLanguage,n=t.sZeroRecords;!t.sEmptyTable&&n&&"No data available in table"===e.sEmptyTable&&Pt(t,t,"sZeroRecords","sEmptyTable"),!t.sLoadingRecords&&n&&"Loading..."===e.sLoadingRecords&&Pt(t,t,"sZeroRecords","sLoadingRecords"),t.sInfoThousands&&(t.sThousands=t.sInfoThousands);var a=t.sDecimal;a&&Ut(a)}function s(t){fe(t,"ordering","bSort"),fe(t,"orderMulti","bSortMulti"),fe(t,"orderClasses","bSortClasses"),fe(t,"orderCellsTop","bSortCellsTop"),fe(t,"order","aaSorting"),fe(t,"orderFixed","aaSortingFixed"),fe(t,"paging","bPaginate"),fe(t,"pagingType","sPaginationType"),fe(t,"pageLength","iDisplayLength"),fe(t,"searching","bFilter"),"boolean"==typeof t.sScrollX&&(t.sScrollX=t.sScrollX?"100%":""),"boolean"==typeof t.scrollX&&(t.scrollX=t.scrollX?"100%":"");var e=t.aoSearchCols;if(e)for(var n=0,a=e.length;n<a;n++)e[n]&&o(qt.models.oSearch,e[n])}function l(e){fe(e,"orderable","bSortable"),fe(e,"orderData","aDataSort"),fe(e,"orderSequence","asSorting"),fe(e,"orderDataType","sortDataType");var n=e.aDataSort;n&&!t.isArray(n)&&(e.aDataSort=[n])}function u(n){if(!qt.__browser){var a={};qt.__browser=a;var r=t("<div/>").css({position:"fixed",top:0,left:-1*t(e).scrollLeft(),height:1,width:1,overflow:"hidden"}).append(t("<div/>").css({position:"absolute",top:1,left:1,width:100,overflow:"scroll"}).append(t("<div/>").css({width:"100%",height:10}))).appendTo("body"),o=r.children(),i=o.children();a.barWidth=o[0].offsetWidth-o[0].clientWidth,a.bScrollOversize=100===i[0].offsetWidth&&100!==o[0].clientWidth,a.bScrollbarLeft=1!==Math.round(i.offset().left),a.bBounding=!!r[0].getBoundingClientRect().width,r.remove()}t.extend(n.oBrowser,qt.__browser),n.oScroll.iBarWidth=qt.__browser.barWidth}function c(t,e,n,r,o,i){var s,l=r,u=!1;for(n!==a&&(s=n,u=!0);l!==o;)t.hasOwnProperty(l)&&(s=u?e(s,t[l],l,t):t[l],u=!0,l+=i);return s}function f(e,a){var r=qt.defaults.column,o=e.aoColumns.length,i=t.extend({},qt.models.oColumn,r,{nTh:a||n.createElement("th"),sTitle:r.sTitle?r.sTitle:a?a.innerHTML:"",aDataSort:r.aDataSort?r.aDataSort:[o],mData:r.mData?r.mData:o,idx:o});e.aoColumns.push(i);var s=e.aoPreSearchCols;s[o]=t.extend({},qt.models.oSearch,s[o]),d(e,o,t(a).data())}function d(e,n,r){var i=e.aoColumns[n],s=e.oClasses,u=t(i.nTh);if(!i.sWidthOrig){i.sWidthOrig=u.attr("width")||null;var c=(u.attr("style")||"").match(/width:\s*(\d+[pxem%]+)/);c&&(i.sWidthOrig=c[1])}r!==a&&null!==r&&(l(r),o(qt.defaults.column,r),r.mDataProp===a||r.mData||(r.mData=r.mDataProp),r.sType&&(i._sManualType=r.sType),r.className&&!r.sClass&&(r.sClass=r.className),t.extend(i,r),Pt(i,r,"sWidth","sWidthOrig"),r.iDataSort!==a&&(i.aDataSort=[r.iDataSort]),Pt(i,r,"aDataSort"));var f=i.mData,d=C(f),h=i.mRender?C(i.mRender):null,p=function(t){return"string"==typeof t&&-1!==t.indexOf("@")};i._bAttrSrc=t.isPlainObject(f)&&(p(f.sort)||p(f.type)||p(f.filter)),i._setter=null,i.fnGetData=function(t,e,n){var r=d(t,e,a,n);return h&&e?h(r,e,t,n):r},i.fnSetData=function(t,e,n){return x(f)(t,e,n)},"number"!=typeof f&&(e._rowReadObject=!0),e.oFeatures.bSort||(i.bSortable=!1,u.addClass(s.sSortableNone));var g=-1!==t.inArray("asc",i.asSorting),b=-1!==t.inArray("desc",i.asSorting);i.bSortable&&(g||b)?g&&!b?(i.sSortingClass=s.sSortableAsc,i.sSortingClassJUI=s.sSortJUIAscAllowed):!g&&b?(i.sSortingClass=s.sSortableDesc,i.sSortingClassJUI=s.sSortJUIDescAllowed):(i.sSortingClass=s.sSortable,i.sSortingClassJUI=s.sSortJUI):(i.sSortingClass=s.sSortableNone,i.sSortingClassJUI="")}function h(t){if(!1!==t.oFeatures.bAutoWidth){var e=t.aoColumns;gt(t);for(var n=0,a=e.length;n<a;n++)e[n].nTh.style.width=e[n].sWidth}var r=t.oScroll;""===r.sY&&""===r.sX||ht(t),Nt(t,null,"column-sizing",[t])}function p(t,e){var n=v(t,"bVisible");return"number"==typeof n[e]?n[e]:null}function g(e,n){var a=v(e,"bVisible"),r=t.inArray(n,a);return-1!==r?r:null}function b(e){var n=0;return t.each(e.aoColumns,function(e,a){a.bVisible&&"none"!==t(a.nTh).css("display")&&n++}),n}function v(e,n){var a=[];return t.map(e.aoColumns,function(t,e){t[n]&&a.push(e)}),a}function S(t){var e,n,r,o,i,s,l,u,c,f=t.aoColumns,d=t.aoData,h=qt.ext.type.detect;for(e=0,n=f.length;e<n;e++)if(l=f[e],c=[],!l.sType&&l._sManualType)l.sType=l._sManualType;else if(!l.sType){for(r=0,o=h.length;r<o;r++){for(i=0,s=d.length;i<s&&(c[i]===a&&(c[i]=_(t,i,e,"type")),(u=h[r](c[i],t))||r===h.length-1)&&"html"!==u;i++);if(u){l.sType=u;break}}l.sType||(l.sType="string")}}function m(e,n,r,o){var i,s,l,u,c,d,h,p=e.aoColumns;if(n)for(i=n.length-1;i>=0;i--){var g=(h=n[i]).targets!==a?h.targets:h.aTargets;for(t.isArray(g)||(g=[g]),l=0,u=g.length;l<u;l++)if("number"==typeof g[l]&&g[l]>=0){for(;p.length<=g[l];)f(e);o(g[l],h)}else if("number"==typeof g[l]&&g[l]<0)o(p.length+g[l],h);else if("string"==typeof g[l])for(c=0,d=p.length;c<d;c++)("_all"==g[l]||t(p[c].nTh).hasClass(g[l]))&&o(c,h)}if(r)for(i=0,s=r.length;i<s;i++)o(i,r[i])}function D(e,n,r,o){var i=e.aoData.length,s=t.extend(!0,{},qt.models.oRow,{src:r?"dom":"data",idx:i});s._aData=n,e.aoData.push(s);for(var l=e.aoColumns,u=0,c=l.length;u<c;u++)l[u].sType=null;e.aiDisplayMaster.push(i);var f=e.rowIdFn(n);return f!==a&&(e.aIds[f]=s),!r&&e.oFeatures.bDeferRender||R(e,i,r,o),i}function y(e,n){var a;return n instanceof t||(n=t(n)),n.map(function(t,n){return a=P(e,n),D(e,a.data,n,a.cells)})}function _(t,e,n,r){var o=t.iDraw,i=t.aoColumns[n],s=t.aoData[e]._aData,l=i.sDefaultContent,u=i.fnGetData(s,r,{settings:t,row:e,col:n});if(u===a)return t.iDrawError!=o&&null===l&&(Lt(t,0,"Requested unknown parameter "+("function"==typeof i.mData?"{function}":"'"+i.mData+"'")+" for row "+e+", column "+n,4),t.iDrawError=o),l;if(u!==s&&null!==u||null===l||r===a){if("function"==typeof u)return u.call(s)}else u=l;return null===u&&"display"==r?"":u}function w(t,e,n,a){var r=t.aoColumns[n],o=t.aoData[e]._aData;r.fnSetData(o,a,{settings:t,row:e,col:n})}function T(e){return t.map(e.match(/(\\.|[^\.])+/g)||[""],function(t){return t.replace(/\\\./g,".")})}function C(e){if(t.isPlainObject(e)){var n={};return t.each(e,function(t,e){e&&(n[t]=C(e))}),function(t,e,r,o){var i=n[e]||n._;return i!==a?i(t,e,r,o):t}}if(null===e)return function(t){return t};if("function"==typeof e)return function(t,n,a,r){return e(t,n,a,r)};if("string"!=typeof e||-1===e.indexOf(".")&&-1===e.indexOf("[")&&-1===e.indexOf("("))return function(t,n){return t[e]};var r=function(e,n,o){var i,s,l,u;if(""!==o)for(var c=T(o),f=0,d=c.length;f<d;f++){if(i=c[f].match(de),s=c[f].match(he),i){if(c[f]=c[f].replace(de,""),""!==c[f]&&(e=e[c[f]]),l=[],c.splice(0,f+1),u=c.join("."),t.isArray(e))for(var h=0,p=e.length;h<p;h++)l.push(r(e[h],n,u));var g=i[0].substring(1,i[0].length-1);e=""===g?l:l.join(g);break}if(s)c[f]=c[f].replace(he,""),e=e[c[f]]();else{if(null===e||e[c[f]]===a)return a;e=e[c[f]]}}return e};return function(t,n){return r(t,n,e)}}function x(e){if(t.isPlainObject(e))return x(e._);if(null===e)return function(){};if("function"==typeof e)return function(t,n,a){e(t,"set",n,a)};if("string"!=typeof e||-1===e.indexOf(".")&&-1===e.indexOf("[")&&-1===e.indexOf("("))return function(t,n){t[e]=n};var n=function(e,r,o){for(var i,s,l,u,c,f=T(o),d=f[f.length-1],h=0,p=f.length-1;h<p;h++){if(s=f[h].match(de),l=f[h].match(he),s){if(f[h]=f[h].replace(de,""),e[f[h]]=[],(i=f.slice()).splice(0,h+1),c=i.join("."),t.isArray(r))for(var g=0,b=r.length;g<b;g++)n(u={},r[g],c),e[f[h]].push(u);else e[f[h]]=r;return}l&&(f[h]=f[h].replace(he,""),e=e[f[h]](r)),null!==e[f[h]]&&e[f[h]]!==a||(e[f[h]]={}),e=e[f[h]]}d.match(he)?e=e[d.replace(he,"")](r):e[d.replace(de,"")]=r};return function(t,a){return n(t,a,e)}}function I(t){return oe(t.aoData,"_aData")}function A(t){t.aoData.length=0,t.aiDisplayMaster.length=0,t.aiDisplay.length=0,t.aIds={}}function F(t,e,n){for(var r=-1,o=0,i=t.length;o<i;o++)t[o]==e?r=o:t[o]>e&&t[o]--;-1!=r&&n===a&&t.splice(r,1)}function L(t,e,n,r){var o,i,s=t.aoData[e],l=function(n,a){for(;n.childNodes.length;)n.removeChild(n.firstChild);n.innerHTML=_(t,e,a,"display")};if("dom"!==n&&(n&&"auto"!==n||"dom"!==s.src)){var u=s.anCells;if(u)if(r!==a)l(u[r],r);else for(o=0,i=u.length;o<i;o++)l(u[o],o)}else s._aData=P(t,s,r,r===a?a:s._aData).data;s._aSortData=null,s._aFilterData=null;var c=t.aoColumns;if(r!==a)c[r].sType=null;else{for(o=0,i=c.length;o<i;o++)c[o].sType=null;j(t,s)}}function P(e,n,r,o){var i,s,l,u=[],c=n.firstChild,f=0,d=e.aoColumns,h=e._rowReadObject;o=o!==a?o:h?{}:[];var p=function(t,e){if("string"==typeof t){var n=t.indexOf("@");if(-1!==n){var a=t.substring(n+1);x(t)(o,e.getAttribute(a))}}},g=function(e){r!==a&&r!==f||(s=d[f],l=t.trim(e.innerHTML),s&&s._bAttrSrc?(x(s.mData._)(o,l),p(s.mData.sort,e),p(s.mData.type,e),p(s.mData.filter,e)):h?(s._setter||(s._setter=x(s.mData)),s._setter(o,l)):o[f]=l),f++};if(c)for(;c;)"TD"!=(i=c.nodeName.toUpperCase())&&"TH"!=i||(g(c),u.push(c)),c=c.nextSibling;else for(var b=0,v=(u=n.anCells).length;b<v;b++)g(u[b]);var S=n.firstChild?n:n.nTr;if(S){var m=S.getAttribute("id");m&&x(e.rowId)(o,m)}return{data:o,cells:u}}function R(e,a,r,o){var i,s,l,u,c,f=e.aoData[a],d=f._aData,h=[];if(null===f.nTr){for(i=r||n.createElement("tr"),f.nTr=i,f.anCells=h,i._DT_RowIndex=a,j(e,f),u=0,c=e.aoColumns.length;u<c;u++)l=e.aoColumns[u],(s=r?o[u]:n.createElement(l.sCellType))._DT_CellIndex={row:a,column:u},h.push(s),r&&!l.mRender&&l.mData===u||t.isPlainObject(l.mData)&&l.mData._===u+".display"||(s.innerHTML=_(e,a,u,"display")),l.sClass&&(s.className+=" "+l.sClass),l.bVisible&&!r?i.appendChild(s):!l.bVisible&&r&&s.parentNode.removeChild(s),l.fnCreatedCell&&l.fnCreatedCell.call(e.oInstance,s,_(e,a,u),d,a,u);Nt(e,"aoRowCreatedCallback",null,[i,d,a])}f.nTr.setAttribute("role","row")}function j(e,n){var a=n.nTr,r=n._aData;if(a){var o=e.rowIdFn(r);if(o&&(a.id=o),r.DT_RowClass){var i=r.DT_RowClass.split(" ");n.__rowc=n.__rowc?ce(n.__rowc.concat(i)):i,t(a).removeClass(n.__rowc.join(" ")).addClass(r.DT_RowClass)}r.DT_RowAttr&&t(a).attr(r.DT_RowAttr),r.DT_RowData&&t(a).data(r.DT_RowData)}}function H(e){var n,a,r,o,i,s=e.nTHead,l=e.nTFoot,u=0===t("th, td",s).length,c=e.oClasses,f=e.aoColumns;for(u&&(o=t("<tr/>").appendTo(s)),n=0,a=f.length;n<a;n++)i=f[n],r=t(i.nTh).addClass(i.sClass),u&&r.appendTo(o),e.oFeatures.bSort&&(r.addClass(i.sSortingClass),!1!==i.bSortable&&(r.attr("tabindex",e.iTabIndex).attr("aria-controls",e.sTableId),Tt(e,i.nTh,n))),i.sTitle!=r[0].innerHTML&&r.html(i.sTitle),Ot(e,"header")(e,r,i,c);if(u&&M(e.aoHeader,s),t(s).find(">tr").attr("role","row"),t(s).find(">tr>th, >tr>td").addClass(c.sHeaderTH),t(l).find(">tr>th, >tr>td").addClass(c.sFooterTH),null!==l){var d=e.aoFooter[0];for(n=0,a=d.length;n<a;n++)(i=f[n]).nTf=d[n].cell,i.sClass&&t(i.nTf).addClass(i.sClass)}}function N(e,n,r){var o,i,s,l,u,c,f,d,h,p=[],g=[],b=e.aoColumns.length;if(n){for(r===a&&(r=!1),o=0,i=n.length;o<i;o++){for(p[o]=n[o].slice(),p[o].nTr=n[o].nTr,s=b-1;s>=0;s--)e.aoColumns[s].bVisible||r||p[o].splice(s,1);g.push([])}for(o=0,i=p.length;o<i;o++){if(f=p[o].nTr)for(;c=f.firstChild;)f.removeChild(c);for(s=0,l=p[o].length;s<l;s++)if(d=1,h=1,g[o][s]===a){for(f.appendChild(p[o][s].cell),g[o][s]=1;p[o+d]!==a&&p[o][s].cell==p[o+d][s].cell;)g[o+d][s]=1,d++;for(;p[o][s+h]!==a&&p[o][s].cell==p[o][s+h].cell;){for(u=0;u<d;u++)g[o+u][s+h]=1;h++}t(p[o][s].cell).attr("rowspan",d).attr("colspan",h)}}}}function W(e){var n=Nt(e,"aoPreDrawCallback","preDraw",[e]);if(-1===t.inArray(!1,n)){var r=[],o=0,i=e.asStripeClasses,s=i.length,l=(e.aoOpenRows.length,e.oLanguage),u=e.iInitDisplayStart,c="ssp"==kt(e),f=e.aiDisplay;e.bDrawing=!0,u!==a&&-1!==u&&(e._iDisplayStart=c?u:u>=e.fnRecordsDisplay()?0:u,e.iInitDisplayStart=-1);var d=e._iDisplayStart,h=e.fnDisplayEnd();if(e.bDeferLoading)e.bDeferLoading=!1,e.iDraw++,ft(e,!1);else if(c){if(!e.bDestroying&&!E(e))return}else e.iDraw++;if(0!==f.length)for(var p=c?0:d,g=c?e.aoData.length:h,v=p;v<g;v++){var S=f[v],m=e.aoData[S];null===m.nTr&&R(e,S);var D=m.nTr;if(0!==s){var y=i[o%s];m._sRowStripe!=y&&(t(D).removeClass(m._sRowStripe).addClass(y),m._sRowStripe=y)}Nt(e,"aoRowCallback",null,[D,m._aData,o,v]),r.push(D),o++}else{var _=l.sZeroRecords;1==e.iDraw&&"ajax"==kt(e)?_=l.sLoadingRecords:l.sEmptyTable&&0===e.fnRecordsTotal()&&(_=l.sEmptyTable),r[0]=t("<tr/>",{class:s?i[0]:""}).append(t("<td />",{valign:"top",colSpan:b(e),class:e.oClasses.sRowEmpty}).html(_))[0]}Nt(e,"aoHeaderCallback","header",[t(e.nTHead).children("tr")[0],I(e),d,h,f]),Nt(e,"aoFooterCallback","footer",[t(e.nTFoot).children("tr")[0],I(e),d,h,f]);var w=t(e.nTBody);w.children().detach(),w.append(t(r)),Nt(e,"aoDrawCallback","draw",[e]),e.bSorted=!1,e.bFiltered=!1,e.bDrawing=!1}else ft(e,!1)}function O(t,e){var n=t.oFeatures,a=n.bSort,r=n.bFilter;a&&yt(t),r?G(t,t.oPreviousSearch):t.aiDisplay=t.aiDisplayMaster.slice(),!0!==e&&(t._iDisplayStart=0),t._drawHold=e,W(t),t._drawHold=!1}function k(e){var n=e.oClasses,a=t(e.nTable),r=t("<div/>").insertBefore(a),o=e.oFeatures,i=t("<div/>",{id:e.sTableId+"_wrapper",class:n.sWrapper+(e.nTFoot?"":" "+n.sNoFooter)});e.nHolding=r[0],e.nTableWrapper=i[0],e.nTableReinsertBefore=e.nTable.nextSibling;for(var s,l,u,c,f,d,h=e.sDom.split(""),p=0;p<h.length;p++){if(s=null,"<"==(l=h[p])){if(u=t("<div/>")[0],"'"==(c=h[p+1])||'"'==c){for(f="",d=2;h[p+d]!=c;)f+=h[p+d],d++;if("H"==f?f=n.sJUIHeader:"F"==f&&(f=n.sJUIFooter),-1!=f.indexOf(".")){var g=f.split(".");u.id=g[0].substr(1,g[0].length-1),u.className=g[1]}else"#"==f.charAt(0)?u.id=f.substr(1,f.length-1):u.className=f;p+=d}i.append(u),i=t(u)}else if(">"==l)i=i.parent();else if("l"==l&&o.bPaginate&&o.bLengthChange)s=st(e);else if("f"==l&&o.bFilter)s=q(e);else if("r"==l&&o.bProcessing)s=ct(e);else if("t"==l)s=dt(e);else if("i"==l&&o.bInfo)s=et(e);else if("p"==l&&o.bPaginate)s=lt(e);else if(0!==qt.ext.feature.length)for(var b=qt.ext.feature,v=0,S=b.length;v<S;v++)if(l==b[v].cFeature){s=b[v].fnInit(e);break}if(s){var m=e.aanFeatures;m[l]||(m[l]=[]),m[l].push(s),i.append(s)}}r.replaceWith(i),e.nHolding=null}function M(e,n){var a,r,o,i,s,l,u,c,f,d,h,p=t(n).children("tr");for(e.splice(0,e.length),o=0,l=p.length;o<l;o++)e.push([]);for(o=0,l=p.length;o<l;o++)for(c=0,r=(a=p[o]).firstChild;r;){if("TD"==r.nodeName.toUpperCase()||"TH"==r.nodeName.toUpperCase())for(f=1*r.getAttribute("colspan"),d=1*r.getAttribute("rowspan"),f=f&&0!==f&&1!==f?f:1,d=d&&0!==d&&1!==d?d:1,u=function(t,e,n){for(var a=t[e];a[n];)n++;return n}(e,o,c),h=1===f,s=0;s<f;s++)for(i=0;i<d;i++)e[o+i][u+s]={cell:r,unique:h},e[o+i].nTr=a;r=r.nextSibling}}function U(t,e,n){var a=[];n||(n=t.aoHeader,e&&M(n=[],e));for(var r=0,o=n.length;r<o;r++)for(var i=0,s=n[r].length;i<s;i++)!n[r][i].unique||a[i]&&t.bSortCellsTop||(a[i]=n[r][i].cell);return a}function B(e,n,a){if(Nt(e,"aoServerParams","serverParams",[n]),n&&t.isArray(n)){var r={},o=/(.*?)\[\]$/;t.each(n,function(t,e){var n=e.name.match(o);if(n){var a=n[0];r[a]||(r[a]=[]),r[a].push(e.value)}else r[e.name]=e.value}),n=r}var i,s=e.ajax,l=e.oInstance,u=function(t){Nt(e,null,"xhr",[e,t,e.jqXHR]),a(t)};if(t.isPlainObject(s)&&s.data){i=s.data;var c=t.isFunction(i)?i(n,e):i;n=t.isFunction(i)&&c?c:t.extend(!0,n,c),delete s.data}var f={data:n,success:function(t){var n=t.error||t.sError;n&&Lt(e,0,n),e.json=t,u(t)},dataType:"json",cache:!1,type:e.sServerMethod,error:function(n,a,r){var o=Nt(e,null,"xhr",[e,null,e.jqXHR]);-1===t.inArray(!0,o)&&("parsererror"==a?Lt(e,0,"Invalid JSON response",1):4===n.readyState&&Lt(e,0,"Ajax error",7)),ft(e,!1)}};e.oAjaxData=n,Nt(e,null,"preXhr",[e,n]),e.fnServerData?e.fnServerData.call(l,e.sAjaxSource,t.map(n,function(t,e){return{name:e,value:t}}),u,e):e.sAjaxSource||"string"==typeof s?e.jqXHR=t.ajax(t.extend(f,{url:s||e.sAjaxSource})):t.isFunction(s)?e.jqXHR=s.call(l,n,u,e):(e.jqXHR=t.ajax(t.extend(f,s)),s.data=i)}function E(t){return!t.bAjaxDataGet||(t.iDraw++,ft(t,!0),B(t,J(t),function(e){V(t,e)}),!1)}function J(e){var n,a,r,o,i=e.aoColumns,s=i.length,l=e.oFeatures,u=e.oPreviousSearch,c=e.aoPreSearchCols,f=[],d=Dt(e),h=e._iDisplayStart,p=!1!==l.bPaginate?e._iDisplayLength:-1,g=function(t,e){f.push({name:t,value:e})};g("sEcho",e.iDraw),g("iColumns",s),g("sColumns",oe(i,"sName").join(",")),g("iDisplayStart",h),g("iDisplayLength",p);var b={draw:e.iDraw,columns:[],order:[],start:h,length:p,search:{value:u.sSearch,regex:u.bRegex}};for(n=0;n<s;n++)r=i[n],o=c[n],a="function"==typeof r.mData?"function":r.mData,b.columns.push({data:a,name:r.sName,searchable:r.bSearchable,orderable:r.bSortable,search:{value:o.sSearch,regex:o.bRegex}}),g("mDataProp_"+n,a),l.bFilter&&(g("sSearch_"+n,o.sSearch),g("bRegex_"+n,o.bRegex),g("bSearchable_"+n,r.bSearchable)),l.bSort&&g("bSortable_"+n,r.bSortable);l.bFilter&&(g("sSearch",u.sSearch),g("bRegex",u.bRegex)),l.bSort&&(t.each(d,function(t,e){b.order.push({column:e.col,dir:e.dir}),g("iSortCol_"+t,e.col),g("sSortDir_"+t,e.dir)}),g("iSortingCols",d.length));var v=qt.ext.legacy.ajax;return null===v?e.sAjaxSource?f:b:v?f:b}function V(t,e){var n=function(t,n){return e[t]!==a?e[t]:e[n]},r=X(t,e),o=n("sEcho","draw"),i=n("iTotalRecords","recordsTotal"),s=n("iTotalDisplayRecords","recordsFiltered");if(o){if(1*o<t.iDraw)return;t.iDraw=1*o}A(t),t._iRecordsTotal=parseInt(i,10),t._iRecordsDisplay=parseInt(s,10);for(var l=0,u=r.length;l<u;l++)D(t,r[l]);t.aiDisplay=t.aiDisplayMaster.slice(),t.bAjaxDataGet=!1,W(t),t._bInitComplete||ot(t,e),t.bAjaxDataGet=!0,ft(t,!1)}function X(e,n){var r=t.isPlainObject(e.ajax)&&e.ajax.dataSrc!==a?e.ajax.dataSrc:e.sAjaxDataProp;return"data"===r?n.aaData||n[r]:""!==r?C(r)(n):n}function q(e){var a=e.oClasses,r=e.sTableId,o=e.oLanguage,i=e.oPreviousSearch,s=e.aanFeatures,l='<input type="search" class="'+a.sFilterInput+'"/>',u=o.sSearch;u=u.match(/_INPUT_/)?u.replace("_INPUT_",l):u+l;var c=t("<div/>",{id:s.f?null:r+"_filter",class:a.sFilter}).append(t("<label/>").append(u)),f=function(){s.f;var t=this.value?this.value:"";t!=i.sSearch&&(G(e,{sSearch:t,bRegex:i.bRegex,bSmart:i.bSmart,bCaseInsensitive:i.bCaseInsensitive}),e._iDisplayStart=0,W(e))},d=null!==e.searchDelay?e.searchDelay:"ssp"===kt(e)?400:0,h=t("input",c).val(i.sSearch).attr("placeholder",o.sSearchPlaceholder).on("keyup.DT search.DT input.DT paste.DT cut.DT",d?Se(f,d):f).on("keypress.DT",function(t){if(13==t.keyCode)return!1}).attr("aria-controls",r);return t(e.nTable).on("search.dt.DT",function(t,a){if(e===a)try{h[0]!==n.activeElement&&h.val(i.sSearch)}catch(t){}}),c[0]}function G(t,e,n){var r=t.oPreviousSearch,o=t.aoPreSearchCols,i=function(t){r.sSearch=t.sSearch,r.bRegex=t.bRegex,r.bSmart=t.bSmart,r.bCaseInsensitive=t.bCaseInsensitive},s=function(t){return t.bEscapeRegex!==a?!t.bEscapeRegex:t.bRegex};if(S(t),"ssp"!=kt(t)){Y(t,e.sSearch,n,s(e),e.bSmart,e.bCaseInsensitive),i(e);for(var l=0;l<o.length;l++)z(t,o[l].sSearch,l,s(o[l]),o[l].bSmart,o[l].bCaseInsensitive);$(t)}else i(e);t.bFiltered=!0,Nt(t,null,"search",[t])}function $(e){for(var n,a,r=qt.ext.search,o=e.aiDisplay,i=0,s=r.length;i<s;i++){for(var l=[],u=0,c=o.length;u<c;u++)a=o[u],n=e.aoData[a],r[i](e,n._aFilterData,a,n._aData,u)&&l.push(a);o.length=0,t.merge(o,l)}}function z(t,e,n,a,r,o){if(""!==e){for(var i,s=[],l=t.aiDisplay,u=Z(e,a,r,o),c=0;c<l.length;c++)i=t.aoData[l[c]]._aFilterData[n],u.test(i)&&s.push(l[c]);t.aiDisplay=s}}function Y(t,e,n,a,r,o){var i,s,l,u=Z(e,a,r,o),c=t.oPreviousSearch.sSearch,f=t.aiDisplayMaster,d=[];if(0!==qt.ext.search.length&&(n=!0),s=Q(t),e.length<=0)t.aiDisplay=f.slice();else{for((s||n||c.length>e.length||0!==e.indexOf(c)||t.bSorted)&&(t.aiDisplay=f.slice()),i=t.aiDisplay,l=0;l<i.length;l++)u.test(t.aoData[i[l]]._sFilterRow)&&d.push(i[l]);t.aiDisplay=d}}function Z(e,n,a,r){return e=n?e:pe(e),a&&(e="^(?=.*?"+t.map(e.match(/"[^"]+"|[^ ]+/g)||[""],function(t){if('"'===t.charAt(0)){var e=t.match(/^"(.*)"$/);t=e?e[1]:t}return t.replace('"',"")}).join(")(?=.*?")+").*$"),new RegExp(e,r?"i":"")}function Q(t){var e,n,a,r,o,i,s,l,u=t.aoColumns,c=qt.ext.type.search,f=!1;for(n=0,r=t.aoData.length;n<r;n++)if(!(l=t.aoData[n])._aFilterData){for(i=[],a=0,o=u.length;a<o;a++)(e=u[a]).bSearchable?(s=_(t,n,a,"filter"),c[e.sType]&&(s=c[e.sType](s)),null===s&&(s=""),"string"!=typeof s&&s.toString&&(s=s.toString())):s="",s.indexOf&&-1!==s.indexOf("&")&&(ge.innerHTML=s,s=be?ge.textContent:ge.innerText),s.replace&&(s=s.replace(/[\r\n]/g,"")),i.push(s);l._aFilterData=i,l._sFilterRow=i.join(" "),f=!0}return f}function K(t){return{search:t.sSearch,smart:t.bSmart,regex:t.bRegex,caseInsensitive:t.bCaseInsensitive}}function tt(t){return{sSearch:t.search,bSmart:t.smart,bRegex:t.regex,bCaseInsensitive:t.caseInsensitive}}function et(e){var n=e.sTableId,a=e.aanFeatures.i,r=t("<div/>",{class:e.oClasses.sInfo,id:a?null:n+"_info"});return a||(e.aoDrawCallback.push({fn:nt,sName:"information"}),r.attr("role","status").attr("aria-live","polite"),t(e.nTable).attr("aria-describedby",n+"_info")),r[0]}function nt(e){var n=e.aanFeatures.i;if(0!==n.length){var a=e.oLanguage,r=e._iDisplayStart+1,o=e.fnDisplayEnd(),i=e.fnRecordsTotal(),s=e.fnRecordsDisplay(),l=s?a.sInfo:a.sInfoEmpty;s!==i&&(l+=" "+a.sInfoFiltered),l=at(e,l+=a.sInfoPostFix);var u=a.fnInfoCallback;null!==u&&(l=u.call(e.oInstance,e,r,o,i,s,l)),t(n).html(l)}}function at(t,e){var n=t.fnFormatNumber,a=t._iDisplayStart+1,r=t._iDisplayLength,o=t.fnRecordsDisplay(),i=-1===r;return e.replace(/_START_/g,n.call(t,a)).replace(/_END_/g,n.call(t,t.fnDisplayEnd())).replace(/_MAX_/g,n.call(t,t.fnRecordsTotal())).replace(/_TOTAL_/g,n.call(t,o)).replace(/_PAGE_/g,n.call(t,i?1:Math.ceil(a/r))).replace(/_PAGES_/g,n.call(t,i?1:Math.ceil(o/r)))}function rt(t){var e,n,a,r=t.iInitDisplayStart,o=t.aoColumns,i=t.oFeatures,s=t.bDeferLoading;if(t.bInitialised){for(k(t),H(t),N(t,t.aoHeader),N(t,t.aoFooter),ft(t,!0),i.bAutoWidth&>(t),e=0,n=o.length;e<n;e++)(a=o[e]).sWidth&&(a.nTh.style.width=mt(a.sWidth));Nt(t,null,"preInit",[t]),O(t);var l=kt(t);("ssp"!=l||s)&&("ajax"==l?B(t,[],function(n){var a=X(t,n);for(e=0;e<a.length;e++)D(t,a[e]);t.iInitDisplayStart=r,O(t),ft(t,!1),ot(t,n)},t):(ft(t,!1),ot(t)))}else setTimeout(function(){rt(t)},200)}function ot(t,e){t._bInitComplete=!0,(e||t.oInit.aaData)&&h(t),Nt(t,null,"plugin-init",[t,e]),Nt(t,"aoInitComplete","init",[t,e])}function it(t,e){var n=parseInt(e,10);t._iDisplayLength=n,Wt(t),Nt(t,null,"length",[t,n])}function st(e){for(var n=e.oClasses,a=e.sTableId,r=e.aLengthMenu,o=t.isArray(r[0]),i=o?r[0]:r,s=o?r[1]:r,l=t("<select/>",{name:a+"_length","aria-controls":a,class:n.sLengthSelect}),u=0,c=i.length;u<c;u++)l[0][u]=new Option(s[u],i[u]);var f=t("<div><label/></div>").addClass(n.sLength);return e.aanFeatures.l||(f[0].id=a+"_length"),f.children().append(e.oLanguage.sLengthMenu.replace("_MENU_",l[0].outerHTML)),t("select",f).val(e._iDisplayLength).on("change.DT",function(n){it(e,t(this).val()),W(e)}),t(e.nTable).on("length.dt.DT",function(n,a,r){e===a&&t("select",f).val(r)}),f[0]}function lt(e){var n=e.sPaginationType,a=qt.ext.pager[n],r="function"==typeof a,o=function(t){W(t)},i=t("<div/>").addClass(e.oClasses.sPaging+n)[0],s=e.aanFeatures;return r||a.fnInit(e,i,o),s.p||(i.id=e.sTableId+"_paginate",e.aoDrawCallback.push({fn:function(t){if(r){var e,n,i=t._iDisplayStart,l=t._iDisplayLength,u=t.fnRecordsDisplay(),c=-1===l,f=c?0:Math.ceil(i/l),d=c?1:Math.ceil(u/l),h=a(f,d);for(e=0,n=s.p.length;e<n;e++)Ot(t,"pageButton")(t,s.p[e],e,h,f,d)}else a.fnUpdate(t,o)},sName:"pagination"})),i}function ut(t,e,n){var a=t._iDisplayStart,r=t._iDisplayLength,o=t.fnRecordsDisplay();0===o||-1===r?a=0:"number"==typeof e?(a=e*r)>o&&(a=0):"first"==e?a=0:"previous"==e?(a=r>=0?a-r:0)<0&&(a=0):"next"==e?a+r<o&&(a+=r):"last"==e?a=Math.floor((o-1)/r)*r:Lt(t,0,"Unknown paging action: "+e,5);var i=t._iDisplayStart!==a;return t._iDisplayStart=a,i&&(Nt(t,null,"page",[t]),n&&W(t)),i}function ct(e){return t("<div/>",{id:e.aanFeatures.r?null:e.sTableId+"_processing",class:e.oClasses.sProcessing}).html(e.oLanguage.sProcessing).insertBefore(e.nTable)[0]}function ft(e,n){e.oFeatures.bProcessing&&t(e.aanFeatures.r).css("display",n?"block":"none"),Nt(e,null,"processing",[e,n])}function dt(e){var n=t(e.nTable);n.attr("role","grid");var a=e.oScroll;if(""===a.sX&&""===a.sY)return e.nTable;var r=a.sX,o=a.sY,i=e.oClasses,s=n.children("caption"),l=s.length?s[0]._captionSide:null,u=t(n[0].cloneNode(!1)),c=t(n[0].cloneNode(!1)),f=n.children("tfoot"),d="<div/>",h=function(t){return t?mt(t):null};f.length||(f=null);var p=t(d,{class:i.sScrollWrapper}).append(t(d,{class:i.sScrollHead}).css({overflow:"hidden",position:"relative",border:0,width:r?h(r):"100%"}).append(t(d,{class:i.sScrollHeadInner}).css({"box-sizing":"content-box",width:a.sXInner||"100%"}).append(u.removeAttr("id").css("margin-left",0).append("top"===l?s:null).append(n.children("thead"))))).append(t(d,{class:i.sScrollBody}).css({position:"relative",overflow:"auto",width:h(r)}).append(n));f&&p.append(t(d,{class:i.sScrollFoot}).css({overflow:"hidden",border:0,width:r?h(r):"100%"}).append(t(d,{class:i.sScrollFootInner}).append(c.removeAttr("id").css("margin-left",0).append("bottom"===l?s:null).append(n.children("tfoot")))));var g=p.children(),b=g[0],v=g[1],S=f?g[2]:null;return r&&t(v).on("scroll.DT",function(t){var e=this.scrollLeft;b.scrollLeft=e,f&&(S.scrollLeft=e)}),t(v).css(o&&a.bCollapse?"max-height":"height",o),e.nScrollHead=b,e.nScrollBody=v,e.nScrollFoot=S,e.aoDrawCallback.push({fn:ht,sName:"scrolling"}),p[0]}function ht(e){var n,r,o,i,s,l,u,c,f,d=e.oScroll,g=d.sX,b=d.sXInner,v=d.sY,S=d.iBarWidth,m=t(e.nScrollHead),D=m[0].style,y=m.children("div"),_=y[0].style,w=y.children("table"),T=e.nScrollBody,C=t(T),x=T.style,I=t(e.nScrollFoot).children("div"),A=I.children("table"),F=t(e.nTHead),L=t(e.nTable),P=L[0],R=P.style,j=e.nTFoot?t(e.nTFoot):null,H=e.oBrowser,N=H.bScrollOversize,W=oe(e.aoColumns,"nTh"),O=[],k=[],M=[],B=[],E=function(t){var e=t.style;e.paddingTop="0",e.paddingBottom="0",e.borderTopWidth="0",e.borderBottomWidth="0",e.height=0},J=T.scrollHeight>T.clientHeight;if(e.scrollBarVis!==J&&e.scrollBarVis!==a)return e.scrollBarVis=J,void h(e);e.scrollBarVis=J,L.children("thead, tfoot").remove(),j&&(l=j.clone().prependTo(L),r=j.find("tr"),i=l.find("tr")),s=F.clone().prependTo(L),n=F.find("tr"),o=s.find("tr"),s.find("th, td").removeAttr("tabindex"),g||(x.width="100%",m[0].style.width="100%"),t.each(U(e,s),function(t,n){u=p(e,t),n.style.width=e.aoColumns[u].sWidth}),j&&pt(function(t){t.style.width=""},i),f=L.outerWidth(),""===g?(R.width="100%",N&&(L.find("tbody").height()>T.offsetHeight||"scroll"==C.css("overflow-y"))&&(R.width=mt(L.outerWidth()-S)),f=L.outerWidth()):""!==b&&(R.width=mt(b),f=L.outerWidth()),pt(E,o),pt(function(e){M.push(e.innerHTML),O.push(mt(t(e).css("width")))},o),pt(function(e,n){-1!==t.inArray(e,W)&&(e.style.width=O[n])},n),t(o).height(0),j&&(pt(E,i),pt(function(e){B.push(e.innerHTML),k.push(mt(t(e).css("width")))},i),pt(function(t,e){t.style.width=k[e]},r),t(i).height(0)),pt(function(t,e){t.innerHTML='<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+M[e]+"</div>",t.style.width=O[e]},o),j&&pt(function(t,e){t.innerHTML='<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+B[e]+"</div>",t.style.width=k[e]},i),L.outerWidth()<f?(c=T.scrollHeight>T.offsetHeight||"scroll"==C.css("overflow-y")?f+S:f,N&&(T.scrollHeight>T.offsetHeight||"scroll"==C.css("overflow-y"))&&(R.width=mt(c-S)),""!==g&&""===b||Lt(e,1,"Possible column misalignment",6)):c="100%",x.width=mt(c),D.width=mt(c),j&&(e.nScrollFoot.style.width=mt(c)),v||N&&(x.height=mt(P.offsetHeight+S));var V=L.outerWidth();w[0].style.width=mt(V),_.width=mt(V);var X=L.height()>T.clientHeight||"scroll"==C.css("overflow-y"),q="padding"+(H.bScrollbarLeft?"Left":"Right");_[q]=X?S+"px":"0px",j&&(A[0].style.width=mt(V),I[0].style.width=mt(V),I[0].style[q]=X?S+"px":"0px"),L.children("colgroup").insertBefore(L.children("thead")),C.scroll(),!e.bSorted&&!e.bFiltered||e._drawHold||(T.scrollTop=0)}function pt(t,e,n){for(var a,r,o=0,i=0,s=e.length;i<s;){for(a=e[i].firstChild,r=n?n[i].firstChild:null;a;)1===a.nodeType&&(n?t(a,r,o):t(a,o),o++),a=a.nextSibling,r=n?r.nextSibling:null;i++}}function gt(n){var a,r,o,i=n.nTable,s=n.aoColumns,l=n.oScroll,u=l.sY,c=l.sX,f=l.sXInner,d=s.length,g=v(n,"bVisible"),S=t("th",n.nTHead),m=i.getAttribute("width"),D=i.parentNode,y=!1,_=n.oBrowser,w=_.bScrollOversize,T=i.style.width;for(T&&-1!==T.indexOf("%")&&(m=T),a=0;a<g.length;a++)null!==(r=s[g[a]]).sWidth&&(r.sWidth=bt(r.sWidthOrig,D),y=!0);if(w||!y&&!c&&!u&&d==b(n)&&d==S.length)for(a=0;a<d;a++){var C=p(n,a);null!==C&&(s[C].sWidth=mt(S.eq(a).width()))}else{var x=t(i).clone().css("visibility","hidden").removeAttr("id");x.find("tbody tr").remove();var I=t("<tr/>").appendTo(x.find("tbody"));for(x.find("thead, tfoot").remove(),x.append(t(n.nTHead).clone()).append(t(n.nTFoot).clone()),x.find("tfoot th, tfoot td").css("width",""),S=U(n,x.find("thead")[0]),a=0;a<g.length;a++)r=s[g[a]],S[a].style.width=null!==r.sWidthOrig&&""!==r.sWidthOrig?mt(r.sWidthOrig):"",r.sWidthOrig&&c&&t(S[a]).append(t("<div/>").css({width:r.sWidthOrig,margin:0,padding:0,border:0,height:1}));if(n.aoData.length)for(a=0;a<g.length;a++)r=s[o=g[a]],t(vt(n,o)).clone(!1).append(r.sContentPadding).appendTo(I);t("[name]",x).removeAttr("name");var A=t("<div/>").css(c||u?{position:"absolute",top:0,left:0,height:1,right:0,overflow:"hidden"}:{}).append(x).appendTo(D);c&&f?x.width(f):c?(x.css("width","auto"),x.removeAttr("width"),x.width()<D.clientWidth&&m&&x.width(D.clientWidth)):u?x.width(D.clientWidth):m&&x.width(m);var F=0;for(a=0;a<g.length;a++){var L=t(S[a]),P=L.outerWidth()-L.width(),R=_.bBounding?Math.ceil(S[a].getBoundingClientRect().width):L.outerWidth();F+=R,s[g[a]].sWidth=mt(R-P)}i.style.width=mt(F),A.remove()}if(m&&(i.style.width=mt(m)),(m||c)&&!n._reszEvt){var j=function(){t(e).on("resize.DT-"+n.sInstance,Se(function(){h(n)}))};w?setTimeout(j,1e3):j(),n._reszEvt=!0}}function bt(e,a){if(!e)return 0;var r=t("<div/>").css("width",mt(e)).appendTo(a||n.body),o=r[0].offsetWidth;return r.remove(),o}function vt(e,n){var a=St(e,n);if(a<0)return null;var r=e.aoData[a];return r.nTr?r.anCells[n]:t("<td/>").html(_(e,a,n,"display"))[0]}function St(t,e){for(var n,a=-1,r=-1,o=0,i=t.aoData.length;o<i;o++)(n=(n=(n=_(t,o,e,"display")+"").replace(ve,"")).replace(/ /g," ")).length>a&&(a=n.length,r=o);return r}function mt(t){return null===t?"0px":"number"==typeof t?t<0?"0px":t+"px":t.match(/\d$/)?t+"px":t}function Dt(e){var n,r,o,i,s,l,u,c=[],f=e.aoColumns,d=e.aaSortingFixed,h=t.isPlainObject(d),p=[],g=function(e){e.length&&!t.isArray(e[0])?p.push(e):t.merge(p,e)};for(t.isArray(d)&&g(d),h&&d.pre&&g(d.pre),g(e.aaSorting),h&&d.post&&g(d.post),n=0;n<p.length;n++)for(r=0,o=(i=f[u=p[n][0]].aDataSort).length;r<o;r++)l=f[s=i[r]].sType||"string",p[n]._idx===a&&(p[n]._idx=t.inArray(p[n][1],f[s].asSorting)),c.push({src:u,col:s,dir:p[n][1],index:p[n]._idx,type:l,formatter:qt.ext.type.order[l+"-pre"]});return c}function yt(t){var e,n,a,r,o,i=[],s=qt.ext.type.order,l=t.aoData,u=(t.aoColumns,0),c=t.aiDisplayMaster;for(S(t),e=0,n=(o=Dt(t)).length;e<n;e++)(r=o[e]).formatter&&u++,xt(t,r.col);if("ssp"!=kt(t)&&0!==o.length){for(e=0,a=c.length;e<a;e++)i[c[e]]=e;u===o.length?c.sort(function(t,e){var n,a,r,s,u,c=o.length,f=l[t]._aSortData,d=l[e]._aSortData;for(r=0;r<c;r++)if(u=o[r],n=f[u.col],a=d[u.col],0!==(s=n<a?-1:n>a?1:0))return"asc"===u.dir?s:-s;return n=i[t],a=i[e],n<a?-1:n>a?1:0}):c.sort(function(t,e){var n,a,r,u,c,f,d=o.length,h=l[t]._aSortData,p=l[e]._aSortData;for(r=0;r<d;r++)if(c=o[r],n=h[c.col],a=p[c.col],f=s[c.type+"-"+c.dir]||s["string-"+c.dir],0!==(u=f(n,a)))return u;return n=i[t],a=i[e],n<a?-1:n>a?1:0})}t.bSorted=!0}function _t(t){for(var e,n,a=t.aoColumns,r=Dt(t),o=t.oLanguage.oAria,i=0,s=a.length;i<s;i++){var l=a[i],u=l.asSorting,c=l.sTitle.replace(/<.*?>/g,""),f=l.nTh;f.removeAttribute("aria-sort"),l.bSortable?(r.length>0&&r[0].col==i?(f.setAttribute("aria-sort","asc"==r[0].dir?"ascending":"descending"),n=u[r[0].index+1]||u[0]):n=u[0],e=c+("asc"===n?o.sSortAscending:o.sSortDescending)):e=c,f.setAttribute("aria-label",e)}}function wt(e,n,r,o){var i,s=e.aoColumns[n],l=e.aaSorting,u=s.asSorting,c=function(e,n){var r=e._idx;return r===a&&(r=t.inArray(e[1],u)),r+1<u.length?r+1:n?null:0};if("number"==typeof l[0]&&(l=e.aaSorting=[l]),r&&e.oFeatures.bSortMulti){var f=t.inArray(n,oe(l,"0"));-1!==f?(null===(i=c(l[f],!0))&&1===l.length&&(i=0),null===i?l.splice(f,1):(l[f][1]=u[i],l[f]._idx=i)):(l.push([n,u[0],0]),l[l.length-1]._idx=0)}else l.length&&l[0][0]==n?(i=c(l[0]),l.length=1,l[0][1]=u[i],l[0]._idx=i):(l.length=0,l.push([n,u[0]]),l[0]._idx=0);O(e),"function"==typeof o&&o(e)}function Tt(t,e,n,a){var r=t.aoColumns[n];jt(e,{},function(e){!1!==r.bSortable&&(t.oFeatures.bProcessing?(ft(t,!0),setTimeout(function(){wt(t,n,e.shiftKey,a),"ssp"!==kt(t)&&ft(t,!1)},0)):wt(t,n,e.shiftKey,a))})}function Ct(e){var n,a,r,o=e.aLastSort,i=e.oClasses.sSortColumn,s=Dt(e),l=e.oFeatures;if(l.bSort&&l.bSortClasses){for(n=0,a=o.length;n<a;n++)r=o[n].src,t(oe(e.aoData,"anCells",r)).removeClass(i+(n<2?n+1:3));for(n=0,a=s.length;n<a;n++)r=s[n].src,t(oe(e.aoData,"anCells",r)).addClass(i+(n<2?n+1:3))}e.aLastSort=s}function xt(t,e){var n,a=t.aoColumns[e],r=qt.ext.order[a.sSortDataType];r&&(n=r.call(t.oInstance,t,e,g(t,e)));for(var o,i,s=qt.ext.type.order[a.sType+"-pre"],l=0,u=t.aoData.length;l<u;l++)(o=t.aoData[l])._aSortData||(o._aSortData=[]),o._aSortData[e]&&!r||(i=r?n[l]:_(t,l,e,"sort"),o._aSortData[e]=s?s(i):i)}function It(e){if(e.oFeatures.bStateSave&&!e.bDestroying){var n={time:+new Date,start:e._iDisplayStart,length:e._iDisplayLength,order:t.extend(!0,[],e.aaSorting),search:K(e.oPreviousSearch),columns:t.map(e.aoColumns,function(t,n){return{visible:t.bVisible,search:K(e.aoPreSearchCols[n])}})};Nt(e,"aoStateSaveParams","stateSaveParams",[e,n]),e.oSavedState=n,e.fnStateSaveCallback.call(e.oInstance,e,n)}}function At(e,n,r){var o,i,s=e.aoColumns,l=function(n){if(n&&n.time){var l=Nt(e,"aoStateLoadParams","stateLoadParams",[e,u]);if(-1===t.inArray(!1,l)){var c=e.iStateDuration;if(c>0&&n.time<+new Date-1e3*c)r();else if(n.columns&&s.length!==n.columns.length)r();else{if(e.oLoadedState=t.extend(!0,{},u),n.start!==a&&(e._iDisplayStart=n.start,e.iInitDisplayStart=n.start),n.length!==a&&(e._iDisplayLength=n.length),n.order!==a&&(e.aaSorting=[],t.each(n.order,function(t,n){e.aaSorting.push(n[0]>=s.length?[0,n[1]]:n)})),n.search!==a&&t.extend(e.oPreviousSearch,tt(n.search)),n.columns)for(o=0,i=n.columns.length;o<i;o++){var f=n.columns[o];f.visible!==a&&(s[o].bVisible=f.visible),f.search!==a&&t.extend(e.aoPreSearchCols[o],tt(f.search))}Nt(e,"aoStateLoaded","stateLoaded",[e,u]),r()}}else r()}else r()};if(e.oFeatures.bStateSave){var u=e.fnStateLoadCallback.call(e.oInstance,e,l);u!==a&&l(u)}else r()}function Ft(e){var n=qt.settings,a=t.inArray(e,oe(n,"nTable"));return-1!==a?n[a]:null}function Lt(t,n,a,r){if(a="WFDataTables warning: "+(t?"table id="+t.sTableId+" - ":"")+a,r&&(a+=". For more information about this error, please see http://datatables.net/tn/"+r),n)e.console&&console.log&&console.log(a);else{var o=qt.ext,i=o.sErrMode||o.errMode;if(t&&Nt(t,null,"error",[t,r,a]),"alert"==i)alert(a);else{if("throw"==i)throw new Error(a);"function"==typeof i&&i(t,r,a)}}}function Pt(e,n,r,o){t.isArray(r)?t.each(r,function(a,r){t.isArray(r)?Pt(e,n,r[0],r[1]):Pt(e,n,r)}):(o===a&&(o=r),n[r]!==a&&(e[o]=n[r]))}function Rt(e,n,a){var r;for(var o in n)n.hasOwnProperty(o)&&(r=n[o],t.isPlainObject(r)?(t.isPlainObject(e[o])||(e[o]={}),t.extend(!0,e[o],r)):a&&"data"!==o&&"aaData"!==o&&t.isArray(r)?e[o]=r.slice():e[o]=r);return e}function jt(e,n,a){t(e).on("click.DT",n,function(t){e.blur(),a(t)}).on("keypress.DT",n,function(t){13===t.which&&(t.preventDefault(),a(t))}).on("selectstart.DT",function(){return!1})}function Ht(t,e,n,a){n&&t[e].push({fn:n,sName:a})}function Nt(e,n,a,r){var o=[];if(n&&(o=t.map(e[n].slice().reverse(),function(t,n){return t.fn.apply(e.oInstance,r)})),null!==a){var i=t.Event(a+".dt");t(e.nTable).trigger(i,r),o.push(i.result)}return o}function Wt(t){var e=t._iDisplayStart,n=t.fnDisplayEnd(),a=t._iDisplayLength;e>=n&&(e=n-a),e-=e%a,(-1===a||e<0)&&(e=0),t._iDisplayStart=e}function Ot(e,n){var a=e.renderer,r=qt.ext.renderer[n];return t.isPlainObject(a)&&a[n]?r[a[n]]||r._:"string"==typeof a?r[a]||r._:r._}function kt(t){return t.oFeatures.bServerSide?"ssp":t.ajax||t.sAjaxSource?"ajax":"dom"}function Mt(t,e){var n=[],a=ke.numbers_length,r=Math.floor(a/2);return e<=a?n=se(0,e):t<=r?((n=se(0,a-2)).push("ellipsis"),n.push(e-1)):t>=e-1-r?((n=se(e-(a-2),e)).splice(0,0,"ellipsis"),n.splice(0,0,0)):((n=se(t-r+2,t+r-1)).push("ellipsis"),n.push(e-1),n.splice(0,0,"ellipsis"),n.splice(0,0,0)),n.DT_el="span",n}function Ut(e){t.each({num:function(t){return Me(t,e)},"num-fmt":function(t){return Me(t,e,Qt)},"html-num":function(t){return Me(t,e,zt)},"html-num-fmt":function(t){return Me(t,e,zt,Qt)}},function(t,n){Et.type.order[t+e+"-pre"]=n,t.match(/^html\-/)&&(Et.type.search[t+e]=Et.type.search.html)})}function Bt(t){return function(){var e=[Ft(this[qt.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return qt.ext.internal[t].apply(this,e)}}var Et,Jt,Vt,Xt,qt=function(e){this.$=function(t,e){return this.api(!0).$(t,e)},this._=function(t,e){return this.api(!0).rows(t,e).data()},this.api=function(t){return new Jt(t?Ft(this[Et.iApiIndex]):this)},this.fnAddData=function(e,n){var r=this.api(!0),o=t.isArray(e)&&(t.isArray(e[0])||t.isPlainObject(e[0]))?r.rows.add(e):r.row.add(e);return(n===a||n)&&r.draw(),o.flatten().toArray()},this.fnAdjustColumnSizing=function(t){var e=this.api(!0).columns.adjust(),n=e.settings()[0],r=n.oScroll;t===a||t?e.draw(!1):""===r.sX&&""===r.sY||ht(n)},this.fnClearTable=function(t){var e=this.api(!0).clear();(t===a||t)&&e.draw()},this.fnClose=function(t){this.api(!0).row(t).child.hide()},this.fnDeleteRow=function(t,e,n){var r=this.api(!0),o=r.rows(t),i=o.settings()[0],s=i.aoData[o[0][0]];return o.remove(),e&&e.call(this,i,s),(n===a||n)&&r.draw(),s},this.fnDestroy=function(t){this.api(!0).destroy(t)},this.fnDraw=function(t){this.api(!0).draw(t)},this.fnFilter=function(t,e,n,r,o,i){var s=this.api(!0);null===e||e===a?s.search(t,n,r,i):s.column(e).search(t,n,r,i),s.draw()},this.fnGetData=function(t,e){var n=this.api(!0);if(t!==a){var r=t.nodeName?t.nodeName.toLowerCase():"";return e!==a||"td"==r||"th"==r?n.cell(t,e).data():n.row(t).data()||null}return n.data().toArray()},this.fnGetNodes=function(t){var e=this.api(!0);return t!==a?e.row(t).node():e.rows().nodes().flatten().toArray()},this.fnGetPosition=function(t){var e=this.api(!0),n=t.nodeName.toUpperCase();if("TR"==n)return e.row(t).index();if("TD"==n||"TH"==n){var a=e.cell(t).index();return[a.row,a.columnVisible,a.column]}return null},this.fnIsOpen=function(t){return this.api(!0).row(t).child.isShown()},this.fnOpen=function(t,e,n){return this.api(!0).row(t).child(e,n).show().child()[0]},this.fnPageChange=function(t,e){var n=this.api(!0).page(t);(e===a||e)&&n.draw(!1)},this.fnSetColumnVis=function(t,e,n){var r=this.api(!0).column(t).visible(e);(n===a||n)&&r.columns.adjust().draw()},this.fnSettings=function(){return Ft(this[Et.iApiIndex])},this.fnSort=function(t){this.api(!0).order(t).draw()},this.fnSortListener=function(t,e,n){this.api(!0).order.listener(t,e,n)},this.fnUpdate=function(t,e,n,r,o){var i=this.api(!0);return n===a||null===n?i.row(e).data(t):i.cell(e,n).data(t),(o===a||o)&&i.columns.adjust(),(r===a||r)&&i.draw(),0},this.fnVersionCheck=Et.fnVersionCheck;var n=this,r=e===a,c=this.length;r&&(e={}),this.oApi=this.internal=Et.internal;for(var h in qt.ext.internal)h&&(this[h]=Bt(h));return this.each(function(){var h,p={},g=c>1?Rt(p,e,!0):e,b=0,v=this.getAttribute("id"),S=!1,_=qt.defaults,w=t(this);if("table"==this.nodeName.toLowerCase()){s(_),l(_.column),o(_,_,!0),o(_.column,_.column,!0),o(_,t.extend(g,w.data()));var T=qt.settings;for(b=0,h=T.length;b<h;b++){var x=T[b];if(x.nTable==this||x.nTHead.parentNode==this||x.nTFoot&&x.nTFoot.parentNode==this){var I=g.bRetrieve!==a?g.bRetrieve:_.bRetrieve,A=g.bDestroy!==a?g.bDestroy:_.bDestroy;if(r||I)return x.oInstance;if(A){x.oInstance.fnDestroy();break}return void Lt(x,0,"Cannot reinitialise WFDataTable",3)}if(x.sTableId==this.id){T.splice(b,1);break}}null!==v&&""!==v||(v="WFDataTables_Table_"+qt.ext._unique++,this.id=v);var F=t.extend(!0,{},qt.models.oSettings,{sDestroyWidth:w[0].style.width,sInstance:v,sTableId:v});F.nTable=this,F.oApi=n.internal,F.oInit=g,T.push(F),F.oInstance=1===n.length?n:w.wfDataTable(),s(g),g.oLanguage&&i(g.oLanguage),g.aLengthMenu&&!g.iDisplayLength&&(g.iDisplayLength=t.isArray(g.aLengthMenu[0])?g.aLengthMenu[0][0]:g.aLengthMenu[0]),g=Rt(t.extend(!0,{},_),g),Pt(F.oFeatures,g,["bPaginate","bLengthChange","bFilter","bSort","bSortMulti","bInfo","bProcessing","bAutoWidth","bSortClasses","bServerSide","bDeferRender"]),Pt(F,g,["asStripeClasses","ajax","fnServerData","fnFormatNumber","sServerMethod","aaSorting","aaSortingFixed","aLengthMenu","sPaginationType","sAjaxSource","sAjaxDataProp","iStateDuration","sDom","bSortCellsTop","iTabIndex","fnStateLoadCallback","fnStateSaveCallback","renderer","searchDelay","rowId",["iCookieDuration","iStateDuration"],["oSearch","oPreviousSearch"],["aoSearchCols","aoPreSearchCols"],["iDisplayLength","_iDisplayLength"],["bJQueryUI","bJUI"]]),Pt(F.oScroll,g,[["sScrollX","sX"],["sScrollXInner","sXInner"],["sScrollY","sY"],["bScrollCollapse","bCollapse"]]),Pt(F.oLanguage,g,"fnInfoCallback"),Ht(F,"aoDrawCallback",g.fnDrawCallback,"user"),Ht(F,"aoServerParams",g.fnServerParams,"user"),Ht(F,"aoStateSaveParams",g.fnStateSaveParams,"user"),Ht(F,"aoStateLoadParams",g.fnStateLoadParams,"user"),Ht(F,"aoStateLoaded",g.fnStateLoaded,"user"),Ht(F,"aoRowCallback",g.fnRowCallback,"user"),Ht(F,"aoRowCreatedCallback",g.fnCreatedRow,"user"),Ht(F,"aoHeaderCallback",g.fnHeaderCallback,"user"),Ht(F,"aoFooterCallback",g.fnFooterCallback,"user"),Ht(F,"aoInitComplete",g.fnInitComplete,"user"),Ht(F,"aoPreDrawCallback",g.fnPreDrawCallback,"user"),F.rowIdFn=C(g.rowId),u(F);var L=F.oClasses;if(g.bJQueryUI?(t.extend(L,qt.ext.oJUIClasses,g.oClasses),g.sDom===_.sDom&&"lfrtip"===_.sDom&&(F.sDom='<"H"lfr>t<"F"ip>'),F.renderer?t.isPlainObject(F.renderer)&&!F.renderer.header&&(F.renderer.header="jqueryui"):F.renderer="jqueryui"):t.extend(L,qt.ext.classes,g.oClasses),w.addClass(L.sTable),F.iInitDisplayStart===a&&(F.iInitDisplayStart=g.iDisplayStart,F._iDisplayStart=g.iDisplayStart),null!==g.iDeferLoading){F.bDeferLoading=!0;var P=t.isArray(g.iDeferLoading);F._iRecordsDisplay=P?g.iDeferLoading[0]:g.iDeferLoading,F._iRecordsTotal=P?g.iDeferLoading[1]:g.iDeferLoading}var R=F.oLanguage;t.extend(!0,R,g.oLanguage),R.sUrl&&(t.ajax({dataType:"json",url:R.sUrl,success:function(e){i(e),o(_.oLanguage,e),t.extend(!0,R,e),rt(F)},error:function(){rt(F)}}),S=!0),null===g.asStripeClasses&&(F.asStripeClasses=[L.sStripeOdd,L.sStripeEven]);var j=F.asStripeClasses,H=w.children("tbody").find("tr").eq(0);-1!==t.inArray(!0,t.map(j,function(t,e){return H.hasClass(t)}))&&(t("tbody tr",this).removeClass(j.join(" ")),F.asDestroyStripes=j.slice());var N,W=[],O=this.getElementsByTagName("thead");if(0!==O.length&&(M(F.aoHeader,O[0]),W=U(F)),null===g.aoColumns)for(N=[],b=0,h=W.length;b<h;b++)N.push(null);else N=g.aoColumns;for(b=0,h=N.length;b<h;b++)f(F,W?W[b]:null);if(m(F,g.aoColumnDefs,N,function(t,e){d(F,t,e)}),H.length){var k=function(t,e){return null!==t.getAttribute("data-"+e)?e:null};t(H[0]).children("th, td").each(function(t,e){var n=F.aoColumns[t];if(n.mData===t){var r=k(e,"sort")||k(e,"order"),o=k(e,"filter")||k(e,"search");null===r&&null===o||(n.mData={_:t+".display",sort:null!==r?t+".@data-"+r:a,type:null!==r?t+".@data-"+r:a,filter:null!==o?t+".@data-"+o:a},d(F,t))}})}var B=F.oFeatures,E=function(){if(g.aaSorting===a){var e=F.aaSorting;for(b=0,h=e.length;b<h;b++)e[b][1]=F.aoColumns[b].asSorting[0]}Ct(F),B.bSort&&Ht(F,"aoDrawCallback",function(){if(F.bSorted){var e=Dt(F),n={};t.each(e,function(t,e){n[e.src]=e.dir}),Nt(F,null,"order",[F,e,n]),_t(F)}}),Ht(F,"aoDrawCallback",function(){(F.bSorted||"ssp"===kt(F)||B.bDeferRender)&&Ct(F)},"sc");var n=w.children("caption").each(function(){this._captionSide=t(this).css("caption-side")}),r=w.children("thead");0===r.length&&(r=t("<thead/>").appendTo(w)),F.nTHead=r[0];var o=w.children("tbody");0===o.length&&(o=t("<tbody/>").appendTo(w)),F.nTBody=o[0];var i=w.children("tfoot");if(0===i.length&&n.length>0&&(""!==F.oScroll.sX||""!==F.oScroll.sY)&&(i=t("<tfoot/>").appendTo(w)),0===i.length||0===i.children().length?w.addClass(L.sNoFooter):i.length>0&&(F.nTFoot=i[0],M(F.aoFooter,F.nTFoot)),g.aaData)for(b=0;b<g.aaData.length;b++)D(F,g.aaData[b]);else(F.bDeferLoading||"dom"==kt(F))&&y(F,t(F.nTBody).children("tr"));F.aiDisplay=F.aiDisplayMaster.slice(),F.bInitialised=!0,!1===S&&rt(F)};g.bStateSave?(B.bStateSave=!0,Ht(F,"aoDrawCallback",It,"state_save"),At(F,g,E)):E()}else Lt(null,0,"Non-table node initialisation ("+this.nodeName+")",2)}),n=null,this},Gt={},$t=/[\r\n]/g,zt=/<.*?>/g,Yt=/^\d{2,4}[\.\/\-]\d{1,2}[\.\/\-]\d{1,2}([T ]{1}\d{1,2}[:\.]\d{2}([\.:]\d{2})?)?$/,Zt=new RegExp("(\\"+["/",".","*","+","?","|","(",")","[","]","{","}","\\","$","^","-"].join("|\\")+")","g"),Qt=/[',$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfk]/gi,Kt=function(t){return!t||!0===t||"-"===t},te=function(t){var e=parseInt(t,10);return!isNaN(e)&&isFinite(t)?e:null},ee=function(t,e){return Gt[e]||(Gt[e]=new RegExp(pe(e),"g")),"string"==typeof t&&"."!==e?t.replace(/\./g,"").replace(Gt[e],"."):t},ne=function(t,e,n){var a="string"==typeof t;return!!Kt(t)||(e&&a&&(t=ee(t,e)),n&&a&&(t=t.replace(Qt,"")),!isNaN(parseFloat(t))&&isFinite(t))},ae=function(t){return Kt(t)||"string"==typeof t},re=function(t,e,n){return!!Kt(t)||(ae(t)?!!ne(ue(t),e,n)||null:null)},oe=function(t,e,n){var r=[],o=0,i=t.length;if(n!==a)for(;o<i;o++)t[o]&&t[o][e]&&r.push(t[o][e][n]);else for(;o<i;o++)t[o]&&r.push(t[o][e]);return r},ie=function(t,e,n,r){var o=[],i=0,s=e.length;if(r!==a)for(;i<s;i++)t[e[i]][n]&&o.push(t[e[i]][n][r]);else for(;i<s;i++)o.push(t[e[i]][n]);return o},se=function(t,e){var n,r=[];e===a?(e=0,n=t):(n=e,e=t);for(var o=e;o<n;o++)r.push(o);return r},le=function(t){for(var e=[],n=0,a=t.length;n<a;n++)t[n]&&e.push(t[n]);return e},ue=function(t){return t.replace(zt,"")},ce=function(t){var e,n,a,r=[],o=t.length,i=0;t:for(n=0;n<o;n++){for(e=t[n],a=0;a<i;a++)if(r[a]===e)continue t;r.push(e),i++}return r};qt.util={throttle:function(t,e){var n,r,o=e!==a?e:200;return function(){var e=this,i=+new Date,s=arguments;n&&i<n+o?(clearTimeout(r),r=setTimeout(function(){n=a,t.apply(e,s)},o)):(n=i,t.apply(e,s))}},escapeRegex:function(t){return t.replace(Zt,"\\$1")}};var fe=function(t,e,n){t[e]!==a&&(t[n]=t[e])},de=/\[.*?\]$/,he=/\(\)$/,pe=qt.util.escapeRegex,ge=t("<div>")[0],be=ge.textContent!==a,ve=/<.*?>/g,Se=qt.util.throttle,me=[],De=Array.prototype,ye=function(e){var n,a,r=qt.settings,o=t.map(r,function(t,e){return t.nTable});return e?e.nTable&&e.oApi?[e]:e.nodeName&&"table"===e.nodeName.toLowerCase()?(n=t.inArray(e,o),-1!==n?[r[n]]:null):e&&"function"==typeof e.settings?e.settings().toArray():("string"==typeof e?a=t(e):e instanceof t&&(a=e),a?a.map(function(e){return n=t.inArray(this,o),-1!==n?r[n]:null}).toArray():void 0):[]};Jt=function(e,n){if(!(this instanceof Jt))return new Jt(e,n);var a=[],r=function(t){var e=ye(t);e&&(a=a.concat(e))};if(t.isArray(e))for(var o=0,i=e.length;o<i;o++)r(e[o]);else r(e);this.context=ce(a),n&&t.merge(this,n),this.selector={rows:null,cols:null,opts:null},Jt.extend(this,this,me)},qt.Api=Jt,t.extend(Jt.prototype,{any:function(){return 0!==this.count()},concat:De.concat,context:[],count:function(){return this.flatten().length},each:function(t){for(var e=0,n=this.length;e<n;e++)t.call(this,this[e],e,this);return this},eq:function(t){var e=this.context;return e.length>t?new Jt(e[t],this[t]):null},filter:function(t){var e=[];if(De.filter)e=De.filter.call(this,t,this);else for(var n=0,a=this.length;n<a;n++)t.call(this,this[n],n,this)&&e.push(this[n]);return new Jt(this.context,e)},flatten:function(){var t=[];return new Jt(this.context,t.concat.apply(t,this.toArray()))},join:De.join,indexOf:De.indexOf||function(t,e){for(var n=e||0,a=this.length;n<a;n++)if(this[n]===t)return n;return-1},iterator:function(t,e,n,r){var o,i,s,l,u,c,f,d,h=[],p=this.context,g=this.selector;for("string"==typeof t&&(r=n,n=e,e=t,t=!1),i=0,s=p.length;i<s;i++){var b=new Jt(p[i]);if("table"===e)(o=n.call(b,p[i],i))!==a&&h.push(o);else if("columns"===e||"rows"===e)(o=n.call(b,p[i],this[i],i))!==a&&h.push(o);else if("column"===e||"column-rows"===e||"row"===e||"cell"===e)for(f=this[i],"column-rows"===e&&(c=Ie(p[i],g.opts)),l=0,u=f.length;l<u;l++)d=f[l],(o="cell"===e?n.call(b,p[i],d.row,d.column,i,l):n.call(b,p[i],d,i,l,c))!==a&&h.push(o)}if(h.length||r){var v=new Jt(p,t?h.concat.apply([],h):h),S=v.selector;return S.rows=g.rows,S.cols=g.cols,S.opts=g.opts,v}return this},lastIndexOf:De.lastIndexOf||function(t,e){return this.indexOf.apply(this.toArray.reverse(),arguments)},length:0,map:function(t){var e=[];if(De.map)e=De.map.call(this,t,this);else for(var n=0,a=this.length;n<a;n++)e.push(t.call(this,this[n],n));return new Jt(this.context,e)},pluck:function(t){return this.map(function(e){return e[t]})},pop:De.pop,push:De.push,reduce:De.reduce||function(t,e){return c(this,t,e,0,this.length,1)},reduceRight:De.reduceRight||function(t,e){return c(this,t,e,this.length-1,-1,-1)},reverse:De.reverse,selector:null,shift:De.shift,sort:De.sort,splice:De.splice,toArray:function(){return De.slice.call(this)},to$:function(){return t(this)},toJQuery:function(){return t(this)},unique:function(){return new Jt(this.context,ce(this))},unshift:De.unshift}),Jt.extend=function(e,n,a){if(a.length&&n&&(n instanceof Jt||n.__dt_wrapper)){var r,o,i;for(r=0,o=a.length;r<o;r++)n[(i=a[r]).name]="function"==typeof i.val?function(t,e,n){return function(){var a=e.apply(t,arguments);return Jt.extend(a,a,n.methodExt),a}}(e,i.val,i):t.isPlainObject(i.val)?{}:i.val,n[i.name].__dt_wrapper=!0,Jt.extend(e,n[i.name],i.propExt)}},Jt.register=Vt=function(e,n){if(t.isArray(e))for(var a=0,r=e.length;a<r;a++)Jt.register(e[a],n);else{var o,i,s,l,u=e.split("."),c=me;for(o=0,i=u.length;o<i;o++){var f=function(t,e){for(var n=0,a=t.length;n<a;n++)if(t[n].name===e)return t[n];return null}(c,s=(l=-1!==u[o].indexOf("()"))?u[o].replace("()",""):u[o]);f||(f={name:s,val:{},methodExt:[],propExt:[]},c.push(f)),o===i-1?f.val=n:c=l?f.methodExt:f.propExt}}},Jt.registerPlural=Xt=function(e,n,r){Jt.register(e,r),Jt.register(n,function(){var e=r.apply(this,arguments);return e===this?this:e instanceof Jt?e.length?t.isArray(e[0])?new Jt(e.context,e[0]):e[0]:a:e})};var _e=function(e,n){if("number"==typeof e)return[n[e]];var a=t.map(n,function(t,e){return t.nTable});return t(a).filter(e).map(function(e){var r=t.inArray(this,a);return n[r]}).toArray()};Vt("tables()",function(t){return t?new Jt(_e(t,this.context)):this}),Vt("table()",function(t){var e=this.tables(t),n=e.context;return n.length?new Jt(n[0]):e}),Xt("tables().nodes()","table().node()",function(){return this.iterator("table",function(t){return t.nTable},1)}),Xt("tables().body()","table().body()",function(){return this.iterator("table",function(t){return t.nTBody},1)}),Xt("tables().header()","table().header()",function(){return this.iterator("table",function(t){return t.nTHead},1)}),Xt("tables().footer()","table().footer()",function(){return this.iterator("table",function(t){return t.nTFoot},1)}),Xt("tables().containers()","table().container()",function(){return this.iterator("table",function(t){return t.nTableWrapper},1)}),Vt("draw()",function(t){return this.iterator("table",function(e){"page"===t?W(e):("string"==typeof t&&(t="full-hold"!==t),O(e,!1===t))})}),Vt("page()",function(t){return t===a?this.page.info().page:this.iterator("table",function(e){ut(e,t)})}),Vt("page.info()",function(t){if(0===this.context.length)return a;var e=this.context[0],n=e._iDisplayStart,r=e.oFeatures.bPaginate?e._iDisplayLength:-1,o=e.fnRecordsDisplay(),i=-1===r;return{page:i?0:Math.floor(n/r),pages:i?1:Math.ceil(o/r),start:n,end:e.fnDisplayEnd(),length:r,recordsTotal:e.fnRecordsTotal(),recordsDisplay:o,serverSide:"ssp"===kt(e)}}),Vt("page.len()",function(t){return t===a?0!==this.context.length?this.context[0]._iDisplayLength:a:this.iterator("table",function(e){it(e,t)})});var we=function(t,e,n){if(n){var a=new Jt(t);a.one("draw",function(){n(a.ajax.json())})}if("ssp"==kt(t))O(t,e);else{ft(t,!0);var r=t.jqXHR;r&&4!==r.readyState&&r.abort(),B(t,[],function(n){A(t);for(var a=X(t,n),r=0,o=a.length;r<o;r++)D(t,a[r]);O(t,e),ft(t,!1)})}};Vt("ajax.json()",function(){var t=this.context;if(t.length>0)return t[0].json}),Vt("ajax.params()",function(){var t=this.context;if(t.length>0)return t[0].oAjaxData}),Vt("ajax.reload()",function(t,e){return this.iterator("table",function(n){we(n,!1===e,t)})}),Vt("ajax.url()",function(e){var n=this.context;return e===a?0===n.length?a:(n=n[0],n.ajax?t.isPlainObject(n.ajax)?n.ajax.url:n.ajax:n.sAjaxSource):this.iterator("table",function(n){t.isPlainObject(n.ajax)?n.ajax.url=e:n.ajax=e})}),Vt("ajax.url().load()",function(t,e){return this.iterator("table",function(n){we(n,!1===e,t)})});var Te=function(e,n,r,o,i){var s,l,u,c,f,d,h=[],p=typeof n;for(n&&"string"!==p&&"function"!==p&&n.length!==a||(n=[n]),u=0,c=n.length;u<c;u++)for(f=0,d=(l=n[u]&&n[u].split&&!n[u].match(/[\[\(:]/)?n[u].split(","):[n[u]]).length;f<d;f++)(s=r("string"==typeof l[f]?t.trim(l[f]):l[f]))&&s.length&&(h=h.concat(s));var g=Et.selector[e];if(g.length)for(u=0,c=g.length;u<c;u++)h=g[u](o,i,h);return ce(h)},Ce=function(e){return e||(e={}),e.filter&&e.search===a&&(e.search=e.filter),t.extend({search:"none",order:"current",page:"all"},e)},xe=function(t){for(var e=0,n=t.length;e<n;e++)if(t[e].length>0)return t[0]=t[e],t[0].length=1,t.length=1,t.context=[t.context[e]],t;return t.length=0,t},Ie=function(e,n){var a,r,o,i=[],s=e.aiDisplay,l=e.aiDisplayMaster,u=n.search,c=n.order,f=n.page;if("ssp"==kt(e))return"removed"===u?[]:se(0,l.length);if("current"==f)for(a=e._iDisplayStart,r=e.fnDisplayEnd();a<r;a++)i.push(s[a]);else if("current"==c||"applied"==c)i="none"==u?l.slice():"applied"==u?s.slice():t.map(l,function(e,n){return-1===t.inArray(e,s)?e:null});else if("index"==c||"original"==c)for(a=0,r=e.aoData.length;a<r;a++)"none"==u?i.push(a):(-1===(o=t.inArray(a,s))&&"removed"==u||o>=0&&"applied"==u)&&i.push(a);return i},Ae=function(e,n,r){var o;return Te("row",n,function(n){var i=te(n);if(null!==i&&!r)return[i];if(o||(o=Ie(e,r)),null!==i&&-1!==t.inArray(i,o))return[i];if(null===n||n===a||""===n)return o;if("function"==typeof n)return t.map(o,function(t){var a=e.aoData[t];return n(t,a._aData,a.nTr)?t:null});var s=le(ie(e.aoData,o,"nTr"));if(n.nodeName){if(n._DT_RowIndex!==a)return[n._DT_RowIndex];if(n._DT_CellIndex)return[n._DT_CellIndex.row];var l=t(n).closest("*[data-dt-row]");return l.length?[l.data("dt-row")]:[]}if("string"==typeof n&&"#"===n.charAt(0)){var u=e.aIds[n.replace(/^#/,"")];if(u!==a)return[u.idx]}return t(s).filter(n).map(function(){return this._DT_RowIndex}).toArray()},e,r)};Vt("rows()",function(e,n){e===a?e="":t.isPlainObject(e)&&(n=e,e=""),n=Ce(n);var r=this.iterator("table",function(t){return Ae(t,e,n)},1);return r.selector.rows=e,r.selector.opts=n,r}),Vt("rows().nodes()",function(){return this.iterator("row",function(t,e){return t.aoData[e].nTr||a},1)}),Vt("rows().data()",function(){return this.iterator(!0,"rows",function(t,e){return ie(t.aoData,e,"_aData")},1)}),Xt("rows().cache()","row().cache()",function(t){return this.iterator("row",function(e,n){var a=e.aoData[n];return"search"===t?a._aFilterData:a._aSortData},1)}),Xt("rows().invalidate()","row().invalidate()",function(t){return this.iterator("row",function(e,n){L(e,n,t)})}),Xt("rows().indexes()","row().index()",function(){return this.iterator("row",function(t,e){return e},1)}),Xt("rows().ids()","row().id()",function(t){for(var e=[],n=this.context,a=0,r=n.length;a<r;a++)for(var o=0,i=this[a].length;o<i;o++){var s=n[a].rowIdFn(n[a].aoData[this[a][o]]._aData);e.push((!0===t?"#":"")+s)}return new Jt(n,e)}),Xt("rows().remove()","row().remove()",function(){var t=this;return this.iterator("row",function(e,n,r){var o,i,s,l,u,c,f=e.aoData,d=f[n];for(f.splice(n,1),o=0,i=f.length;o<i;o++)if(u=f[o],c=u.anCells,null!==u.nTr&&(u.nTr._DT_RowIndex=o),null!==c)for(s=0,l=c.length;s<l;s++)c[s]._DT_CellIndex.row=o;F(e.aiDisplayMaster,n),F(e.aiDisplay,n),F(t[r],n,!1),Wt(e);var h=e.rowIdFn(d._aData);h!==a&&delete e.aIds[h]}),this.iterator("table",function(t){for(var e=0,n=t.aoData.length;e<n;e++)t.aoData[e].idx=e}),this}),Vt("rows.add()",function(e){var n=this.iterator("table",function(t){var n,a,r,o=[];for(a=0,r=e.length;a<r;a++)(n=e[a]).nodeName&&"TR"===n.nodeName.toUpperCase()?o.push(y(t,n)[0]):o.push(D(t,n));return o},1),a=this.rows(-1);return a.pop(),t.merge(a,n),a}),Vt("row()",function(t,e){return xe(this.rows(t,e))}),Vt("row().data()",function(t){var e=this.context;return t===a?e.length&&this.length?e[0].aoData[this[0]]._aData:a:(e[0].aoData[this[0]]._aData=t,L(e[0],this[0],"data"),this)}),Vt("row().node()",function(){var t=this.context;return t.length&&this.length?t[0].aoData[this[0]].nTr||null:null}),Vt("row.add()",function(e){e instanceof t&&e.length&&(e=e[0]);var n=this.iterator("table",function(t){return e.nodeName&&"TR"===e.nodeName.toUpperCase()?y(t,e)[0]:D(t,e)});return this.row(n[0])});var Fe=function(e,n,a,r){var o=[],i=function(n,a){if(t.isArray(n)||n instanceof t)for(var r=0,s=n.length;r<s;r++)i(n[r],a);else if(n.nodeName&&"tr"===n.nodeName.toLowerCase())o.push(n);else{var l=t("<tr><td/></tr>").addClass(a);t("td",l).addClass(a).html(n)[0].colSpan=b(e),o.push(l[0])}};i(a,r),n._details&&n._details.detach(),n._details=t(o),n._detailsShow&&n._details.insertAfter(n.nTr)},Le=function(t,e){var n=t.context;if(n.length){var r=n[0].aoData[e!==a?e:t[0]];r&&r._details&&(r._details.remove(),r._detailsShow=a,r._details=a)}},Pe=function(t,e){var n=t.context;if(n.length&&t.length){var a=n[0].aoData[t[0]];a._details&&(a._detailsShow=e,e?a._details.insertAfter(a.nTr):a._details.detach(),Re(n[0]))}},Re=function(t){var e=new Jt(t),n=t.aoData;e.off("draw.dt.DT_details column-visibility.dt.DT_details destroy.dt.DT_details"),oe(n,"_details").length>0&&(e.on("draw.dt.DT_details",function(a,r){t===r&&e.rows({page:"current"}).eq(0).each(function(t){var e=n[t];e._detailsShow&&e._details.insertAfter(e.nTr)})}),e.on("column-visibility.dt.DT_details",function(e,a,r,o){if(t===a)for(var i,s=b(a),l=0,u=n.length;l<u;l++)(i=n[l])._details&&i._details.children("td[colspan]").attr("colspan",s)}),e.on("destroy.dt.DT_details",function(a,r){if(t===r)for(var o=0,i=n.length;o<i;o++)n[o]._details&&Le(e,o)}))};Vt("row().child()",function(t,e){var n=this.context;return t===a?n.length&&this.length?n[0].aoData[this[0]]._details:a:(!0===t?this.child.show():!1===t?Le(this):n.length&&this.length&&Fe(n[0],n[0].aoData[this[0]],t,e),this)}),Vt(["row().child.show()","row().child().show()"],function(t){return Pe(this,!0),this}),Vt(["row().child.hide()","row().child().hide()"],function(){return Pe(this,!1),this}),Vt(["row().child.remove()","row().child().remove()"],function(){return Le(this),this}),Vt("row().child.isShown()",function(){var t=this.context;return!(!t.length||!this.length)&&(t[0].aoData[this[0]]._detailsShow||!1)});var je=/^([^:]+):(name|visIdx|visible)$/,He=function(t,e,n,a,r){for(var o=[],i=0,s=r.length;i<s;i++)o.push(_(t,r[i],e));return o},Ne=function(e,n,a){var r=e.aoColumns,o=oe(r,"sName"),i=oe(r,"nTh");return Te("column",n,function(n){var s=te(n);if(""===n)return se(r.length);if(null!==s)return[s>=0?s:r.length+s];if("function"==typeof n){var l=Ie(e,a);return t.map(r,function(t,a){return n(a,He(e,a,0,0,l),i[a])?a:null})}var u="string"==typeof n?n.match(je):"";if(u)switch(u[2]){case"visIdx":case"visible":var c=parseInt(u[1],10);if(c<0){var f=t.map(r,function(t,e){return t.bVisible?e:null});return[f[f.length+c]]}return[p(e,c)];case"name":return t.map(o,function(t,e){return t===u[1]?e:null});default:return[]}if(n.nodeName&&n._DT_CellIndex)return[n._DT_CellIndex.column];var d=t(i).filter(n).map(function(){return t.inArray(this,i)}).toArray();if(d.length||!n.nodeName)return d;var h=t(n).closest("*[data-dt-column]");return h.length?[h.data("dt-column")]:[]},e,a)},We=function(e,n,r){var o,i,s,l,u=e.aoColumns,c=u[n],f=e.aoData;if(r===a)return c.bVisible;if(c.bVisible!==r){if(r){var d=t.inArray(!0,oe(u,"bVisible"),n+1);for(i=0,s=f.length;i<s;i++)l=f[i].nTr,o=f[i].anCells,l&&l.insertBefore(o[n],o[d]||null)}else t(oe(e.aoData,"anCells",n)).detach();c.bVisible=r,N(e,e.aoHeader),N(e,e.aoFooter),It(e)}};Vt("columns()",function(e,n){e===a?e="":t.isPlainObject(e)&&(n=e,e=""),n=Ce(n);var r=this.iterator("table",function(t){return Ne(t,e,n)},1);return r.selector.cols=e,r.selector.opts=n,r}),Xt("columns().header()","column().header()",function(t,e){return this.iterator("column",function(t,e){return t.aoColumns[e].nTh},1)}),Xt("columns().footer()","column().footer()",function(t,e){return this.iterator("column",function(t,e){return t.aoColumns[e].nTf},1)}),Xt("columns().data()","column().data()",function(){return this.iterator("column-rows",He,1)}),Xt("columns().dataSrc()","column().dataSrc()",function(){return this.iterator("column",function(t,e){return t.aoColumns[e].mData},1)}),Xt("columns().cache()","column().cache()",function(t){return this.iterator("column-rows",function(e,n,a,r,o){return ie(e.aoData,o,"search"===t?"_aFilterData":"_aSortData",n)},1)}),Xt("columns().nodes()","column().nodes()",function(){return this.iterator("column-rows",function(t,e,n,a,r){return ie(t.aoData,r,"anCells",e)},1)}),Xt("columns().visible()","column().visible()",function(t,e){var n=this.iterator("column",function(e,n){if(t===a)return e.aoColumns[n].bVisible;We(e,n,t)});return t!==a&&(this.iterator("column",function(n,a){Nt(n,null,"column-visibility",[n,a,t,e])}),(e===a||e)&&this.columns.adjust()),n}),Xt("columns().indexes()","column().index()",function(t){return this.iterator("column",function(e,n){return"visible"===t?g(e,n):n},1)}),Vt("columns.adjust()",function(){return this.iterator("table",function(t){h(t)},1)}),Vt("column.index()",function(t,e){if(0!==this.context.length){var n=this.context[0];if("fromVisible"===t||"toData"===t)return p(n,e);if("fromData"===t||"toVisible"===t)return g(n,e)}}),Vt("column()",function(t,e){return xe(this.columns(t,e))});var Oe=function(e,n,r){var o,i,s,l,u,c,f,d=e.aoData,h=Ie(e,r),p=le(ie(d,h,"anCells")),g=t([].concat.apply([],p)),b=e.aoColumns.length;return Te("cell",n,function(n){var r="function"==typeof n;if(null===n||n===a||r){for(i=[],s=0,l=h.length;s<l;s++)for(o=h[s],u=0;u<b;u++)c={row:o,column:u},r?(f=d[o],n(c,_(e,o,u),f.anCells?f.anCells[u]:null)&&i.push(c)):i.push(c);return i}if(t.isPlainObject(n))return[n];var p=g.filter(n).map(function(t,e){return{row:e._DT_CellIndex.row,column:e._DT_CellIndex.column}}).toArray();return p.length||!n.nodeName?p:(f=t(n).closest("*[data-dt-row]"),f.length?[{row:f.data("dt-row"),column:f.data("dt-column")}]:[])},e,r)};Vt("cells()",function(e,n,r){if(t.isPlainObject(e)&&(e.row===a?(r=e,e=null):(r=n,n=null)),t.isPlainObject(n)&&(r=n,n=null),null===n||n===a)return this.iterator("table",function(t){return Oe(t,e,Ce(r))});var o,i,s,l,u,c=this.columns(n,r),f=this.rows(e,r),d=this.iterator("table",function(t,e){for(o=[],i=0,s=f[e].length;i<s;i++)for(l=0,u=c[e].length;l<u;l++)o.push({row:f[e][i],column:c[e][l]});return o},1);return t.extend(d.selector,{cols:n,rows:e,opts:r}),d}),Xt("cells().nodes()","cell().node()",function(){return this.iterator("cell",function(t,e,n){var r=t.aoData[e];return r&&r.anCells?r.anCells[n]:a},1)}),Vt("cells().data()",function(){return this.iterator("cell",function(t,e,n){return _(t,e,n)},1)}),Xt("cells().cache()","cell().cache()",function(t){return t="search"===t?"_aFilterData":"_aSortData",this.iterator("cell",function(e,n,a){return e.aoData[n][t][a]},1)}),Xt("cells().render()","cell().render()",function(t){return this.iterator("cell",function(e,n,a){return _(e,n,a,t)},1)}),Xt("cells().indexes()","cell().index()",function(){return this.iterator("cell",function(t,e,n){return{row:e,column:n,columnVisible:g(t,n)}},1)}),Xt("cells().invalidate()","cell().invalidate()",function(t){return this.iterator("cell",function(e,n,a){L(e,n,t,a)})}),Vt("cell()",function(t,e,n){return xe(this.cells(t,e,n))}),Vt("cell().data()",function(t){var e=this.context,n=this[0];return t===a?e.length&&n.length?_(e[0],n[0].row,n[0].column):a:(w(e[0],n[0].row,n[0].column,t),L(e[0],n[0].row,"data",n[0].column),this)}),Vt("order()",function(e,n){var r=this.context;return e===a?0!==r.length?r[0].aaSorting:a:("number"==typeof e?e=[[e,n]]:e.length&&!t.isArray(e[0])&&(e=Array.prototype.slice.call(arguments)),this.iterator("table",function(t){t.aaSorting=e.slice()}))}),Vt("order.listener()",function(t,e,n){return this.iterator("table",function(a){Tt(a,t,e,n)})}),Vt("order.fixed()",function(e){if(!e){var n=this.context,r=n.length?n[0].aaSortingFixed:a;return t.isArray(r)?{pre:r}:r}return this.iterator("table",function(n){n.aaSortingFixed=t.extend(!0,{},e)})}),Vt(["columns().order()","column().order()"],function(e){var n=this;return this.iterator("table",function(a,r){var o=[];t.each(n[r],function(t,n){o.push([n,e])}),a.aaSorting=o})}),Vt("search()",function(e,n,r,o){var i=this.context;return e===a?0!==i.length?i[0].oPreviousSearch.sSearch:a:this.iterator("table",function(a){a.oFeatures.bFilter&&G(a,t.extend({},a.oPreviousSearch,{sSearch:e+"",bRegex:null!==n&&n,bSmart:null===r||r,bCaseInsensitive:null===o||o}),1)})}),Xt("columns().search()","column().search()",function(e,n,r,o){return this.iterator("column",function(i,s){var l=i.aoPreSearchCols;if(e===a)return l[s].sSearch;i.oFeatures.bFilter&&(t.extend(l[s],{sSearch:e+"",bRegex:null!==n&&n,bSmart:null===r||r,bCaseInsensitive:null===o||o}),G(i,i.oPreviousSearch,1))})}),Vt("state()",function(){return this.context.length?this.context[0].oSavedState:null}),Vt("state.clear()",function(){return this.iterator("table",function(t){t.fnStateSaveCallback.call(t.oInstance,t,{})})}),Vt("state.loaded()",function(){return this.context.length?this.context[0].oLoadedState:null}),Vt("state.save()",function(){return this.iterator("table",function(t){It(t)})}),qt.versionCheck=qt.fnVersionCheck=function(t){for(var e,n,a=qt.version.split("."),r=t.split("."),o=0,i=r.length;o<i;o++)if(e=parseInt(a[o],10)||0,n=parseInt(r[o],10)||0,e!==n)return e>n;return!0},qt.isWFDataTable=qt.fnIsWFDataTable=function(e){var n=t(e).get(0),a=!1;return e instanceof qt.Api||(t.each(qt.settings,function(e,r){var o=r.nScrollHead?t("table",r.nScrollHead)[0]:null,i=r.nScrollFoot?t("table",r.nScrollFoot)[0]:null;r.nTable!==n&&o!==n&&i!==n||(a=!0)}),a)},qt.tables=qt.fnTables=function(e){var n=!1;t.isPlainObject(e)&&(n=e.api,e=e.visible);var a=t.map(qt.settings,function(n){if(!e||e&&t(n.nTable).is(":visible"))return n.nTable});return n?new Jt(a):a},qt.camelToHungarian=o,Vt("$()",function(e,n){var a=this.rows(n).nodes(),r=t(a);return t([].concat(r.filter(e).toArray(),r.find(e).toArray()))}),t.each(["on","one","off"],function(e,n){Vt(n+"()",function(){var e=Array.prototype.slice.call(arguments);e[0]=t.map(e[0].split(/\s/),function(t){return t.match(/\.dt\b/)?t:t+".dt"}).join(" ");var a=t(this.tables().nodes());return a[n].apply(a,e),this})}),Vt("clear()",function(){return this.iterator("table",function(t){A(t)})}),Vt("settings()",function(){return new Jt(this.context,this.context)}),Vt("init()",function(){var t=this.context;return t.length?t[0].oInit:null}),Vt("data()",function(){return this.iterator("table",function(t){return oe(t.aoData,"_aData")}).flatten()}),Vt("destroy()",function(n){return n=n||!1,this.iterator("table",function(a){var r,o=a.nTableWrapper.parentNode,i=a.oClasses,s=a.nTable,l=a.nTBody,u=a.nTHead,c=a.nTFoot,f=t(s),d=t(l),h=t(a.nTableWrapper),p=t.map(a.aoData,function(t){return t.nTr});a.bDestroying=!0,Nt(a,"aoDestroyCallback","destroy",[a]),n||new Jt(a).columns().visible(!0),h.off(".DT").find(":not(tbody *)").off(".DT"),t(e).off(".DT-"+a.sInstance),s!=u.parentNode&&(f.children("thead").detach(),f.append(u)),c&&s!=c.parentNode&&(f.children("tfoot").detach(),f.append(c)),a.aaSorting=[],a.aaSortingFixed=[],Ct(a),t(p).removeClass(a.asStripeClasses.join(" ")),t("th, td",u).removeClass(i.sSortable+" "+i.sSortableAsc+" "+i.sSortableDesc+" "+i.sSortableNone),a.bJUI&&(t("th span."+i.sSortIcon+", td span."+i.sSortIcon,u).detach(),t("th, td",u).each(function(){var e=t("div."+i.sSortJUIWrapper,this);t(this).append(e.contents()),e.detach()})),d.children().detach(),d.append(p);var g=n?"remove":"detach";f[g](),h[g](),!n&&o&&(o.insertBefore(s,a.nTableReinsertBefore),f.css("width",a.sDestroyWidth).removeClass(i.sTable),(r=a.asDestroyStripes.length)&&d.children().each(function(e){t(this).addClass(a.asDestroyStripes[e%r])}));var b=t.inArray(a,qt.settings);-1!==b&&qt.settings.splice(b,1)})}),t.each(["column","row","cell"],function(t,e){Vt(e+"s().every()",function(t){var n=this.selector.opts,r=this;return this.iterator(e,function(o,i,s,l,u){t.call(r[e](i,"cell"===e?s:n,"cell"===e?n:a),i,s,l,u)})})}),Vt("i18n()",function(e,n,r){var o=this.context[0],i=C(e)(o.oLanguage);return i===a&&(i=n),r!==a&&t.isPlainObject(i)&&(i=i[r]!==a?i[r]:i._),i.replace("%d",r)}),qt.version="1.10.13",qt.settings=[],qt.models={},qt.models.oSearch={bCaseInsensitive:!0,sSearch:"",bRegex:!1,bSmart:!0},qt.models.oRow={nTr:null,anCells:null,_aData:[],_aSortData:null,_aFilterData:null,_sFilterRow:null,_sRowStripe:"",src:null,idx:-1},qt.models.oColumn={idx:null,aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bVisible:null,_sManualType:null,_bAttrSrc:!1,fnCreatedCell:null,fnGetData:null,fnSetData:null,mData:null,mRender:null,nTh:null,nTf:null,sClass:null,sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:"std",sSortingClass:null,sSortingClassJUI:null,sTitle:null,sType:null,sWidth:null,sWidthOrig:null},qt.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:[],ajax:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:null,bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bJQueryUI:!1,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollCollapse:!1,bServerSide:!1,bSort:!0,bSortMulti:!0,bSortCellsTop:!1,bSortClasses:!0,bStateSave:!1,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,fnFormatNumber:function(t){return t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,this.oLanguage.sThousands)},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:null,fnServerParams:null,fnStateLoadCallback:function(t){try{return JSON.parse((-1===t.iStateDuration?sessionStorage:localStorage).getItem("WFDataTables_"+t.sInstance+"_"+location.pathname))}catch(t){}},fnStateLoadParams:null,fnStateLoaded:null,fnStateSaveCallback:function(t,e){try{(-1===t.iStateDuration?sessionStorage:localStorage).setItem("WFDataTables_"+t.sInstance+"_"+location.pathname,JSON.stringify(e))}catch(t){}},fnStateSaveParams:null,iStateDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iTabIndex:0,oClasses:{},oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},oPaginate:{sFirst:"First",sLast:"Last",sNext:"Next",sPrevious:"Previous"},sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sDecimal:"",sThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"Processing...",sSearch:"Search:",sSearchPlaceholder:"",sUrl:"",sZeroRecords:"No matching records found"},oSearch:t.extend({},qt.models.oSearch),sAjaxDataProp:"data",sAjaxSource:null,sDom:"lfrtip",searchDelay:null,sPaginationType:"simple_numbers",sScrollX:"",sScrollXInner:"",sScrollY:"",sServerMethod:"GET",renderer:null,rowId:"DT_RowId"},r(qt.defaults),qt.defaults.column={aDataSort:null,iDataSort:-1,asSorting:["asc","desc"],bSearchable:!0,bSortable:!0,bVisible:!0,fnCreatedCell:null,mData:null,mRender:null,sCellType:"td",sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,sType:null,sWidth:null},r(qt.defaults.column),qt.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,bSort:null,bSortMulti:null,bSortClasses:null,bStateSave:null},oScroll:{bCollapse:null,iBarWidth:0,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},oBrowser:{bScrollOversize:!1,bScrollbarLeft:!1,bBounding:!1,barWidth:0},ajax:null,aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aIds:{},aoColumns:[],aoHeader:[],aoFooter:[],oPreviousSearch:{},aoPreSearchCols:[],aaSorting:null,aaSortingFixed:[],asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],aoFooterCallback:[],aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,searchDelay:null,sPaginationType:"two_button",iStateDuration:0,aoStateSave:[],aoStateLoad:[],oSavedState:null,oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,bAjaxDataGet:!0,jqXHR:null,json:a,oAjaxData:a,fnServerData:null,aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0,bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iRecordsTotal:0,_iRecordsDisplay:0,bJUI:null,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return"ssp"==kt(this)?1*this._iRecordsTotal:this.aiDisplayMaster.length},fnRecordsDisplay:function(){return"ssp"==kt(this)?1*this._iRecordsDisplay:this.aiDisplay.length},fnDisplayEnd:function(){var t=this._iDisplayLength,e=this._iDisplayStart,n=e+t,a=this.aiDisplay.length,r=this.oFeatures,o=r.bPaginate;return r.bServerSide?!1===o||-1===t?e+a:Math.min(e+t,this._iRecordsDisplay):!o||n>a||-1===t?a:n},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null,aLastSort:[],oPlugins:{},rowIdFn:null,rowId:null},qt.ext=Et={buttons:{},classes:{},build:"dt/dt-1.10.13",errMode:"alert",feature:[],search:[],selector:{cell:[],column:[],row:[]},internal:{},legacy:{ajax:null},pager:{},renderer:{pageButton:{},header:{}},order:{},type:{detect:[],search:{},order:{}},_unique:0,fnVersionCheck:qt.fnVersionCheck,iApiIndex:0,oJUIClasses:{},sVersion:qt.version},t.extend(Et,{afnFiltering:Et.search,aTypes:Et.type.detect,ofnSearch:Et.type.search,oSort:Et.type.order,afnSortData:Et.order,aoFeatures:Et.feature,oApi:Et.internal,oStdClasses:Et.classes,oPagination:Et.pager}),t.extend(qt.ext.classes,{sTable:"wf-dataTable",sNoFooter:"no-footer",sPageButton:"paginate_button",sPageButtonActive:"current",sPageButtonDisabled:"disabled",sStripeOdd:"odd",sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"wf-dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sFilterInput:"",sLengthSelect:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sHeaderTH:"",sFooterTH:"",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",sJUIHeader:"",sJUIFooter:""}),function(){var e="ui-state-default",n="css_right ui-icon ui-icon-",a="fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix";t.extend(qt.ext.oJUIClasses,qt.ext.classes,{sPageButton:"fg-button ui-button "+e,sPageButtonActive:"ui-state-disabled",sPageButtonDisabled:"ui-state-disabled",sPaging:"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_",sSortAsc:e+" sorting_asc",sSortDesc:e+" sorting_desc",sSortable:e+" sorting",sSortableAsc:e+" sorting_asc_disabled",sSortableDesc:e+" sorting_desc_disabled",sSortableNone:e+" sorting_disabled",sSortJUIAsc:n+"triangle-1-n",sSortJUIDesc:n+"triangle-1-s",sSortJUI:n+"carat-2-n-s",sSortJUIAscAllowed:n+"carat-1-n",sSortJUIDescAllowed:n+"carat-1-s",sSortJUIWrapper:"WFDataTables_sort_wrapper",sSortIcon:"WFDataTables_sort_icon",sScrollHead:"dataTables_scrollHead "+e,sScrollFoot:"dataTables_scrollFoot "+e,sHeaderTH:e,sFooterTH:e,sJUIHeader:a+" ui-corner-tl ui-corner-tr",sJUIFooter:a+" ui-corner-bl ui-corner-br"})}();var ke=qt.ext.pager;t.extend(ke,{simple:function(t,e){return["previous","next"]},full:function(t,e){return["first","previous","next","last"]},numbers:function(t,e){return[Mt(t,e)]},simple_numbers:function(t,e){return["previous",Mt(t,e),"next"]},full_numbers:function(t,e){return["first","previous",Mt(t,e),"next","last"]},first_last_numbers:function(t,e){return["first",Mt(t,e),"last"]},_numbers:Mt,numbers_length:7}),t.extend(!0,qt.ext.renderer,{pageButton:{_:function(e,r,o,i,s,l){var u,c,f,d=e.oClasses,h=e.oLanguage.oPaginate,p=e.oLanguage.oAria.paginate||{},g=0,b=function(n,a){var r,i,f;for(r=0,i=a.length;r<i;r++)if(f=a[r],t.isArray(f)){var v=t("<"+(f.DT_el||"div")+"/>").appendTo(n);b(v,f)}else{switch(u=null,c="",f){case"ellipsis":n.append('<span class="ellipsis">…</span>');break;case"first":u=h.sFirst,c=f+(s>0?"":" "+d.sPageButtonDisabled);break;case"previous":u=h.sPrevious,c=f+(s>0?"":" "+d.sPageButtonDisabled);break;case"next":u=h.sNext,c=f+(s<l-1?"":" "+d.sPageButtonDisabled);break;case"last":u=h.sLast,c=f+(s<l-1?"":" "+d.sPageButtonDisabled);break;default:u=f+1,c=s===f?d.sPageButtonActive:""}null!==u&&(jt(t("<a>",{class:d.sPageButton+" "+c,"aria-controls":e.sTableId,"aria-label":p[f],"data-dt-idx":g,tabindex:e.iTabIndex,id:0===o&&"string"==typeof f?e.sTableId+"_"+f:null}).html(u).appendTo(n),{action:f},function(t){ut(e,t.data.action,!0)}),g++)}};try{f=t(r).find(n.activeElement).data("dt-idx")}catch(t){}b(t(r).empty(),i),f!==a&&t(r).find("[data-dt-idx="+f+"]").focus()}}}),t.extend(qt.ext.type.detect,[function(t,e){var n=e.oLanguage.sDecimal;return ne(t,n)?"num"+n:null},function(t,e){if(t&&!(t instanceof Date)&&!Yt.test(t))return null;var n=Date.parse(t);return null!==n&&!isNaN(n)||Kt(t)?"date":null},function(t,e){var n=e.oLanguage.sDecimal;return ne(t,n,!0)?"num-fmt"+n:null},function(t,e){var n=e.oLanguage.sDecimal;return re(t,n)?"html-num"+n:null},function(t,e){var n=e.oLanguage.sDecimal;return re(t,n,!0)?"html-num-fmt"+n:null},function(t,e){return Kt(t)||"string"==typeof t&&-1!==t.indexOf("<")?"html":null}]),t.extend(qt.ext.type.search,{html:function(t){return Kt(t)?t:"string"==typeof t?t.replace($t," ").replace(zt,""):""},string:function(t){return Kt(t)?t:"string"==typeof t?t.replace($t," "):t}});var Me=function(t,e,n,a){return 0===t||t&&"-"!==t?(e&&(t=ee(t,e)),t.replace&&(n&&(t=t.replace(n,"")),a&&(t=t.replace(a,""))),1*t):-1/0};t.extend(Et.type.order,{"date-pre":function(t){return Date.parse(t)||-1/0},"html-pre":function(t){return Kt(t)?"":t.replace?t.replace(/<.*?>/g,"").toLowerCase():t+""},"string-pre":function(t){return Kt(t)?"":"string"==typeof t?t.toLowerCase():t.toString?t.toString():""},"string-asc":function(t,e){return t<e?-1:t>e?1:0},"string-desc":function(t,e){return t<e?1:t>e?-1:0}}),Ut(""),t.extend(!0,qt.ext.renderer,{header:{_:function(e,n,a,r){t(e.nTable).on("order.dt.DT",function(t,o,i,s){if(e===o){var l=a.idx;n.removeClass(a.sSortingClass+" "+r.sSortAsc+" "+r.sSortDesc).addClass("asc"==s[l]?r.sSortAsc:"desc"==s[l]?r.sSortDesc:a.sSortingClass)}})},jqueryui:function(e,n,a,r){t("<div/>").addClass(r.sSortJUIWrapper).append(n.contents()).append(t("<span/>").addClass(r.sSortIcon+" "+a.sSortingClassJUI)).appendTo(n),t(e.nTable).on("order.dt.DT",function(t,o,i,s){if(e===o){var l=a.idx;n.removeClass(r.sSortAsc+" "+r.sSortDesc).addClass("asc"==s[l]?r.sSortAsc:"desc"==s[l]?r.sSortDesc:a.sSortingClass),n.find("span."+r.sSortIcon).removeClass(r.sSortJUIAsc+" "+r.sSortJUIDesc+" "+r.sSortJUI+" "+r.sSortJUIAscAllowed+" "+r.sSortJUIDescAllowed).addClass("asc"==s[l]?r.sSortJUIAsc:"desc"==s[l]?r.sSortJUIDesc:a.sSortingClassJUI)}})}}});var Ue=function(t){return"string"==typeof t?t.replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):t};return qt.render={number:function(t,e,n,a,r){return{display:function(o){if("number"!=typeof o&&"string"!=typeof o)return o;var i=o<0?"-":"",s=parseFloat(o);if(isNaN(s))return Ue(o);s=s.toFixed(n),o=Math.abs(s);var l=parseInt(o,10),u=n?e+(o-l).toFixed(n).substring(2):"";return i+(a||"")+l.toString().replace(/\B(?=(\d{3})+(?!\d))/g,t)+u+(r||"")}}},text:function(){return{display:Ue}}},t.extend(qt.ext.internal,{_fnExternApiFunc:Bt,_fnBuildAjax:B,_fnAjaxUpdate:E,_fnAjaxParameters:J,_fnAjaxUpdateDraw:V,_fnAjaxDataSrc:X,_fnAddColumn:f,_fnColumnOptions:d,_fnAdjustColumnSizing:h,_fnVisibleToColumnIndex:p,_fnColumnIndexToVisible:g,_fnVisbleColumns:b,_fnGetColumns:v,_fnColumnTypes:S,_fnApplyColumnDefs:m,_fnHungarianMap:r,_fnCamelToHungarian:o,_fnLanguageCompat:i,_fnBrowserDetect:u,_fnAddData:D,_fnAddTr:y,_fnNodeToDataIndex:function(t,e){return e._DT_RowIndex!==a?e._DT_RowIndex:null},_fnNodeToColumnIndex:function(e,n,a){return t.inArray(a,e.aoData[n].anCells)},_fnGetCellData:_,_fnSetCellData:w,_fnSplitObjNotation:T,_fnGetObjectDataFn:C,_fnSetObjectDataFn:x,_fnGetDataMaster:I,_fnClearTable:A,_fnDeleteIndex:F,_fnInvalidate:L,_fnGetRowElements:P,_fnCreateTr:R,_fnBuildHead:H,_fnDrawHead:N,_fnDraw:W,_fnReDraw:O,_fnAddOptionsHtml:k,_fnDetectHeader:M,_fnGetUniqueThs:U,_fnFeatureHtmlFilter:q,_fnFilterComplete:G,_fnFilterCustom:$,_fnFilterColumn:z,_fnFilter:Y,_fnFilterCreateSearch:Z,_fnEscapeRegex:pe,_fnFilterData:Q,_fnFeatureHtmlInfo:et,_fnUpdateInfo:nt,_fnInfoMacros:at,_fnInitialise:rt,_fnInitComplete:ot,_fnLengthChange:it,_fnFeatureHtmlLength:st,_fnFeatureHtmlPaginate:lt,_fnPageChange:ut,_fnFeatureHtmlProcessing:ct,_fnProcessingDisplay:ft,_fnFeatureHtmlTable:dt,_fnScrollDraw:ht,_fnApplyToChildren:pt,_fnCalculateColumnWidths:gt,_fnThrottle:Se,_fnConvertToWidth:bt,_fnGetWidestNode:vt,_fnGetMaxLenString:St,_fnStringToCss:mt,_fnSortFlatten:Dt,_fnSort:yt,_fnSortAria:_t,_fnSortListener:wt,_fnSortAttachListener:Tt,_fnSortingClasses:Ct,_fnSortData:xt,_fnSaveState:It,_fnLoadState:At,_fnSettingsFromNode:Ft,_fnLog:Lt,_fnMap:Pt,_fnBindAction:jt,_fnCallbackReg:Ht,_fnCallbackFire:Nt,_fnLengthOverflow:Wt,_fnRenderer:Ot,_fnDataSource:kt,_fnRowAttributes:j,_fnCalculateEnd:function(){}}),t.fn.wfDataTable=qt,qt.$=t,t.fn.wfDataTableSettings=qt.settings,t.fn.wfDataTableExt=qt.ext,t.fn.WFDataTable=function(e){return t(this).wfDataTable(e).api()},t.each(qt,function(e,n){t.fn.WFDataTable[e]=n}),t.fn.wfDataTable});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/menu_options.php
CHANGED
@@ -924,7 +924,7 @@ $w = new wfConfig();
|
|
924 |
<label for="maxExecutionTime" class="wf-col-sm-5 wf-control-label">Maximum execution time for each scan stage <a href="http://docs.wordfence.com/en/Wordfence_options#Maximum_execution_time_for_each_scan_stage" target="_blank" rel="noopener noreferrer" class="wfhelp"></a></label>
|
925 |
<div class="wf-col-sm-7">
|
926 |
<input type="text" class="wf-form-control" name="maxExecutionTime" id="maxExecutionTime" value="<?php $w->f( 'maxExecutionTime' ); ?>">
|
927 |
-
<span class="wf-help-block">Blank for default. Must be greater than
|
928 |
</div>
|
929 |
</div>
|
930 |
<div class="wf-form-group">
|
924 |
<label for="maxExecutionTime" class="wf-col-sm-5 wf-control-label">Maximum execution time for each scan stage <a href="http://docs.wordfence.com/en/Wordfence_options#Maximum_execution_time_for_each_scan_stage" target="_blank" rel="noopener noreferrer" class="wfhelp"></a></label>
|
925 |
<div class="wf-col-sm-7">
|
926 |
<input type="text" class="wf-form-control" name="maxExecutionTime" id="maxExecutionTime" value="<?php $w->f( 'maxExecutionTime' ); ?>">
|
927 |
+
<span class="wf-help-block">Blank for default. Must be greater than <?php echo intval(WORDFENCE_SCAN_MIN_EXECUTION_TIME) - 1; ?> and 10-20 or higher is recommended for most servers.</span>
|
928 |
</div>
|
929 |
</div>
|
930 |
<div class="wf-form-group">
|
lib/wfActivityReport.php
CHANGED
@@ -409,12 +409,18 @@ SQL
|
|
409 |
}
|
410 |
|
411 |
/**
|
412 |
-
* Remove entries older than a
|
413 |
*/
|
414 |
public function rotateIPLog() {
|
415 |
$this->db->query(<<<SQL
|
416 |
DELETE FROM {$this->db->base_prefix}wfBlockedIPLog
|
417 |
WHERE unixday < FLOOR(UNIX_TIMESTAMP(DATE_SUB(NOW(), interval 1 month)) / 86400)
|
|
|
|
|
|
|
|
|
|
|
|
|
418 |
SQL
|
419 |
);
|
420 |
}
|
@@ -453,6 +459,41 @@ SQL
|
|
453 |
INSERT INTO $blocked_table (IP, countryCode, blockCount, unixday, blockType)
|
454 |
VALUES (%s, %s, 1, $unixday_insert, %s)
|
455 |
ON DUPLICATE KEY UPDATE blockCount = blockCount + 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
456 |
SQL
|
457 |
, $ip_bin, $country, $type));
|
458 |
}
|
409 |
}
|
410 |
|
411 |
/**
|
412 |
+
* Remove entries older than a month in the IP log.
|
413 |
*/
|
414 |
public function rotateIPLog() {
|
415 |
$this->db->query(<<<SQL
|
416 |
DELETE FROM {$this->db->base_prefix}wfBlockedIPLog
|
417 |
WHERE unixday < FLOOR(UNIX_TIMESTAMP(DATE_SUB(NOW(), interval 1 month)) / 86400)
|
418 |
+
SQL
|
419 |
+
);
|
420 |
+
|
421 |
+
$this->db->query(<<<SQL
|
422 |
+
DELETE FROM {$this->db->base_prefix}wfBlockedCommentLog
|
423 |
+
WHERE unixday < FLOOR(UNIX_TIMESTAMP(DATE_SUB(NOW(), interval 1 month)) / 86400)
|
424 |
SQL
|
425 |
);
|
426 |
}
|
459 |
INSERT INTO $blocked_table (IP, countryCode, blockCount, unixday, blockType)
|
460 |
VALUES (%s, %s, 1, $unixday_insert, %s)
|
461 |
ON DUPLICATE KEY UPDATE blockCount = blockCount + 1
|
462 |
+
SQL
|
463 |
+
, $ip_bin, $country, $type));
|
464 |
+
}
|
465 |
+
|
466 |
+
/**
|
467 |
+
* @param mixed $ip_address
|
468 |
+
* @param int|null $unixday
|
469 |
+
*/
|
470 |
+
public static function logBlockedComment($ip_address, $type, $unixday = null) {
|
471 |
+
/** @var wpdb $wpdb */
|
472 |
+
global $wpdb;
|
473 |
+
|
474 |
+
//Possible values for $type: anon, gsb, reputation
|
475 |
+
|
476 |
+
if (wfUtils::isValidIP($ip_address)) {
|
477 |
+
$ip_bin = wfUtils::inet_pton($ip_address);
|
478 |
+
}
|
479 |
+
else {
|
480 |
+
$ip_bin = $ip_address;
|
481 |
+
$ip_address = wfUtils::inet_ntop($ip_bin);
|
482 |
+
}
|
483 |
+
|
484 |
+
$blocked_table = "{$wpdb->base_prefix}wfBlockedCommentLog";
|
485 |
+
|
486 |
+
$unixday_insert = 'FLOOR(UNIX_TIMESTAMP() / 86400)';
|
487 |
+
if (is_int($unixday)) {
|
488 |
+
$unixday_insert = absint($unixday);
|
489 |
+
}
|
490 |
+
|
491 |
+
$country = wfUtils::IP2Country($ip_address);
|
492 |
+
|
493 |
+
$wpdb->query($wpdb->prepare(<<<SQL
|
494 |
+
INSERT INTO {$blocked_table} (IP, countryCode, blockCount, unixday, blockType)
|
495 |
+
VALUES (%s, %s, 1, {$unixday_insert}, %s)
|
496 |
+
ON DUPLICATE KEY UPDATE blockCount = blockCount + 1
|
497 |
SQL
|
498 |
, $ip_bin, $country, $type));
|
499 |
}
|
lib/wfScanEngine.php
CHANGED
@@ -1951,13 +1951,13 @@ class wfScanEngine {
|
|
1951 |
public static function getMaxExecutionTime($staySilent = false) {
|
1952 |
$config = wfConfig::get('maxExecutionTime');
|
1953 |
if (!$staySilent) { wordfence::status(4, 'info', "Got value from wf config maxExecutionTime: $config"); }
|
1954 |
-
if(is_numeric($config) && $config >=
|
1955 |
if (!$staySilent) { wordfence::status(4, 'info', "getMaxExecutionTime() returning config value: $config"); }
|
1956 |
return $config;
|
1957 |
}
|
1958 |
$ini = @ini_get('max_execution_time');
|
1959 |
if (!$staySilent) { wordfence::status(4, 'info', "Got max_execution_time value from ini: $ini"); }
|
1960 |
-
if(is_numeric($ini) && $ini >=
|
1961 |
$ini = floor($ini / 2);
|
1962 |
if (!$staySilent) { wordfence::status(4, 'info', "getMaxExecutionTime() returning half ini value: $ini"); }
|
1963 |
return $ini;
|
1951 |
public static function getMaxExecutionTime($staySilent = false) {
|
1952 |
$config = wfConfig::get('maxExecutionTime');
|
1953 |
if (!$staySilent) { wordfence::status(4, 'info', "Got value from wf config maxExecutionTime: $config"); }
|
1954 |
+
if(is_numeric($config) && $config >= WORDFENCE_SCAN_MIN_EXECUTION_TIME){
|
1955 |
if (!$staySilent) { wordfence::status(4, 'info', "getMaxExecutionTime() returning config value: $config"); }
|
1956 |
return $config;
|
1957 |
}
|
1958 |
$ini = @ini_get('max_execution_time');
|
1959 |
if (!$staySilent) { wordfence::status(4, 'info', "Got max_execution_time value from ini: $ini"); }
|
1960 |
+
if(is_numeric($ini) && $ini >= WORDFENCE_SCAN_MIN_EXECUTION_TIME){
|
1961 |
$ini = floor($ini / 2);
|
1962 |
if (!$staySilent) { wordfence::status(4, 'info', "getMaxExecutionTime() returning half ini value: $ini"); }
|
1963 |
return $ini;
|
lib/wfSchema.php
CHANGED
@@ -186,6 +186,14 @@ class wfSchema {
|
|
186 |
`blockType` varchar(50) NOT NULL DEFAULT 'generic',
|
187 |
PRIMARY KEY (`IP`,`unixday`,`blockType`)
|
188 |
) DEFAULT CHARSET=utf8",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
'wfSNIPCache' => "(
|
190 |
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
191 |
`IP` varchar(45) NOT NULL DEFAULT '',
|
186 |
`blockType` varchar(50) NOT NULL DEFAULT 'generic',
|
187 |
PRIMARY KEY (`IP`,`unixday`,`blockType`)
|
188 |
) DEFAULT CHARSET=utf8",
|
189 |
+
'wfBlockedCommentLog' => "(
|
190 |
+
`IP` binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
|
191 |
+
`countryCode` varchar(2) NOT NULL,
|
192 |
+
`blockCount` int(10) unsigned NOT NULL DEFAULT '0',
|
193 |
+
`unixday` int(10) unsigned NOT NULL,
|
194 |
+
`blockType` varchar(50) NOT NULL DEFAULT 'gsb',
|
195 |
+
PRIMARY KEY (`IP`,`unixday`,`blockType`)
|
196 |
+
) DEFAULT CHARSET=utf8",
|
197 |
'wfSNIPCache' => "(
|
198 |
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
199 |
`IP` varchar(45) NOT NULL DEFAULT '',
|
lib/wordfenceClass.php
CHANGED
@@ -385,6 +385,8 @@ class wordfence {
|
|
385 |
update_option('wordfence_version', WORDFENCE_VERSION); //In case we have a fatal error we don't want to keep running install.
|
386 |
}
|
387 |
|
|
|
|
|
388 |
//EVERYTHING HERE MUST BE IDEMPOTENT
|
389 |
|
390 |
//Remove old legacy cron job if exists
|
@@ -541,6 +543,17 @@ SQL
|
|
541 |
}
|
542 |
}
|
543 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
544 |
wfConfig::set('geoIPVersionHash', $geoIPVersionHash);
|
545 |
}
|
546 |
|
@@ -4880,7 +4893,7 @@ HTML;
|
|
4880 |
wp_enqueue_script('json2');
|
4881 |
wp_enqueue_script('jquery.wftmpl', wfUtils::getBaseURL() . 'js/jquery.tmpl.min.js', array('jquery'), WORDFENCE_VERSION);
|
4882 |
wp_enqueue_script('jquery.wfcolorbox', wfUtils::getBaseURL() . 'js/jquery.colorbox-min.js', array('jquery'), WORDFENCE_VERSION);
|
4883 |
-
wp_enqueue_script('jquery.wfdataTables', wfUtils::getBaseURL() . 'js/jquery.dataTables.js', array('jquery'), WORDFENCE_VERSION);
|
4884 |
wp_enqueue_script('jquery.qrcode', wfUtils::getBaseURL() . 'js/jquery.qrcode.min.js', array('jquery'), WORDFENCE_VERSION);
|
4885 |
//wp_enqueue_script('jquery.tools', wfUtils::getBaseURL() . 'js/jquery.tools.min.js', array('jquery'));
|
4886 |
wp_enqueue_script('wordfenceAdminjs', wfUtils::getBaseURL() . 'js/admin.js', array('jquery'), WORDFENCE_VERSION);
|
@@ -6021,6 +6034,7 @@ HTML
|
|
6021 |
$user = get_user_by('email', trim($cData['comment_author_email']));
|
6022 |
if($user){
|
6023 |
wfConfig::inc('totalSpamStopped');
|
|
|
6024 |
return 0; //hold for moderation if the user is not signed in but used a members email
|
6025 |
}
|
6026 |
}
|
@@ -6030,6 +6044,7 @@ HTML
|
|
6030 |
try {
|
6031 |
if($wf->isBadComment($cData['comment_author'], $cData['comment_author_email'], $cData['comment_author_url'], $cData['comment_author_IP'], $cData['comment_content'])){
|
6032 |
wfConfig::inc('totalSpamStopped');
|
|
|
6033 |
return 'spam';
|
6034 |
}
|
6035 |
} catch(Exception $e){
|
@@ -6057,6 +6072,7 @@ HTML
|
|
6057 |
));
|
6058 |
if(is_array($res) && isset($res['spam']) && $res['spam'] == 1){
|
6059 |
wfConfig::inc('totalSpamStopped');
|
|
|
6060 |
return 'spam';
|
6061 |
}
|
6062 |
} catch(Exception $e){
|
385 |
update_option('wordfence_version', WORDFENCE_VERSION); //In case we have a fatal error we don't want to keep running install.
|
386 |
}
|
387 |
|
388 |
+
wordfence::status(4, 'info', 'runInstall called with previous version = ' . $previous_version);
|
389 |
+
|
390 |
//EVERYTHING HERE MUST BE IDEMPOTENT
|
391 |
|
392 |
//Remove old legacy cron job if exists
|
543 |
}
|
544 |
}
|
545 |
}
|
546 |
+
|
547 |
+
$ip_results = $wpdb->get_results("SELECT countryCode, IP FROM `{$prefix}wfBlockedCommentLog` GROUP BY IP");
|
548 |
+
if ($ip_results) {
|
549 |
+
foreach ($ip_results as $ip_row) {
|
550 |
+
$country = wfUtils::IP2Country(wfUtils::inet_ntop($ip_row->IP));
|
551 |
+
if ($country != $ip_row->countryCode) {
|
552 |
+
$wpdb->query($wpdb->prepare("UPDATE `{$prefix}wfBlockedCommentLog` SET countryCode = %s WHERE IP = %s", $country, $ip_row->IP));
|
553 |
+
}
|
554 |
+
}
|
555 |
+
}
|
556 |
+
|
557 |
wfConfig::set('geoIPVersionHash', $geoIPVersionHash);
|
558 |
}
|
559 |
|
4893 |
wp_enqueue_script('json2');
|
4894 |
wp_enqueue_script('jquery.wftmpl', wfUtils::getBaseURL() . 'js/jquery.tmpl.min.js', array('jquery'), WORDFENCE_VERSION);
|
4895 |
wp_enqueue_script('jquery.wfcolorbox', wfUtils::getBaseURL() . 'js/jquery.colorbox-min.js', array('jquery'), WORDFENCE_VERSION);
|
4896 |
+
wp_enqueue_script('jquery.wfdataTables', wfUtils::getBaseURL() . 'js/jquery.dataTables.min.js', array('jquery'), WORDFENCE_VERSION);
|
4897 |
wp_enqueue_script('jquery.qrcode', wfUtils::getBaseURL() . 'js/jquery.qrcode.min.js', array('jquery'), WORDFENCE_VERSION);
|
4898 |
//wp_enqueue_script('jquery.tools', wfUtils::getBaseURL() . 'js/jquery.tools.min.js', array('jquery'));
|
4899 |
wp_enqueue_script('wordfenceAdminjs', wfUtils::getBaseURL() . 'js/admin.js', array('jquery'), WORDFENCE_VERSION);
|
6034 |
$user = get_user_by('email', trim($cData['comment_author_email']));
|
6035 |
if($user){
|
6036 |
wfConfig::inc('totalSpamStopped');
|
6037 |
+
wfActivityReport::logBlockedComment(wfUtils::getIP(), 'anon');
|
6038 |
return 0; //hold for moderation if the user is not signed in but used a members email
|
6039 |
}
|
6040 |
}
|
6044 |
try {
|
6045 |
if($wf->isBadComment($cData['comment_author'], $cData['comment_author_email'], $cData['comment_author_url'], $cData['comment_author_IP'], $cData['comment_content'])){
|
6046 |
wfConfig::inc('totalSpamStopped');
|
6047 |
+
wfActivityReport::logBlockedComment(wfUtils::getIP(), 'gsb');
|
6048 |
return 'spam';
|
6049 |
}
|
6050 |
} catch(Exception $e){
|
6072 |
));
|
6073 |
if(is_array($res) && isset($res['spam']) && $res['spam'] == 1){
|
6074 |
wfConfig::inc('totalSpamStopped');
|
6075 |
+
wfActivityReport::logBlockedComment(wfUtils::getIP(), 'reputation');
|
6076 |
return 'spam';
|
6077 |
}
|
6078 |
} catch(Exception $e){
|
lib/wordfenceConstants.php
CHANGED
@@ -20,4 +20,5 @@ if (!defined('WORDFENCE_BLOCKED_IPS_PER_PAGE')) { define('WORDFENCE_BLOCKED_IPS_
|
|
20 |
if (!defined('WORDFENCE_DISABLE_FILE_VIEWER')) { define('WORDFENCE_DISABLE_FILE_VIEWER', false); }
|
21 |
if (!defined('WORDFENCE_SCAN_FAILURE_THRESHOLD')) { define('WORDFENCE_SCAN_FAILURE_THRESHOLD', 300); }
|
22 |
if (!defined('WORDFENCE_PREFER_WP_HOME_FOR_WPML')) { define('WORDFENCE_PREFER_WP_HOME_FOR_WPML', false); } //When determining the unfiltered `home` and `siteurl` with WPML installed, use WP_HOME and WP_SITEURL if set instead of the database values
|
|
|
23 |
?>
|
20 |
if (!defined('WORDFENCE_DISABLE_FILE_VIEWER')) { define('WORDFENCE_DISABLE_FILE_VIEWER', false); }
|
21 |
if (!defined('WORDFENCE_SCAN_FAILURE_THRESHOLD')) { define('WORDFENCE_SCAN_FAILURE_THRESHOLD', 300); }
|
22 |
if (!defined('WORDFENCE_PREFER_WP_HOME_FOR_WPML')) { define('WORDFENCE_PREFER_WP_HOME_FOR_WPML', false); } //When determining the unfiltered `home` and `siteurl` with WPML installed, use WP_HOME and WP_SITEURL if set instead of the database values
|
23 |
+
if (!defined('WORDFENCE_SCAN_MIN_EXECUTION_TIME')) { define('WORDFENCE_SCAN_MIN_EXECUTION_TIME', 8); }
|
24 |
?>
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: mmaunder
|
|
3 |
Tags: security, secure, security plugin, wordpress security, login security, firewall, malware, antivirus, web application firewall, block hackers, country blocking
|
4 |
Requires at least: 3.9
|
5 |
Tested up to: 4.8.1
|
6 |
-
Stable tag: 6.3.
|
7 |
|
8 |
Secure your website with the most comprehensive WordPress security plugin. Firewall, malware scan, blocking, live traffic, login security & more.
|
9 |
|
3 |
Tags: security, secure, security plugin, wordpress security, login security, firewall, malware, antivirus, web application firewall, block hackers, country blocking
|
4 |
Requires at least: 3.9
|
5 |
Tested up to: 4.8.1
|
6 |
+
Stable tag: 6.3.18
|
7 |
|
8 |
Secure your website with the most comprehensive WordPress security plugin. Firewall, malware scan, blocking, live traffic, login security & more.
|
9 |
|
wordfence.php
CHANGED
@@ -4,14 +4,14 @@ Plugin Name: Wordfence Security
|
|
4 |
Plugin URI: http://www.wordfence.com/
|
5 |
Description: Wordfence Security - Anti-virus, Firewall and Malware Scan
|
6 |
Author: Wordfence
|
7 |
-
Version: 6.3.
|
8 |
Author URI: http://www.wordfence.com/
|
9 |
Network: true
|
10 |
*/
|
11 |
if(defined('WP_INSTALLING') && WP_INSTALLING){
|
12 |
return;
|
13 |
}
|
14 |
-
define('WORDFENCE_VERSION', '6.3.
|
15 |
define('WORDFENCE_BASENAME', function_exists('plugin_basename') ? plugin_basename(__FILE__) :
|
16 |
basename(dirname(__FILE__)) . '/' . basename(__FILE__));
|
17 |
|
4 |
Plugin URI: http://www.wordfence.com/
|
5 |
Description: Wordfence Security - Anti-virus, Firewall and Malware Scan
|
6 |
Author: Wordfence
|
7 |
+
Version: 6.3.18
|
8 |
Author URI: http://www.wordfence.com/
|
9 |
Network: true
|
10 |
*/
|
11 |
if(defined('WP_INSTALLING') && WP_INSTALLING){
|
12 |
return;
|
13 |
}
|
14 |
+
define('WORDFENCE_VERSION', '6.3.18');
|
15 |
define('WORDFENCE_BASENAME', function_exists('plugin_basename') ? plugin_basename(__FILE__) :
|
16 |
basename(dirname(__FILE__)) . '/' . basename(__FILE__));
|
17 |
|