annotate jquery.dataTables.js.vew @ 8:86219e4aa239 draft

Uploaded
author saskia-hiltemann
date Mon, 28 Aug 2017 10:23:21 -0400
parents 42076db43d42
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1 /*! DataTables 1.10.9
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2 * ©2008-2015 SpryMedia Ltd - datatables.net/license
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6 * @summary DataTables
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7 * @description Paginate, search and order HTML tables
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8 * @version 1.10.9
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9 * @file jquery.dataTables.js
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10 * @author SpryMedia Ltd (www.sprymedia.co.uk)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11 * @contact www.sprymedia.co.uk/contact
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12 * @copyright Copyright 2008-2015 SpryMedia Ltd.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14 * This source file is free software, available under the following license:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15 * MIT license - http://datatables.net/license
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
16 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
17 * This source file is distributed in the hope that it will be useful, but
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
20 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
21 * For details please refer to: http://www.datatables.net
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
22 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
23
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
24 /*jslint evil: true, undef: true, browser: true */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
25 /*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*/
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
26
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
27 (/** @lends <global> */function( window, document, undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
28
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
29 (function( factory ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
30 "use strict";
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
31
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
32 if ( typeof define === 'function' && define.amd ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
33 // Define as an AMD module if possible
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
34 define( 'datatables', ['jquery'], factory );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
35 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
36 else if ( typeof exports === 'object' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
37 // Node/CommonJS
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
38 module.exports = factory( require( 'jquery' ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
39 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
40 else if ( jQuery && !jQuery.fn.dataTable ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
41 // Define using browser globals otherwise
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
42 // Prevent multiple instantiations if the script is loaded twice
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
43 factory( jQuery );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
44 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
45 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
46 (/** @lends <global> */function( $ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
47 "use strict";
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
48
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
49 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
50 * DataTables is a plug-in for the jQuery Javascript library. It is a highly
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
51 * flexible tool, based upon the foundations of progressive enhancement,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
52 * which will add advanced interaction controls to any HTML table. For a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
53 * full list of features please refer to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
54 * [DataTables.net](href="http://datatables.net).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
55 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
56 * Note that the `DataTable` object is not a global variable but is aliased
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
57 * to `jQuery.fn.DataTable` and `jQuery.fn.dataTable` through which it may
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
58 * be accessed.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
59 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
60 * @class
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
61 * @param {object} [init={}] Configuration object for DataTables. Options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
62 * are defined by {@link DataTable.defaults}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
63 * @requires jQuery 1.7+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
64 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
65 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
66 * // Basic initialisation
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
67 * $(document).ready( function {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
68 * $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
69 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
70 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
71 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
72 * // Initialisation with configuration options - in this case, disable
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
73 * // pagination and sorting.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
74 * $(document).ready( function {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
75 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
76 * "paginate": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
77 * "sort": false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
78 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
79 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
80 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
81 var DataTable;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
82
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
83
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
84 /*
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
85 * It is useful to have variables which are scoped locally so only the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
86 * DataTables functions can access them and they don't leak into global space.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
87 * At the same time these functions are often useful over multiple files in the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
88 * core and API, so we list, or at least document, all variables which are used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
89 * by DataTables as private variables here. This also ensures that there is no
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
90 * clashing of variable names and that they can easily referenced for reuse.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
91 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
92
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
93
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
94 // Defined else where
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
95 // _selector_run
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
96 // _selector_opts
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
97 // _selector_first
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
98 // _selector_row_indexes
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
99
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
100 var _ext; // DataTable.ext
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
101 var _Api; // DataTable.Api
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
102 var _api_register; // DataTable.Api.register
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
103 var _api_registerPlural; // DataTable.Api.registerPlural
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
104
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
105 var _re_dic = {};
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
106 var _re_new_lines = /[\r\n]/g;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
107 var _re_html = /<.*?>/g;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
108 var _re_date_start = /^[\w\+\-]/;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
109 var _re_date_end = /[\w\+\-]$/;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
110
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
111 // Escape regular expression special characters
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
112 var _re_escape_regex = new RegExp( '(\\' + [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$', '^', '-' ].join('|\\') + ')', 'g' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
113
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
114 // http://en.wikipedia.org/wiki/Foreign_exchange_market
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
115 // - \u20BD - Russian ruble.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
116 // - \u20a9 - South Korean Won
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
117 // - \u20BA - Turkish Lira
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
118 // - \u20B9 - Indian Rupee
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
119 // - R - Brazil (R$) and South Africa
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
120 // - fr - Swiss Franc
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
121 // - kr - Swedish krona, Norwegian krone and Danish krone
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
122 // - \u2009 is thin space and \u202F is narrow no-break space, both used in many
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
123 // standards as thousands separators.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
124 var _re_formatted_numeric = /[',$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfk]/gi;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
125
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
126
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
127 var _empty = function ( d ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
128 return !d || d === true || d === '-' ? true : false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
129 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
130
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
131
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
132 var _intVal = function ( s ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
133 var integer = parseInt( s, 10 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
134 return !isNaN(integer) && isFinite(s) ? integer : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
135 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
136
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
137 // Convert from a formatted number with characters other than `.` as the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
138 // decimal place, to a Javascript number
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
139 var _numToDecimal = function ( num, decimalPoint ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
140 // Cache created regular expressions for speed as this function is called often
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
141 if ( ! _re_dic[ decimalPoint ] ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
142 _re_dic[ decimalPoint ] = new RegExp( _fnEscapeRegex( decimalPoint ), 'g' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
143 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
144 return typeof num === 'string' && decimalPoint !== '.' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
145 num.replace( /\./g, '' ).replace( _re_dic[ decimalPoint ], '.' ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
146 num;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
147 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
148
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
149
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
150 var _isNumber = function ( d, decimalPoint, formatted ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
151 var strType = typeof d === 'string';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
152
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
153 // If empty return immediately so there must be a number if it is a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
154 // formatted string (this stops the string "k", or "kr", etc being detected
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
155 // as a formatted number for currency
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
156 if ( _empty( d ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
157 return true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
158 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
159
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
160 if ( decimalPoint && strType ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
161 d = _numToDecimal( d, decimalPoint );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
162 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
163
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
164 if ( formatted && strType ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
165 d = d.replace( _re_formatted_numeric, '' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
166 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
167
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
168 return !isNaN( parseFloat(d) ) && isFinite( d );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
169 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
170
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
171
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
172 // A string without HTML in it can be considered to be HTML still
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
173 var _isHtml = function ( d ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
174 return _empty( d ) || typeof d === 'string';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
175 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
176
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
177
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
178 var _htmlNumeric = function ( d, decimalPoint, formatted ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
179 if ( _empty( d ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
180 return true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
181 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
182
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
183 var html = _isHtml( d );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
184 return ! html ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
185 null :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
186 _isNumber( _stripHtml( d ), decimalPoint, formatted ) ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
187 true :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
188 null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
189 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
190
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
191
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
192 var _pluck = function ( a, prop, prop2 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
193 var out = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
194 var i=0, ien=a.length;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
195
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
196 // Could have the test in the loop for slightly smaller code, but speed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
197 // is essential here
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
198 if ( prop2 !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
199 for ( ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
200 if ( a[i] && a[i][ prop ] ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
201 out.push( a[i][ prop ][ prop2 ] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
202 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
203 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
204 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
205 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
206 for ( ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
207 if ( a[i] ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
208 out.push( a[i][ prop ] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
209 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
210 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
211 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
212
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
213 return out;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
214 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
215
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
216
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
217 // Basically the same as _pluck, but rather than looping over `a` we use `order`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
218 // as the indexes to pick from `a`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
219 var _pluck_order = function ( a, order, prop, prop2 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
220 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
221 var out = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
222 var i=0, ien=order.length;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
223
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
224 // Could have the test in the loop for slightly smaller code, but speed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
225 // is essential here
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
226 if ( prop2 !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
227 for ( ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
228 if ( a[ order[i] ][ prop ] ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
229 out.push( a[ order[i] ][ prop ][ prop2 ] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
230 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
231 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
232 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
233 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
234 for ( ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
235 out.push( a[ order[i] ][ prop ] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
236 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
237 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
238
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
239 return out;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
240 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
241
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
242
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
243 var _range = function ( len, start )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
244 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
245 var out = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
246 var end;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
247
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
248 if ( start === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
249 start = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
250 end = len;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
251 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
252 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
253 end = start;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
254 start = len;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
255 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
256
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
257 for ( var i=start ; i<end ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
258 out.push( i );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
259 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
260
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
261 return out;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
262 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
263
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
264
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
265 var _removeEmpty = function ( a )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
266 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
267 var out = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
268
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
269 for ( var i=0, ien=a.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
270 if ( a[i] ) { // careful - will remove all falsy values!
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
271 out.push( a[i] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
272 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
273 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
274
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
275 return out;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
276 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
277
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
278
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
279 var _stripHtml = function ( d ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
280 return d.replace( _re_html, '' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
281 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
282
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
283
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
284 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
285 * Find the unique elements in a source array.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
286 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
287 * @param {array} src Source array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
288 * @return {array} Array of unique items
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
289 * @ignore
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
290 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
291 var _unique = function ( src )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
292 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
293 // A faster unique method is to use object keys to identify used values,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
294 // but this doesn't work with arrays or objects, which we must also
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
295 // consider. See jsperf.com/compare-array-unique-versions/4 for more
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
296 // information.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
297 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
298 out = [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
299 val,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
300 i, ien=src.length,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
301 j, k=0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
302
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
303 again: for ( i=0 ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
304 val = src[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
305
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
306 for ( j=0 ; j<k ; j++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
307 if ( out[j] === val ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
308 continue again;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
309 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
310 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
311
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
312 out.push( val );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
313 k++;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
314 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
315
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
316 return out;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
317 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
318
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
319
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
320
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
321 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
322 * Create a mapping object that allows camel case parameters to be looked up
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
323 * for their Hungarian counterparts. The mapping is stored in a private
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
324 * parameter called `_hungarianMap` which can be accessed on the source object.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
325 * @param {object} o
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
326 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
327 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
328 function _fnHungarianMap ( o )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
329 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
330 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
331 hungarian = 'a aa ai ao as b fn i m o s ',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
332 match,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
333 newKey,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
334 map = {};
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
335
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
336 $.each( o, function (key, val) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
337 match = key.match(/^([^A-Z]+?)([A-Z])/);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
338
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
339 if ( match && hungarian.indexOf(match[1]+' ') !== -1 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
340 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
341 newKey = key.replace( match[0], match[2].toLowerCase() );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
342 map[ newKey ] = key;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
343
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
344 if ( match[1] === 'o' )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
345 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
346 _fnHungarianMap( o[key] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
347 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
348 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
349 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
350
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
351 o._hungarianMap = map;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
352 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
353
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
354
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
355 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
356 * Convert from camel case parameters to Hungarian, based on a Hungarian map
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
357 * created by _fnHungarianMap.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
358 * @param {object} src The model object which holds all parameters that can be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
359 * mapped.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
360 * @param {object} user The object to convert from camel case to Hungarian.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
361 * @param {boolean} force When set to `true`, properties which already have a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
362 * Hungarian value in the `user` object will be overwritten. Otherwise they
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
363 * won't be.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
364 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
365 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
366 function _fnCamelToHungarian ( src, user, force )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
367 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
368 if ( ! src._hungarianMap ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
369 _fnHungarianMap( src );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
370 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
371
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
372 var hungarianKey;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
373
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
374 $.each( user, function (key, val) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
375 hungarianKey = src._hungarianMap[ key ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
376
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
377 if ( hungarianKey !== undefined && (force || user[hungarianKey] === undefined) )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
378 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
379 // For objects, we need to buzz down into the object to copy parameters
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
380 if ( hungarianKey.charAt(0) === 'o' )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
381 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
382 // Copy the camelCase options over to the hungarian
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
383 if ( ! user[ hungarianKey ] ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
384 user[ hungarianKey ] = {};
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
385 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
386 $.extend( true, user[hungarianKey], user[key] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
387
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
388 _fnCamelToHungarian( src[hungarianKey], user[hungarianKey], force );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
389 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
390 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
391 user[hungarianKey] = user[ key ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
392 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
393 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
394 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
395 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
396
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
397
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
398 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
399 * Language compatibility - when certain options are given, and others aren't, we
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
400 * need to duplicate the values over, in order to provide backwards compatibility
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
401 * with older language files.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
402 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
403 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
404 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
405 function _fnLanguageCompat( lang )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
406 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
407 var defaults = DataTable.defaults.oLanguage;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
408 var zeroRecords = lang.sZeroRecords;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
409
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
410 /* Backwards compatibility - if there is no sEmptyTable given, then use the same as
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
411 * sZeroRecords - assuming that is given.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
412 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
413 if ( ! lang.sEmptyTable && zeroRecords &&
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
414 defaults.sEmptyTable === "No data available in table" )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
415 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
416 _fnMap( lang, lang, 'sZeroRecords', 'sEmptyTable' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
417 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
418
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
419 /* Likewise with loading records */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
420 if ( ! lang.sLoadingRecords && zeroRecords &&
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
421 defaults.sLoadingRecords === "Loading..." )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
422 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
423 _fnMap( lang, lang, 'sZeroRecords', 'sLoadingRecords' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
424 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
425
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
426 // Old parameter name of the thousands separator mapped onto the new
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
427 if ( lang.sInfoThousands ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
428 lang.sThousands = lang.sInfoThousands;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
429 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
430
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
431 var decimal = lang.sDecimal;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
432 if ( decimal ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
433 _addNumericSort( decimal );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
434 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
435 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
436
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
437
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
438 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
439 * Map one parameter onto another
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
440 * @param {object} o Object to map
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
441 * @param {*} knew The new parameter name
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
442 * @param {*} old The old parameter name
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
443 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
444 var _fnCompatMap = function ( o, knew, old ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
445 if ( o[ knew ] !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
446 o[ old ] = o[ knew ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
447 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
448 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
449
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
450
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
451 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
452 * Provide backwards compatibility for the main DT options. Note that the new
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
453 * options are mapped onto the old parameters, so this is an external interface
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
454 * change only.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
455 * @param {object} init Object to map
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
456 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
457 function _fnCompatOpts ( init )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
458 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
459 _fnCompatMap( init, 'ordering', 'bSort' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
460 _fnCompatMap( init, 'orderMulti', 'bSortMulti' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
461 _fnCompatMap( init, 'orderClasses', 'bSortClasses' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
462 _fnCompatMap( init, 'orderCellsTop', 'bSortCellsTop' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
463 _fnCompatMap( init, 'order', 'aaSorting' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
464 _fnCompatMap( init, 'orderFixed', 'aaSortingFixed' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
465 _fnCompatMap( init, 'paging', 'bPaginate' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
466 _fnCompatMap( init, 'pagingType', 'sPaginationType' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
467 _fnCompatMap( init, 'pageLength', 'iDisplayLength' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
468 _fnCompatMap( init, 'searching', 'bFilter' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
469
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
470 // Boolean initialisation of x-scrolling
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
471 if ( typeof init.sScrollX === 'boolean' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
472 init.sScrollX = init.sScrollX ? '100%' : '';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
473 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
474
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
475 // Column search objects are in an array, so it needs to be converted
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
476 // element by element
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
477 var searchCols = init.aoSearchCols;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
478
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
479 if ( searchCols ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
480 for ( var i=0, ien=searchCols.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
481 if ( searchCols[i] ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
482 _fnCamelToHungarian( DataTable.models.oSearch, searchCols[i] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
483 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
484 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
485 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
486 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
487
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
488
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
489 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
490 * Provide backwards compatibility for column options. Note that the new options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
491 * are mapped onto the old parameters, so this is an external interface change
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
492 * only.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
493 * @param {object} init Object to map
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
494 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
495 function _fnCompatCols ( init )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
496 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
497 _fnCompatMap( init, 'orderable', 'bSortable' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
498 _fnCompatMap( init, 'orderData', 'aDataSort' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
499 _fnCompatMap( init, 'orderSequence', 'asSorting' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
500 _fnCompatMap( init, 'orderDataType', 'sortDataType' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
501
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
502 // orderData can be given as an integer
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
503 var dataSort = init.aDataSort;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
504 if ( dataSort && ! $.isArray( dataSort ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
505 init.aDataSort = [ dataSort ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
506 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
507 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
508
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
509
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
510 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
511 * Browser feature detection for capabilities, quirks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
512 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
513 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
514 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
515 function _fnBrowserDetect( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
516 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
517 // We don't need to do this every time DataTables is constructed, the values
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
518 // calculated are specific to the browser and OS configuration which we
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
519 // don't expect to change between initialisations
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
520 if ( ! DataTable.__browser ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
521 var browser = {};
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
522 DataTable.__browser = browser;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
523
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
524 // Scrolling feature / quirks detection
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
525 var n = $('<div/>')
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
526 .css( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
527 position: 'fixed',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
528 top: 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
529 left: 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
530 height: 1,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
531 width: 1,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
532 overflow: 'hidden'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
533 } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
534 .append(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
535 $('<div/>')
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
536 .css( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
537 position: 'absolute',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
538 top: 1,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
539 left: 1,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
540 width: 100,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
541 overflow: 'scroll'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
542 } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
543 .append(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
544 $('<div/>')
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
545 .css( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
546 width: '100%',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
547 height: 10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
548 } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
549 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
550 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
551 .appendTo( 'body' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
552
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
553 var outer = n.children();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
554 var inner = outer.children();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
555
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
556 // Numbers below, in order, are:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
557 // inner.offsetWidth, inner.clientWidth, outer.offsetWidth, outer.clientWidth
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
558 //
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
559 // IE6 XP: 100 100 100 83
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
560 // IE7 Vista: 100 100 100 83
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
561 // IE 8+ Windows: 83 83 100 83
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
562 // Evergreen Windows: 83 83 100 83
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
563 // Evergreen Mac with scrollbars: 85 85 100 85
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
564 // Evergreen Mac without scrollbars: 100 100 100 100
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
565
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
566 // Get scrollbar width
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
567 browser.barWidth = outer[0].offsetWidth - outer[0].clientWidth;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
568
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
569 // IE6/7 will oversize a width 100% element inside a scrolling element, to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
570 // include the width of the scrollbar, while other browsers ensure the inner
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
571 // element is contained without forcing scrolling
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
572 //console.log( inner.offsetWidth );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
573 browser.bScrollOversize = inner[0].offsetWidth === 100 && outer[0].clientWidth !== 100;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
574
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
575 // In rtl text layout, some browsers (most, but not all) will place the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
576 // scrollbar on the left, rather than the right.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
577 browser.bScrollbarLeft = Math.round( inner.offset().left ) !== 1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
578
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
579 // IE8- don't provide height and width for getBoundingClientRect
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
580 browser.bBounding = n[0].getBoundingClientRect().width ? true : false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
581
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
582 n.remove();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
583 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
584
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
585 $.extend( settings.oBrowser, DataTable.__browser );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
586 settings.oScroll.iBarWidth = DataTable.__browser.barWidth;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
587 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
588
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
589
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
590 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
591 * Array.prototype reduce[Right] method, used for browsers which don't support
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
592 * JS 1.6. Done this way to reduce code size, since we iterate either way
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
593 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
594 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
595 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
596 function _fnReduce ( that, fn, init, start, end, inc )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
597 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
598 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
599 i = start,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
600 value,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
601 isSet = false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
602
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
603 if ( init !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
604 value = init;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
605 isSet = true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
606 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
607
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
608 while ( i !== end ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
609 if ( ! that.hasOwnProperty(i) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
610 continue;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
611 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
612
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
613 value = isSet ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
614 fn( value, that[i], i, that ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
615 that[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
616
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
617 isSet = true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
618 i += inc;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
619 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
620
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
621 return value;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
622 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
623
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
624 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
625 * Add a column to the list used for the table with default values
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
626 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
627 * @param {node} nTh The th element for this column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
628 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
629 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
630 function _fnAddColumn( oSettings, nTh )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
631 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
632 // Add column to aoColumns array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
633 var oDefaults = DataTable.defaults.column;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
634 var iCol = oSettings.aoColumns.length;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
635 var oCol = $.extend( {}, DataTable.models.oColumn, oDefaults, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
636 "nTh": nTh ? nTh : document.createElement('th'),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
637 "sTitle": oDefaults.sTitle ? oDefaults.sTitle : nTh ? nTh.innerHTML : '',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
638 "aDataSort": oDefaults.aDataSort ? oDefaults.aDataSort : [iCol],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
639 "mData": oDefaults.mData ? oDefaults.mData : iCol,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
640 idx: iCol
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
641 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
642 oSettings.aoColumns.push( oCol );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
643
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
644 // Add search object for column specific search. Note that the `searchCols[ iCol ]`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
645 // passed into extend can be undefined. This allows the user to give a default
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
646 // with only some of the parameters defined, and also not give a default
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
647 var searchCols = oSettings.aoPreSearchCols;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
648 searchCols[ iCol ] = $.extend( {}, DataTable.models.oSearch, searchCols[ iCol ] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
649
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
650 // Use the default column options function to initialise classes etc
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
651 _fnColumnOptions( oSettings, iCol, $(nTh).data() );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
652 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
653
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
654
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
655 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
656 * Apply options for a column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
657 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
658 * @param {int} iCol column index to consider
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
659 * @param {object} oOptions object with sType, bVisible and bSearchable etc
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
660 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
661 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
662 function _fnColumnOptions( oSettings, iCol, oOptions )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
663 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
664 var oCol = oSettings.aoColumns[ iCol ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
665 var oClasses = oSettings.oClasses;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
666 var th = $(oCol.nTh);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
667
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
668 // Try to get width information from the DOM. We can't get it from CSS
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
669 // as we'd need to parse the CSS stylesheet. `width` option can override
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
670 if ( ! oCol.sWidthOrig ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
671 // Width attribute
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
672 oCol.sWidthOrig = th.attr('width') || null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
673
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
674 // Style attribute
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
675 var t = (th.attr('style') || '').match(/width:\s*(\d+[pxem%]+)/);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
676 if ( t ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
677 oCol.sWidthOrig = t[1];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
678 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
679 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
680
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
681 /* User specified column options */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
682 if ( oOptions !== undefined && oOptions !== null )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
683 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
684 // Backwards compatibility
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
685 _fnCompatCols( oOptions );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
686
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
687 // Map camel case parameters to their Hungarian counterparts
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
688 _fnCamelToHungarian( DataTable.defaults.column, oOptions );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
689
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
690 /* Backwards compatibility for mDataProp */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
691 if ( oOptions.mDataProp !== undefined && !oOptions.mData )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
692 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
693 oOptions.mData = oOptions.mDataProp;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
694 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
695
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
696 if ( oOptions.sType )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
697 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
698 oCol._sManualType = oOptions.sType;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
699 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
700
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
701 // `class` is a reserved word in Javascript, so we need to provide
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
702 // the ability to use a valid name for the camel case input
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
703 if ( oOptions.className && ! oOptions.sClass )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
704 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
705 oOptions.sClass = oOptions.className;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
706 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
707
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
708 $.extend( oCol, oOptions );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
709 _fnMap( oCol, oOptions, "sWidth", "sWidthOrig" );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
710
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
711 /* iDataSort to be applied (backwards compatibility), but aDataSort will take
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
712 * priority if defined
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
713 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
714 if ( oOptions.iDataSort !== undefined )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
715 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
716 oCol.aDataSort = [ oOptions.iDataSort ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
717 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
718 _fnMap( oCol, oOptions, "aDataSort" );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
719 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
720
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
721 /* Cache the data get and set functions for speed */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
722 var mDataSrc = oCol.mData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
723 var mData = _fnGetObjectDataFn( mDataSrc );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
724 var mRender = oCol.mRender ? _fnGetObjectDataFn( oCol.mRender ) : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
725
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
726 var attrTest = function( src ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
727 return typeof src === 'string' && src.indexOf('@') !== -1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
728 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
729 oCol._bAttrSrc = $.isPlainObject( mDataSrc ) && (
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
730 attrTest(mDataSrc.sort) || attrTest(mDataSrc.type) || attrTest(mDataSrc.filter)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
731 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
732
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
733 oCol.fnGetData = function (rowData, type, meta) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
734 var innerData = mData( rowData, type, undefined, meta );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
735
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
736 return mRender && type ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
737 mRender( innerData, type, rowData, meta ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
738 innerData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
739 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
740 oCol.fnSetData = function ( rowData, val, meta ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
741 return _fnSetObjectDataFn( mDataSrc )( rowData, val, meta );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
742 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
743
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
744 // Indicate if DataTables should read DOM data as an object or array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
745 // Used in _fnGetRowElements
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
746 if ( typeof mDataSrc !== 'number' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
747 oSettings._rowReadObject = true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
748 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
749
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
750 /* Feature sorting overrides column specific when off */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
751 if ( !oSettings.oFeatures.bSort )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
752 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
753 oCol.bSortable = false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
754 th.addClass( oClasses.sSortableNone ); // Have to add class here as order event isn't called
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
755 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
756
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
757 /* Check that the class assignment is correct for sorting */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
758 var bAsc = $.inArray('asc', oCol.asSorting) !== -1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
759 var bDesc = $.inArray('desc', oCol.asSorting) !== -1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
760 if ( !oCol.bSortable || (!bAsc && !bDesc) )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
761 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
762 oCol.sSortingClass = oClasses.sSortableNone;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
763 oCol.sSortingClassJUI = "";
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
764 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
765 else if ( bAsc && !bDesc )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
766 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
767 oCol.sSortingClass = oClasses.sSortableAsc;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
768 oCol.sSortingClassJUI = oClasses.sSortJUIAscAllowed;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
769 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
770 else if ( !bAsc && bDesc )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
771 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
772 oCol.sSortingClass = oClasses.sSortableDesc;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
773 oCol.sSortingClassJUI = oClasses.sSortJUIDescAllowed;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
774 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
775 else
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
776 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
777 oCol.sSortingClass = oClasses.sSortable;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
778 oCol.sSortingClassJUI = oClasses.sSortJUI;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
779 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
780 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
781
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
782
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
783 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
784 * Adjust the table column widths for new data. Note: you would probably want to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
785 * do a redraw after calling this function!
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
786 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
787 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
788 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
789 function _fnAdjustColumnSizing ( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
790 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
791 /* Not interested in doing column width calculation if auto-width is disabled */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
792 if ( settings.oFeatures.bAutoWidth !== false )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
793 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
794 var columns = settings.aoColumns;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
795
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
796 _fnCalculateColumnWidths( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
797 for ( var i=0 , iLen=columns.length ; i<iLen ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
798 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
799 columns[i].nTh.style.width = columns[i].sWidth;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
800 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
801 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
802
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
803 var scroll = settings.oScroll;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
804 if ( scroll.sY !== '' || scroll.sX !== '')
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
805 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
806 _fnScrollDraw( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
807 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
808
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
809 _fnCallbackFire( settings, null, 'column-sizing', [settings] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
810 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
811
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
812
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
813 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
814 * Covert the index of a visible column to the index in the data array (take account
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
815 * of hidden columns)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
816 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
817 * @param {int} iMatch Visible column index to lookup
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
818 * @returns {int} i the data index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
819 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
820 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
821 function _fnVisibleToColumnIndex( oSettings, iMatch )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
822 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
823 var aiVis = _fnGetColumns( oSettings, 'bVisible' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
824
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
825 return typeof aiVis[iMatch] === 'number' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
826 aiVis[iMatch] :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
827 null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
828 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
829
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
830
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
831 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
832 * Covert the index of an index in the data array and convert it to the visible
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
833 * column index (take account of hidden columns)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
834 * @param {int} iMatch Column index to lookup
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
835 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
836 * @returns {int} i the data index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
837 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
838 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
839 function _fnColumnIndexToVisible( oSettings, iMatch )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
840 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
841 var aiVis = _fnGetColumns( oSettings, 'bVisible' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
842 var iPos = $.inArray( iMatch, aiVis );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
843
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
844 return iPos !== -1 ? iPos : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
845 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
846
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
847
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
848 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
849 * Get the number of visible columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
850 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
851 * @returns {int} i the number of visible columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
852 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
853 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
854 function _fnVisbleColumns( oSettings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
855 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
856 return _fnGetColumns( oSettings, 'bVisible' ).length;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
857 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
858
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
859
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
860 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
861 * Get an array of column indexes that match a given property
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
862 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
863 * @param {string} sParam Parameter in aoColumns to look for - typically
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
864 * bVisible or bSearchable
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
865 * @returns {array} Array of indexes with matched properties
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
866 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
867 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
868 function _fnGetColumns( oSettings, sParam )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
869 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
870 var a = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
871
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
872 $.map( oSettings.aoColumns, function(val, i) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
873 if ( val[sParam] ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
874 a.push( i );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
875 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
876 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
877
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
878 return a;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
879 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
880
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
881
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
882 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
883 * Calculate the 'type' of a column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
884 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
885 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
886 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
887 function _fnColumnTypes ( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
888 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
889 var columns = settings.aoColumns;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
890 var data = settings.aoData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
891 var types = DataTable.ext.type.detect;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
892 var i, ien, j, jen, k, ken;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
893 var col, cell, detectedType, cache;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
894
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
895 // For each column, spin over the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
896 for ( i=0, ien=columns.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
897 col = columns[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
898 cache = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
899
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
900 if ( ! col.sType && col._sManualType ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
901 col.sType = col._sManualType;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
902 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
903 else if ( ! col.sType ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
904 for ( j=0, jen=types.length ; j<jen ; j++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
905 for ( k=0, ken=data.length ; k<ken ; k++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
906 // Use a cache array so we only need to get the type data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
907 // from the formatter once (when using multiple detectors)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
908 if ( cache[k] === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
909 cache[k] = _fnGetCellData( settings, k, i, 'type' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
910 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
911
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
912 detectedType = types[j]( cache[k], settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
913
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
914 // If null, then this type can't apply to this column, so
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
915 // rather than testing all cells, break out. There is an
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
916 // exception for the last type which is `html`. We need to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
917 // scan all rows since it is possible to mix string and HTML
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
918 // types
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
919 if ( ! detectedType && j !== types.length-1 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
920 break;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
921 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
922
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
923 // Only a single match is needed for html type since it is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
924 // bottom of the pile and very similar to string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
925 if ( detectedType === 'html' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
926 break;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
927 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
928 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
929
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
930 // Type is valid for all data points in the column - use this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
931 // type
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
932 if ( detectedType ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
933 col.sType = detectedType;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
934 break;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
935 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
936 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
937
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
938 // Fall back - if no type was detected, always use string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
939 if ( ! col.sType ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
940 col.sType = 'string';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
941 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
942 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
943 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
944 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
945
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
946
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
947 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
948 * Take the column definitions and static columns arrays and calculate how
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
949 * they relate to column indexes. The callback function will then apply the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
950 * definition found for a column to a suitable configuration object.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
951 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
952 * @param {array} aoColDefs The aoColumnDefs array that is to be applied
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
953 * @param {array} aoCols The aoColumns array that defines columns individually
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
954 * @param {function} fn Callback function - takes two parameters, the calculated
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
955 * column index and the definition for that column.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
956 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
957 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
958 function _fnApplyColumnDefs( oSettings, aoColDefs, aoCols, fn )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
959 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
960 var i, iLen, j, jLen, k, kLen, def;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
961 var columns = oSettings.aoColumns;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
962
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
963 // Column definitions with aTargets
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
964 if ( aoColDefs )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
965 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
966 /* Loop over the definitions array - loop in reverse so first instance has priority */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
967 for ( i=aoColDefs.length-1 ; i>=0 ; i-- )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
968 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
969 def = aoColDefs[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
970
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
971 /* Each definition can target multiple columns, as it is an array */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
972 var aTargets = def.targets !== undefined ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
973 def.targets :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
974 def.aTargets;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
975
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
976 if ( ! $.isArray( aTargets ) )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
977 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
978 aTargets = [ aTargets ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
979 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
980
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
981 for ( j=0, jLen=aTargets.length ; j<jLen ; j++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
982 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
983 if ( typeof aTargets[j] === 'number' && aTargets[j] >= 0 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
984 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
985 /* Add columns that we don't yet know about */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
986 while( columns.length <= aTargets[j] )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
987 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
988 _fnAddColumn( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
989 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
990
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
991 /* Integer, basic index */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
992 fn( aTargets[j], def );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
993 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
994 else if ( typeof aTargets[j] === 'number' && aTargets[j] < 0 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
995 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
996 /* Negative integer, right to left column counting */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
997 fn( columns.length+aTargets[j], def );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
998 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
999 else if ( typeof aTargets[j] === 'string' )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1000 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1001 /* Class name matching on TH element */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1002 for ( k=0, kLen=columns.length ; k<kLen ; k++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1003 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1004 if ( aTargets[j] == "_all" ||
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1005 $(columns[k].nTh).hasClass( aTargets[j] ) )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1006 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1007 fn( k, def );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1008 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1009 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1010 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1011 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1012 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1013 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1014
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1015 // Statically defined columns array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1016 if ( aoCols )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1017 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1018 for ( i=0, iLen=aoCols.length ; i<iLen ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1019 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1020 fn( i, aoCols[i] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1021 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1022 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1023 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1024
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1025 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1026 * Add a data array to the table, creating DOM node etc. This is the parallel to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1027 * _fnGatherData, but for adding rows from a Javascript source, rather than a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1028 * DOM source.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1029 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1030 * @param {array} aData data array to be added
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1031 * @param {node} [nTr] TR element to add to the table - optional. If not given,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1032 * DataTables will create a row automatically
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1033 * @param {array} [anTds] Array of TD|TH elements for the row - must be given
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1034 * if nTr is.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1035 * @returns {int} >=0 if successful (index of new aoData entry), -1 if failed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1036 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1037 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1038 function _fnAddData ( oSettings, aDataIn, nTr, anTds )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1039 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1040 /* Create the object for storing information about this new row */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1041 var iRow = oSettings.aoData.length;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1042 var oData = $.extend( true, {}, DataTable.models.oRow, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1043 src: nTr ? 'dom' : 'data',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1044 idx: iRow
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1045 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1046
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1047 oData._aData = aDataIn;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1048 oSettings.aoData.push( oData );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1049
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1050 /* Create the cells */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1051 var nTd, sThisType;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1052 var columns = oSettings.aoColumns;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1053
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1054 // Invalidate the column types as the new data needs to be revalidated
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1055 for ( var i=0, iLen=columns.length ; i<iLen ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1056 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1057 columns[i].sType = null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1058 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1059
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1060 /* Add to the display array */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1061 oSettings.aiDisplayMaster.push( iRow );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1062
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1063 var id = oSettings.rowIdFn( aDataIn );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1064 if ( id !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1065 oSettings.aIds[ id ] = oData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1066 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1067
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1068 /* Create the DOM information, or register it if already present */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1069 if ( nTr || ! oSettings.oFeatures.bDeferRender )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1070 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1071 _fnCreateTr( oSettings, iRow, nTr, anTds );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1072 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1073
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1074 return iRow;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1075 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1076
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1077
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1078 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1079 * Add one or more TR elements to the table. Generally we'd expect to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1080 * use this for reading data from a DOM sourced table, but it could be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1081 * used for an TR element. Note that if a TR is given, it is used (i.e.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1082 * it is not cloned).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1083 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1084 * @param {array|node|jQuery} trs The TR element(s) to add to the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1085 * @returns {array} Array of indexes for the added rows
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1086 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1087 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1088 function _fnAddTr( settings, trs )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1089 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1090 var row;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1091
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1092 // Allow an individual node to be passed in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1093 if ( ! (trs instanceof $) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1094 trs = $(trs);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1095 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1096
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1097 return trs.map( function (i, el) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1098 row = _fnGetRowElements( settings, el );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1099 return _fnAddData( settings, row.data, el, row.cells );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1100 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1101 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1102
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1103
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1104 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1105 * Take a TR element and convert it to an index in aoData
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1106 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1107 * @param {node} n the TR element to find
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1108 * @returns {int} index if the node is found, null if not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1109 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1110 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1111 function _fnNodeToDataIndex( oSettings, n )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1112 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1113 return (n._DT_RowIndex!==undefined) ? n._DT_RowIndex : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1114 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1115
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1116
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1117 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1118 * Take a TD element and convert it into a column data index (not the visible index)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1119 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1120 * @param {int} iRow The row number the TD/TH can be found in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1121 * @param {node} n The TD/TH element to find
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1122 * @returns {int} index if the node is found, -1 if not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1123 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1124 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1125 function _fnNodeToColumnIndex( oSettings, iRow, n )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1126 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1127 return $.inArray( n, oSettings.aoData[ iRow ].anCells );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1128 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1129
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1130
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1131 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1132 * Get the data for a given cell from the internal cache, taking into account data mapping
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1133 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1134 * @param {int} rowIdx aoData row id
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1135 * @param {int} colIdx Column index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1136 * @param {string} type data get type ('display', 'type' 'filter' 'sort')
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1137 * @returns {*} Cell data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1138 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1139 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1140 function _fnGetCellData( settings, rowIdx, colIdx, type )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1141 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1142 var draw = settings.iDraw;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1143 var col = settings.aoColumns[colIdx];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1144 var rowData = settings.aoData[rowIdx]._aData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1145 var defaultContent = col.sDefaultContent;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1146 var cellData = col.fnGetData( rowData, type, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1147 settings: settings,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1148 row: rowIdx,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1149 col: colIdx
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1150 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1151
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1152 if ( cellData === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1153 if ( settings.iDrawError != draw && defaultContent === null ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1154 _fnLog( settings, 0, "Requested unknown parameter "+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1155 (typeof col.mData=='function' ? '{function}' : "'"+col.mData+"'")+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1156 " for row "+rowIdx, 4 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1157 settings.iDrawError = draw;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1158 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1159 return defaultContent;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1160 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1161
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1162 /* When the data source is null, we can use default column data */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1163 if ( (cellData === rowData || cellData === null) && defaultContent !== null ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1164 cellData = defaultContent;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1165 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1166 else if ( typeof cellData === 'function' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1167 // If the data source is a function, then we run it and use the return,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1168 // executing in the scope of the data object (for instances)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1169 return cellData.call( rowData );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1170 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1171
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1172 if ( cellData === null && type == 'display' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1173 return '';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1174 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1175 return cellData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1176 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1177
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1178
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1179 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1180 * Set the value for a specific cell, into the internal data cache
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1181 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1182 * @param {int} rowIdx aoData row id
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1183 * @param {int} colIdx Column index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1184 * @param {*} val Value to set
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1185 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1186 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1187 function _fnSetCellData( settings, rowIdx, colIdx, val )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1188 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1189 var col = settings.aoColumns[colIdx];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1190 var rowData = settings.aoData[rowIdx]._aData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1191
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1192 col.fnSetData( rowData, val, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1193 settings: settings,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1194 row: rowIdx,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1195 col: colIdx
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1196 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1197 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1198
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1199
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1200 // Private variable that is used to match action syntax in the data property object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1201 var __reArray = /\[.*?\]$/;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1202 var __reFn = /\(\)$/;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1203
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1204 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1205 * Split string on periods, taking into account escaped periods
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1206 * @param {string} str String to split
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1207 * @return {array} Split string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1208 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1209 function _fnSplitObjNotation( str )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1210 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1211 return $.map( str.match(/(\\.|[^\.])+/g) || [''], function ( s ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1212 return s.replace(/\\./g, '.');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1213 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1214 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1215
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1216
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1217 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1218 * Return a function that can be used to get data from a source object, taking
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1219 * into account the ability to use nested objects as a source
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1220 * @param {string|int|function} mSource The data source for the object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1221 * @returns {function} Data get function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1222 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1223 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1224 function _fnGetObjectDataFn( mSource )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1225 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1226 if ( $.isPlainObject( mSource ) )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1227 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1228 /* Build an object of get functions, and wrap them in a single call */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1229 var o = {};
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1230 $.each( mSource, function (key, val) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1231 if ( val ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1232 o[key] = _fnGetObjectDataFn( val );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1233 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1234 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1235
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1236 return function (data, type, row, meta) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1237 var t = o[type] || o._;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1238 return t !== undefined ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1239 t(data, type, row, meta) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1240 data;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1241 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1242 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1243 else if ( mSource === null )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1244 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1245 /* Give an empty string for rendering / sorting etc */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1246 return function (data) { // type, row and meta also passed, but not used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1247 return data;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1248 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1249 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1250 else if ( typeof mSource === 'function' )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1251 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1252 return function (data, type, row, meta) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1253 return mSource( data, type, row, meta );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1254 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1255 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1256 else if ( typeof mSource === 'string' && (mSource.indexOf('.') !== -1 ||
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1257 mSource.indexOf('[') !== -1 || mSource.indexOf('(') !== -1) )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1258 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1259 /* If there is a . in the source string then the data source is in a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1260 * nested object so we loop over the data for each level to get the next
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1261 * level down. On each loop we test for undefined, and if found immediately
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1262 * return. This allows entire objects to be missing and sDefaultContent to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1263 * be used if defined, rather than throwing an error
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1264 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1265 var fetchData = function (data, type, src) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1266 var arrayNotation, funcNotation, out, innerSrc;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1267
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1268 if ( src !== "" )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1269 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1270 var a = _fnSplitObjNotation( src );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1271
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1272 for ( var i=0, iLen=a.length ; i<iLen ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1273 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1274 // Check if we are dealing with special notation
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1275 arrayNotation = a[i].match(__reArray);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1276 funcNotation = a[i].match(__reFn);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1277
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1278 if ( arrayNotation )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1279 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1280 // Array notation
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1281 a[i] = a[i].replace(__reArray, '');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1282
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1283 // Condition allows simply [] to be passed in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1284 if ( a[i] !== "" ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1285 data = data[ a[i] ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1286 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1287 out = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1288
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1289 // Get the remainder of the nested object to get
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1290 a.splice( 0, i+1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1291 innerSrc = a.join('.');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1292
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1293 // Traverse each entry in the array getting the properties requested
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1294 if ( $.isArray( data ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1295 for ( var j=0, jLen=data.length ; j<jLen ; j++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1296 out.push( fetchData( data[j], type, innerSrc ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1297 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1298 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1299
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1300 // If a string is given in between the array notation indicators, that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1301 // is used to join the strings together, otherwise an array is returned
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1302 var join = arrayNotation[0].substring(1, arrayNotation[0].length-1);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1303 data = (join==="") ? out : out.join(join);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1304
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1305 // The inner call to fetchData has already traversed through the remainder
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1306 // of the source requested, so we exit from the loop
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1307 break;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1308 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1309 else if ( funcNotation )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1310 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1311 // Function call
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1312 a[i] = a[i].replace(__reFn, '');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1313 data = data[ a[i] ]();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1314 continue;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1315 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1316
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1317 if ( data === null || data[ a[i] ] === undefined )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1318 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1319 return undefined;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1320 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1321 data = data[ a[i] ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1322 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1323 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1324
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1325 return data;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1326 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1327
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1328 return function (data, type) { // row and meta also passed, but not used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1329 return fetchData( data, type, mSource );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1330 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1331 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1332 else
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1333 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1334 /* Array or flat object mapping */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1335 return function (data, type) { // row and meta also passed, but not used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1336 return data[mSource];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1337 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1338 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1339 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1340
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1341
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1342 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1343 * Return a function that can be used to set data from a source object, taking
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1344 * into account the ability to use nested objects as a source
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1345 * @param {string|int|function} mSource The data source for the object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1346 * @returns {function} Data set function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1347 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1348 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1349 function _fnSetObjectDataFn( mSource )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1350 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1351 if ( $.isPlainObject( mSource ) )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1352 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1353 /* Unlike get, only the underscore (global) option is used for for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1354 * setting data since we don't know the type here. This is why an object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1355 * option is not documented for `mData` (which is read/write), but it is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1356 * for `mRender` which is read only.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1357 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1358 return _fnSetObjectDataFn( mSource._ );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1359 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1360 else if ( mSource === null )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1361 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1362 /* Nothing to do when the data source is null */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1363 return function () {};
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1364 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1365 else if ( typeof mSource === 'function' )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1366 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1367 return function (data, val, meta) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1368 mSource( data, 'set', val, meta );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1369 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1370 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1371 else if ( typeof mSource === 'string' && (mSource.indexOf('.') !== -1 ||
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1372 mSource.indexOf('[') !== -1 || mSource.indexOf('(') !== -1) )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1373 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1374 /* Like the get, we need to get data from a nested object */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1375 var setData = function (data, val, src) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1376 var a = _fnSplitObjNotation( src ), b;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1377 var aLast = a[a.length-1];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1378 var arrayNotation, funcNotation, o, innerSrc;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1379
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1380 for ( var i=0, iLen=a.length-1 ; i<iLen ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1381 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1382 // Check if we are dealing with an array notation request
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1383 arrayNotation = a[i].match(__reArray);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1384 funcNotation = a[i].match(__reFn);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1385
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1386 if ( arrayNotation )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1387 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1388 a[i] = a[i].replace(__reArray, '');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1389 data[ a[i] ] = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1390
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1391 // Get the remainder of the nested object to set so we can recurse
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1392 b = a.slice();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1393 b.splice( 0, i+1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1394 innerSrc = b.join('.');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1395
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1396 // Traverse each entry in the array setting the properties requested
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1397 if ( $.isArray( val ) )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1398 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1399 for ( var j=0, jLen=val.length ; j<jLen ; j++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1400 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1401 o = {};
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1402 setData( o, val[j], innerSrc );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1403 data[ a[i] ].push( o );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1404 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1405 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1406 else
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1407 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1408 // We've been asked to save data to an array, but it
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1409 // isn't array data to be saved. Best that can be done
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1410 // is to just save the value.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1411 data[ a[i] ] = val;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1412 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1413
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1414 // The inner call to setData has already traversed through the remainder
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1415 // of the source and has set the data, thus we can exit here
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1416 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1417 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1418 else if ( funcNotation )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1419 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1420 // Function call
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1421 a[i] = a[i].replace(__reFn, '');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1422 data = data[ a[i] ]( val );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1423 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1424
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1425 // If the nested object doesn't currently exist - since we are
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1426 // trying to set the value - create it
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1427 if ( data[ a[i] ] === null || data[ a[i] ] === undefined )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1428 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1429 data[ a[i] ] = {};
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1430 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1431 data = data[ a[i] ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1432 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1433
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1434 // Last item in the input - i.e, the actual set
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1435 if ( aLast.match(__reFn ) )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1436 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1437 // Function call
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1438 data = data[ aLast.replace(__reFn, '') ]( val );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1439 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1440 else
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1441 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1442 // If array notation is used, we just want to strip it and use the property name
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1443 // and assign the value. If it isn't used, then we get the result we want anyway
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1444 data[ aLast.replace(__reArray, '') ] = val;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1445 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1446 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1447
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1448 return function (data, val) { // meta is also passed in, but not used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1449 return setData( data, val, mSource );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1450 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1451 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1452 else
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1453 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1454 /* Array or flat object mapping */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1455 return function (data, val) { // meta is also passed in, but not used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1456 data[mSource] = val;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1457 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1458 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1459 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1460
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1461
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1462 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1463 * Return an array with the full table data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1464 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1465 * @returns array {array} aData Master data array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1466 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1467 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1468 function _fnGetDataMaster ( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1469 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1470 return _pluck( settings.aoData, '_aData' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1471 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1472
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1473
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1474 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1475 * Nuke the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1476 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1477 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1478 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1479 function _fnClearTable( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1480 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1481 settings.aoData.length = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1482 settings.aiDisplayMaster.length = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1483 settings.aiDisplay.length = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1484 settings.aIds = {};
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1485 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1486
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1487
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1488 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1489 * Take an array of integers (index array) and remove a target integer (value - not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1490 * the key!)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1491 * @param {array} a Index array to target
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1492 * @param {int} iTarget value to find
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1493 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1494 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1495 function _fnDeleteIndex( a, iTarget, splice )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1496 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1497 var iTargetIndex = -1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1498
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1499 for ( var i=0, iLen=a.length ; i<iLen ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1500 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1501 if ( a[i] == iTarget )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1502 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1503 iTargetIndex = i;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1504 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1505 else if ( a[i] > iTarget )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1506 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1507 a[i]--;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1508 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1509 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1510
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1511 if ( iTargetIndex != -1 && splice === undefined )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1512 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1513 a.splice( iTargetIndex, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1514 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1515 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1516
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1517
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1518 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1519 * Mark cached data as invalid such that a re-read of the data will occur when
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1520 * the cached data is next requested. Also update from the data source object.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1521 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1522 * @param {object} settings DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1523 * @param {int} rowIdx Row index to invalidate
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1524 * @param {string} [src] Source to invalidate from: undefined, 'auto', 'dom'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1525 * or 'data'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1526 * @param {int} [colIdx] Column index to invalidate. If undefined the whole
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1527 * row will be invalidated
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1528 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1529 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1530 * @todo For the modularisation of v1.11 this will need to become a callback, so
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1531 * the sort and filter methods can subscribe to it. That will required
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1532 * initialisation options for sorting, which is why it is not already baked in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1533 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1534 function _fnInvalidate( settings, rowIdx, src, colIdx )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1535 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1536 var row = settings.aoData[ rowIdx ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1537 var i, ien;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1538 var cellWrite = function ( cell, col ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1539 // This is very frustrating, but in IE if you just write directly
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1540 // to innerHTML, and elements that are overwritten are GC'ed,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1541 // even if there is a reference to them elsewhere
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1542 while ( cell.childNodes.length ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1543 cell.removeChild( cell.firstChild );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1544 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1545
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1546 cell.innerHTML = _fnGetCellData( settings, rowIdx, col, 'display' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1547 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1548
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1549 // Are we reading last data from DOM or the data object?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1550 if ( src === 'dom' || ((! src || src === 'auto') && row.src === 'dom') ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1551 // Read the data from the DOM
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1552 row._aData = _fnGetRowElements(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1553 settings, row, colIdx, colIdx === undefined ? undefined : row._aData
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1554 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1555 .data;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1556 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1557 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1558 // Reading from data object, update the DOM
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1559 var cells = row.anCells;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1560
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1561 if ( cells ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1562 if ( colIdx !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1563 cellWrite( cells[colIdx], colIdx );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1564 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1565 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1566 for ( i=0, ien=cells.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1567 cellWrite( cells[i], i );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1568 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1569 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1570 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1571 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1572
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1573 // For both row and cell invalidation, the cached data for sorting and
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1574 // filtering is nulled out
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1575 row._aSortData = null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1576 row._aFilterData = null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1577
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1578 // Invalidate the type for a specific column (if given) or all columns since
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1579 // the data might have changed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1580 var cols = settings.aoColumns;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1581 if ( colIdx !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1582 cols[ colIdx ].sType = null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1583 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1584 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1585 for ( i=0, ien=cols.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1586 cols[i].sType = null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1587 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1588
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1589 // Update DataTables special `DT_*` attributes for the row
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1590 _fnRowAttributes( settings, row );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1591 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1592 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1593
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1594
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1595 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1596 * Build a data source object from an HTML row, reading the contents of the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1597 * cells that are in the row.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1598 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1599 * @param {object} settings DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1600 * @param {node|object} TR element from which to read data or existing row
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1601 * object from which to re-read the data from the cells
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1602 * @param {int} [colIdx] Optional column index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1603 * @param {array|object} [d] Data source object. If `colIdx` is given then this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1604 * parameter should also be given and will be used to write the data into.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1605 * Only the column in question will be written
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1606 * @returns {object} Object with two parameters: `data` the data read, in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1607 * document order, and `cells` and array of nodes (they can be useful to the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1608 * caller, so rather than needing a second traversal to get them, just return
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1609 * them from here).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1610 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1611 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1612 function _fnGetRowElements( settings, row, colIdx, d )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1613 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1614 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1615 tds = [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1616 td = row.firstChild,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1617 name, col, o, i=0, contents,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1618 columns = settings.aoColumns,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1619 objectRead = settings._rowReadObject;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1620
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1621 // Allow the data object to be passed in, or construct
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1622 d = d !== undefined ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1623 d :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1624 objectRead ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1625 {} :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1626 [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1627
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1628 var attr = function ( str, td ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1629 if ( typeof str === 'string' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1630 var idx = str.indexOf('@');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1631
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1632 if ( idx !== -1 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1633 var attr = str.substring( idx+1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1634 var setter = _fnSetObjectDataFn( str );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1635 setter( d, td.getAttribute( attr ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1636 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1637 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1638 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1639
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1640 // Read data from a cell and store into the data object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1641 var cellProcess = function ( cell ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1642 if ( colIdx === undefined || colIdx === i ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1643 col = columns[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1644 contents = $.trim(cell.innerHTML);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1645
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1646 if ( col && col._bAttrSrc ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1647 var setter = _fnSetObjectDataFn( col.mData._ );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1648 setter( d, contents );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1649
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1650 attr( col.mData.sort, cell );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1651 attr( col.mData.type, cell );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1652 attr( col.mData.filter, cell );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1653 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1654 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1655 // Depending on the `data` option for the columns the data can
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1656 // be read to either an object or an array.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1657 if ( objectRead ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1658 if ( ! col._setter ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1659 // Cache the setter function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1660 col._setter = _fnSetObjectDataFn( col.mData );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1661 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1662 col._setter( d, contents );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1663 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1664 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1665 d[i] = contents;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1666 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1667 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1668 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1669
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1670 i++;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1671 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1672
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1673 if ( td ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1674 // `tr` element was passed in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1675 while ( td ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1676 name = td.nodeName.toUpperCase();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1677
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1678 if ( name == "TD" || name == "TH" ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1679 cellProcess( td );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1680 tds.push( td );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1681 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1682
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1683 td = td.nextSibling;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1684 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1685 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1686 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1687 // Existing row object passed in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1688 tds = row.anCells;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1689
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1690 for ( var j=0, jen=tds.length ; j<jen ; j++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1691 cellProcess( tds[j] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1692 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1693 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1694
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1695 // Read the ID from the DOM if present
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1696 var rowNode = td ? row : row.nTr;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1697
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1698 if ( rowNode ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1699 var id = rowNode.getAttribute( 'id' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1700
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1701 if ( id ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1702 _fnSetObjectDataFn( settings.rowId )( d, id );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1703 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1704 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1705
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1706 return {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1707 data: d,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1708 cells: tds
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1709 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1710 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1711 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1712 * Create a new TR element (and it's TD children) for a row
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1713 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1714 * @param {int} iRow Row to consider
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1715 * @param {node} [nTrIn] TR element to add to the table - optional. If not given,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1716 * DataTables will create a row automatically
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1717 * @param {array} [anTds] Array of TD|TH elements for the row - must be given
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1718 * if nTr is.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1719 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1720 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1721 function _fnCreateTr ( oSettings, iRow, nTrIn, anTds )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1722 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1723 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1724 row = oSettings.aoData[iRow],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1725 rowData = row._aData,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1726 cells = [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1727 nTr, nTd, oCol,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1728 i, iLen;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1729
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1730 if ( row.nTr === null )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1731 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1732 nTr = nTrIn || document.createElement('tr');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1733
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1734 row.nTr = nTr;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1735 row.anCells = cells;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1736
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1737 /* Use a private property on the node to allow reserve mapping from the node
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1738 * to the aoData array for fast look up
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1739 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1740 nTr._DT_RowIndex = iRow;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1741
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1742 /* Special parameters can be given by the data source to be used on the row */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1743 _fnRowAttributes( oSettings, row );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1744
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1745 /* Process each column */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1746 for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1747 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1748 oCol = oSettings.aoColumns[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1749
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1750 nTd = nTrIn ? anTds[i] : document.createElement( oCol.sCellType );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1751 cells.push( nTd );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1752
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1753 // Need to create the HTML if new, or if a rendering function is defined
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1754 if ( !nTrIn || oCol.mRender || oCol.mData !== i )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1755 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1756 nTd.innerHTML = _fnGetCellData( oSettings, iRow, i, 'display' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1757 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1758
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1759 /* Add user defined class */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1760 if ( oCol.sClass )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1761 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1762 nTd.className += ' '+oCol.sClass;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1763 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1764
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1765 // Visibility - add or remove as required
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1766 if ( oCol.bVisible && ! nTrIn )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1767 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1768 nTr.appendChild( nTd );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1769 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1770 else if ( ! oCol.bVisible && nTrIn )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1771 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1772 nTd.parentNode.removeChild( nTd );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1773 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1774
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1775 if ( oCol.fnCreatedCell )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1776 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1777 oCol.fnCreatedCell.call( oSettings.oInstance,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1778 nTd, _fnGetCellData( oSettings, iRow, i ), rowData, iRow, i
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1779 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1780 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1781 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1782
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1783 _fnCallbackFire( oSettings, 'aoRowCreatedCallback', null, [nTr, rowData, iRow] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1784 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1785
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1786 // Remove once webkit bug 131819 and Chromium bug 365619 have been resolved
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1787 // and deployed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1788 row.nTr.setAttribute( 'role', 'row' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1789 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1790
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1791
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1792 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1793 * Add attributes to a row based on the special `DT_*` parameters in a data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1794 * source object.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1795 * @param {object} settings DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1796 * @param {object} DataTables row object for the row to be modified
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1797 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1798 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1799 function _fnRowAttributes( settings, row )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1800 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1801 var tr = row.nTr;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1802 var data = row._aData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1803
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1804 if ( tr ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1805 var id = settings.rowIdFn( data );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1806
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1807 if ( id ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1808 tr.id = id;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1809 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1810
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1811 if ( data.DT_RowClass ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1812 // Remove any classes added by DT_RowClass before
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1813 var a = data.DT_RowClass.split(' ');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1814 row.__rowc = row.__rowc ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1815 _unique( row.__rowc.concat( a ) ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1816 a;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1817
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1818 $(tr)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1819 .removeClass( row.__rowc.join(' ') )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1820 .addClass( data.DT_RowClass );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1821 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1822
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1823 if ( data.DT_RowAttr ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1824 $(tr).attr( data.DT_RowAttr );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1825 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1826
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1827 if ( data.DT_RowData ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1828 $(tr).data( data.DT_RowData );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1829 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1830 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1831 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1832
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1833
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1834 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1835 * Create the HTML header for the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1836 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1837 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1838 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1839 function _fnBuildHead( oSettings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1840 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1841 var i, ien, cell, row, column;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1842 var thead = oSettings.nTHead;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1843 var tfoot = oSettings.nTFoot;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1844 var createHeader = $('th, td', thead).length === 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1845 var classes = oSettings.oClasses;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1846 var columns = oSettings.aoColumns;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1847
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1848 if ( createHeader ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1849 row = $('<tr/>').appendTo( thead );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1850 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1851
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1852 for ( i=0, ien=columns.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1853 column = columns[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1854 cell = $( column.nTh ).addClass( column.sClass );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1855
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1856 if ( createHeader ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1857 cell.appendTo( row );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1858 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1859
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1860 // 1.11 move into sorting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1861 if ( oSettings.oFeatures.bSort ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1862 cell.addClass( column.sSortingClass );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1863
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1864 if ( column.bSortable !== false ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1865 cell
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1866 .attr( 'tabindex', oSettings.iTabIndex )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1867 .attr( 'aria-controls', oSettings.sTableId );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1868
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1869 _fnSortAttachListener( oSettings, column.nTh, i );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1870 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1871 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1872
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1873 if ( column.sTitle != cell[0].innerHTML ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1874 cell.html( column.sTitle );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1875 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1876
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1877 _fnRenderer( oSettings, 'header' )(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1878 oSettings, cell, column, classes
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1879 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1880 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1881
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1882 if ( createHeader ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1883 _fnDetectHeader( oSettings.aoHeader, thead );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1884 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1885
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1886 /* ARIA role for the rows */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1887 $(thead).find('>tr').attr('role', 'row');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1888
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1889 /* Deal with the footer - add classes if required */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1890 $(thead).find('>tr>th, >tr>td').addClass( classes.sHeaderTH );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1891 $(tfoot).find('>tr>th, >tr>td').addClass( classes.sFooterTH );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1892
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1893 // Cache the footer cells. Note that we only take the cells from the first
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1894 // row in the footer. If there is more than one row the user wants to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1895 // interact with, they need to use the table().foot() method. Note also this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1896 // allows cells to be used for multiple columns using colspan
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1897 if ( tfoot !== null ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1898 var cells = oSettings.aoFooter[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1899
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1900 for ( i=0, ien=cells.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1901 column = columns[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1902 column.nTf = cells[i].cell;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1903
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1904 if ( column.sClass ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1905 $(column.nTf).addClass( column.sClass );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1906 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1907 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1908 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1909 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1910
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1911
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1912 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1913 * Draw the header (or footer) element based on the column visibility states. The
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1914 * methodology here is to use the layout array from _fnDetectHeader, modified for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1915 * the instantaneous column visibility, to construct the new layout. The grid is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1916 * traversed over cell at a time in a rows x columns grid fashion, although each
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1917 * cell insert can cover multiple elements in the grid - which is tracks using the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1918 * aApplied array. Cell inserts in the grid will only occur where there isn't
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1919 * already a cell in that position.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1920 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1921 * @param array {objects} aoSource Layout array from _fnDetectHeader
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1922 * @param {boolean} [bIncludeHidden=false] If true then include the hidden columns in the calc,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1923 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1924 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1925 function _fnDrawHead( oSettings, aoSource, bIncludeHidden )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1926 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1927 var i, iLen, j, jLen, k, kLen, n, nLocalTr;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1928 var aoLocal = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1929 var aApplied = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1930 var iColumns = oSettings.aoColumns.length;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1931 var iRowspan, iColspan;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1932
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1933 if ( ! aoSource )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1934 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1935 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1936 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1937
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1938 if ( bIncludeHidden === undefined )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1939 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1940 bIncludeHidden = false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1941 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1942
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1943 /* Make a copy of the master layout array, but without the visible columns in it */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1944 for ( i=0, iLen=aoSource.length ; i<iLen ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1945 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1946 aoLocal[i] = aoSource[i].slice();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1947 aoLocal[i].nTr = aoSource[i].nTr;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1948
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1949 /* Remove any columns which are currently hidden */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1950 for ( j=iColumns-1 ; j>=0 ; j-- )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1951 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1952 if ( !oSettings.aoColumns[j].bVisible && !bIncludeHidden )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1953 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1954 aoLocal[i].splice( j, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1955 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1956 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1957
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1958 /* Prep the applied array - it needs an element for each row */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1959 aApplied.push( [] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1960 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1961
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1962 for ( i=0, iLen=aoLocal.length ; i<iLen ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1963 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1964 nLocalTr = aoLocal[i].nTr;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1965
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1966 /* All cells are going to be replaced, so empty out the row */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1967 if ( nLocalTr )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1968 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1969 while( (n = nLocalTr.firstChild) )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1970 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1971 nLocalTr.removeChild( n );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1972 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1973 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1974
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1975 for ( j=0, jLen=aoLocal[i].length ; j<jLen ; j++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1976 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1977 iRowspan = 1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1978 iColspan = 1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1979
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1980 /* Check to see if there is already a cell (row/colspan) covering our target
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1981 * insert point. If there is, then there is nothing to do.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1982 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1983 if ( aApplied[i][j] === undefined )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1984 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1985 nLocalTr.appendChild( aoLocal[i][j].cell );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1986 aApplied[i][j] = 1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1987
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1988 /* Expand the cell to cover as many rows as needed */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1989 while ( aoLocal[i+iRowspan] !== undefined &&
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1990 aoLocal[i][j].cell == aoLocal[i+iRowspan][j].cell )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1991 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1992 aApplied[i+iRowspan][j] = 1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1993 iRowspan++;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1994 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1995
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1996 /* Expand the cell to cover as many columns as needed */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1997 while ( aoLocal[i][j+iColspan] !== undefined &&
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1998 aoLocal[i][j].cell == aoLocal[i][j+iColspan].cell )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
1999 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2000 /* Must update the applied array over the rows for the columns */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2001 for ( k=0 ; k<iRowspan ; k++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2002 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2003 aApplied[i+k][j+iColspan] = 1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2004 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2005 iColspan++;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2006 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2007
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2008 /* Do the actual expansion in the DOM */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2009 $(aoLocal[i][j].cell)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2010 .attr('rowspan', iRowspan)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2011 .attr('colspan', iColspan);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2012 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2013 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2014 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2015 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2016
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2017
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2018 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2019 * Insert the required TR nodes into the table for display
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2020 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2021 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2022 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2023 function _fnDraw( oSettings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2024 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2025 /* Provide a pre-callback function which can be used to cancel the draw is false is returned */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2026 var aPreDraw = _fnCallbackFire( oSettings, 'aoPreDrawCallback', 'preDraw', [oSettings] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2027 if ( $.inArray( false, aPreDraw ) !== -1 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2028 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2029 _fnProcessingDisplay( oSettings, false );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2030 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2031 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2032
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2033 var i, iLen, n;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2034 var anRows = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2035 var iRowCount = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2036 var asStripeClasses = oSettings.asStripeClasses;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2037 var iStripes = asStripeClasses.length;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2038 var iOpenRows = oSettings.aoOpenRows.length;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2039 var oLang = oSettings.oLanguage;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2040 var iInitDisplayStart = oSettings.iInitDisplayStart;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2041 var bServerSide = _fnDataSource( oSettings ) == 'ssp';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2042 var aiDisplay = oSettings.aiDisplay;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2043
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2044 oSettings.bDrawing = true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2045
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2046 /* Check and see if we have an initial draw position from state saving */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2047 if ( iInitDisplayStart !== undefined && iInitDisplayStart !== -1 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2048 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2049 oSettings._iDisplayStart = bServerSide ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2050 iInitDisplayStart :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2051 iInitDisplayStart >= oSettings.fnRecordsDisplay() ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2052 0 :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2053 iInitDisplayStart;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2054
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2055 oSettings.iInitDisplayStart = -1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2056 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2057
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2058 var iDisplayStart = oSettings._iDisplayStart;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2059 var iDisplayEnd = oSettings.fnDisplayEnd();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2060
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2061 /* Server-side processing draw intercept */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2062 if ( oSettings.bDeferLoading )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2063 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2064 oSettings.bDeferLoading = false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2065 oSettings.iDraw++;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2066 _fnProcessingDisplay( oSettings, false );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2067 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2068 else if ( !bServerSide )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2069 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2070 oSettings.iDraw++;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2071 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2072 else if ( !oSettings.bDestroying && !_fnAjaxUpdate( oSettings ) )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2073 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2074 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2075 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2076
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2077 if ( aiDisplay.length !== 0 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2078 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2079 var iStart = bServerSide ? 0 : iDisplayStart;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2080 var iEnd = bServerSide ? oSettings.aoData.length : iDisplayEnd;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2081
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2082 for ( var j=iStart ; j<iEnd ; j++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2083 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2084 var iDataIndex = aiDisplay[j];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2085 var aoData = oSettings.aoData[ iDataIndex ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2086 if ( aoData.nTr === null )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2087 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2088 _fnCreateTr( oSettings, iDataIndex );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2089 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2090
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2091 var nRow = aoData.nTr;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2092
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2093 /* Remove the old striping classes and then add the new one */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2094 if ( iStripes !== 0 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2095 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2096 var sStripe = asStripeClasses[ iRowCount % iStripes ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2097 if ( aoData._sRowStripe != sStripe )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2098 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2099 $(nRow).removeClass( aoData._sRowStripe ).addClass( sStripe );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2100 aoData._sRowStripe = sStripe;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2101 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2102 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2103
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2104 // Row callback functions - might want to manipulate the row
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2105 // iRowCount and j are not currently documented. Are they at all
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2106 // useful?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2107 _fnCallbackFire( oSettings, 'aoRowCallback', null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2108 [nRow, aoData._aData, iRowCount, j] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2109
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2110 anRows.push( nRow );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2111 iRowCount++;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2112 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2113 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2114 else
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2115 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2116 /* Table is empty - create a row with an empty message in it */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2117 var sZero = oLang.sZeroRecords;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2118 if ( oSettings.iDraw == 1 && _fnDataSource( oSettings ) == 'ajax' )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2119 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2120 sZero = oLang.sLoadingRecords;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2121 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2122 else if ( oLang.sEmptyTable && oSettings.fnRecordsTotal() === 0 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2123 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2124 sZero = oLang.sEmptyTable;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2125 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2126
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2127 anRows[ 0 ] = $( '<tr/>', { 'class': iStripes ? asStripeClasses[0] : '' } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2128 .append( $('<td />', {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2129 'valign': 'top',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2130 'colSpan': _fnVisbleColumns( oSettings ),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2131 'class': oSettings.oClasses.sRowEmpty
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2132 } ).html( sZero ) )[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2133 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2134
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2135 /* Header and footer callbacks */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2136 _fnCallbackFire( oSettings, 'aoHeaderCallback', 'header', [ $(oSettings.nTHead).children('tr')[0],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2137 _fnGetDataMaster( oSettings ), iDisplayStart, iDisplayEnd, aiDisplay ] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2138
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2139 _fnCallbackFire( oSettings, 'aoFooterCallback', 'footer', [ $(oSettings.nTFoot).children('tr')[0],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2140 _fnGetDataMaster( oSettings ), iDisplayStart, iDisplayEnd, aiDisplay ] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2141
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2142 var body = $(oSettings.nTBody);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2143
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2144 body.children().detach();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2145 body.append( $(anRows) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2146
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2147 /* Call all required callback functions for the end of a draw */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2148 _fnCallbackFire( oSettings, 'aoDrawCallback', 'draw', [oSettings] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2149
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2150 /* Draw is complete, sorting and filtering must be as well */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2151 oSettings.bSorted = false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2152 oSettings.bFiltered = false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2153 oSettings.bDrawing = false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2154 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2155
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2156
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2157 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2158 * Redraw the table - taking account of the various features which are enabled
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2159 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2160 * @param {boolean} [holdPosition] Keep the current paging position. By default
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2161 * the paging is reset to the first page
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2162 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2163 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2164 function _fnReDraw( settings, holdPosition )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2165 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2166 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2167 features = settings.oFeatures,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2168 sort = features.bSort,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2169 filter = features.bFilter;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2170
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2171 if ( sort ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2172 _fnSort( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2173 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2174
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2175 if ( filter ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2176 _fnFilterComplete( settings, settings.oPreviousSearch );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2177 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2178 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2179 // No filtering, so we want to just use the display master
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2180 settings.aiDisplay = settings.aiDisplayMaster.slice();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2181 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2182
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2183 if ( holdPosition !== true ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2184 settings._iDisplayStart = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2185 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2186
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2187 // Let any modules know about the draw hold position state (used by
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2188 // scrolling internally)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2189 settings._drawHold = holdPosition;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2190
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2191 _fnDraw( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2192
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2193 settings._drawHold = false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2194 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2195
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2196
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2197 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2198 * Add the options to the page HTML for the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2199 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2200 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2201 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2202 function _fnAddOptionsHtml ( oSettings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2203 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2204 var classes = oSettings.oClasses;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2205 var table = $(oSettings.nTable);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2206 var holding = $('<div/>').insertBefore( table ); // Holding element for speed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2207 var features = oSettings.oFeatures;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2208
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2209 // All DataTables are wrapped in a div
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2210 var insert = $('<div/>', {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2211 id: oSettings.sTableId+'_wrapper',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2212 'class': classes.sWrapper + (oSettings.nTFoot ? '' : ' '+classes.sNoFooter)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2213 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2214
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2215 oSettings.nHolding = holding[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2216 oSettings.nTableWrapper = insert[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2217 oSettings.nTableReinsertBefore = oSettings.nTable.nextSibling;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2218
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2219 /* Loop over the user set positioning and place the elements as needed */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2220 var aDom = oSettings.sDom.split('');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2221 var featureNode, cOption, nNewNode, cNext, sAttr, j;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2222 for ( var i=0 ; i<aDom.length ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2223 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2224 featureNode = null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2225 cOption = aDom[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2226
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2227 if ( cOption == '<' )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2228 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2229 /* New container div */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2230 nNewNode = $('<div/>')[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2231
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2232 /* Check to see if we should append an id and/or a class name to the container */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2233 cNext = aDom[i+1];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2234 if ( cNext == "'" || cNext == '"' )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2235 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2236 sAttr = "";
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2237 j = 2;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2238 while ( aDom[i+j] != cNext )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2239 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2240 sAttr += aDom[i+j];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2241 j++;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2242 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2243
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2244 /* Replace jQuery UI constants @todo depreciated */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2245 if ( sAttr == "H" )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2246 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2247 sAttr = classes.sJUIHeader;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2248 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2249 else if ( sAttr == "F" )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2250 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2251 sAttr = classes.sJUIFooter;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2252 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2253
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2254 /* The attribute can be in the format of "#id.class", "#id" or "class" This logic
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2255 * breaks the string into parts and applies them as needed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2256 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2257 if ( sAttr.indexOf('.') != -1 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2258 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2259 var aSplit = sAttr.split('.');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2260 nNewNode.id = aSplit[0].substr(1, aSplit[0].length-1);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2261 nNewNode.className = aSplit[1];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2262 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2263 else if ( sAttr.charAt(0) == "#" )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2264 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2265 nNewNode.id = sAttr.substr(1, sAttr.length-1);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2266 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2267 else
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2268 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2269 nNewNode.className = sAttr;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2270 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2271
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2272 i += j; /* Move along the position array */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2273 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2274
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2275 insert.append( nNewNode );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2276 insert = $(nNewNode);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2277 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2278 else if ( cOption == '>' )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2279 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2280 /* End container div */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2281 insert = insert.parent();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2282 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2283 // @todo Move options into their own plugins?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2284 else if ( cOption == 'l' && features.bPaginate && features.bLengthChange )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2285 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2286 /* Length */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2287 featureNode = _fnFeatureHtmlLength( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2288 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2289 else if ( cOption == 'f' && features.bFilter )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2290 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2291 /* Filter */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2292 featureNode = _fnFeatureHtmlFilter( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2293 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2294 else if ( cOption == 'r' && features.bProcessing )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2295 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2296 /* pRocessing */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2297 featureNode = _fnFeatureHtmlProcessing( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2298 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2299 else if ( cOption == 't' )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2300 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2301 /* Table */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2302 featureNode = _fnFeatureHtmlTable( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2303 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2304 else if ( cOption == 'i' && features.bInfo )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2305 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2306 /* Info */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2307 featureNode = _fnFeatureHtmlInfo( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2308 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2309 else if ( cOption == 'p' && features.bPaginate )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2310 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2311 /* Pagination */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2312 featureNode = _fnFeatureHtmlPaginate( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2313 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2314 else if ( DataTable.ext.feature.length !== 0 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2315 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2316 /* Plug-in features */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2317 var aoFeatures = DataTable.ext.feature;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2318 for ( var k=0, kLen=aoFeatures.length ; k<kLen ; k++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2319 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2320 if ( cOption == aoFeatures[k].cFeature )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2321 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2322 featureNode = aoFeatures[k].fnInit( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2323 break;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2324 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2325 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2326 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2327
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2328 /* Add to the 2D features array */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2329 if ( featureNode )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2330 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2331 var aanFeatures = oSettings.aanFeatures;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2332
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2333 if ( ! aanFeatures[cOption] )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2334 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2335 aanFeatures[cOption] = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2336 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2337
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2338 aanFeatures[cOption].push( featureNode );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2339 insert.append( featureNode );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2340 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2341 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2342
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2343 /* Built our DOM structure - replace the holding div with what we want */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2344 holding.replaceWith( insert );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2345 oSettings.nHolding = null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2346 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2347
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2348
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2349 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2350 * Use the DOM source to create up an array of header cells. The idea here is to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2351 * create a layout grid (array) of rows x columns, which contains a reference
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2352 * to the cell that that point in the grid (regardless of col/rowspan), such that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2353 * any column / row could be removed and the new grid constructed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2354 * @param array {object} aLayout Array to store the calculated layout in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2355 * @param {node} nThead The header/footer element for the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2356 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2357 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2358 function _fnDetectHeader ( aLayout, nThead )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2359 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2360 var nTrs = $(nThead).children('tr');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2361 var nTr, nCell;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2362 var i, k, l, iLen, jLen, iColShifted, iColumn, iColspan, iRowspan;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2363 var bUnique;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2364 var fnShiftCol = function ( a, i, j ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2365 var k = a[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2366 while ( k[j] ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2367 j++;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2368 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2369 return j;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2370 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2371
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2372 aLayout.splice( 0, aLayout.length );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2373
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2374 /* We know how many rows there are in the layout - so prep it */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2375 for ( i=0, iLen=nTrs.length ; i<iLen ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2376 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2377 aLayout.push( [] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2378 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2379
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2380 /* Calculate a layout array */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2381 for ( i=0, iLen=nTrs.length ; i<iLen ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2382 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2383 nTr = nTrs[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2384 iColumn = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2385
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2386 /* For every cell in the row... */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2387 nCell = nTr.firstChild;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2388 while ( nCell ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2389 if ( nCell.nodeName.toUpperCase() == "TD" ||
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2390 nCell.nodeName.toUpperCase() == "TH" )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2391 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2392 /* Get the col and rowspan attributes from the DOM and sanitise them */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2393 iColspan = nCell.getAttribute('colspan') * 1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2394 iRowspan = nCell.getAttribute('rowspan') * 1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2395 iColspan = (!iColspan || iColspan===0 || iColspan===1) ? 1 : iColspan;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2396 iRowspan = (!iRowspan || iRowspan===0 || iRowspan===1) ? 1 : iRowspan;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2397
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2398 /* There might be colspan cells already in this row, so shift our target
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2399 * accordingly
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2400 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2401 iColShifted = fnShiftCol( aLayout, i, iColumn );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2402
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2403 /* Cache calculation for unique columns */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2404 bUnique = iColspan === 1 ? true : false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2405
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2406 /* If there is col / rowspan, copy the information into the layout grid */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2407 for ( l=0 ; l<iColspan ; l++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2408 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2409 for ( k=0 ; k<iRowspan ; k++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2410 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2411 aLayout[i+k][iColShifted+l] = {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2412 "cell": nCell,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2413 "unique": bUnique
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2414 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2415 aLayout[i+k].nTr = nTr;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2416 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2417 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2418 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2419 nCell = nCell.nextSibling;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2420 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2421 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2422 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2423
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2424
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2425 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2426 * Get an array of unique th elements, one for each column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2427 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2428 * @param {node} nHeader automatically detect the layout from this node - optional
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2429 * @param {array} aLayout thead/tfoot layout from _fnDetectHeader - optional
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2430 * @returns array {node} aReturn list of unique th's
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2431 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2432 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2433 function _fnGetUniqueThs ( oSettings, nHeader, aLayout )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2434 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2435 var aReturn = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2436 if ( !aLayout )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2437 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2438 aLayout = oSettings.aoHeader;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2439 if ( nHeader )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2440 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2441 aLayout = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2442 _fnDetectHeader( aLayout, nHeader );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2443 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2444 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2445
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2446 for ( var i=0, iLen=aLayout.length ; i<iLen ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2447 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2448 for ( var j=0, jLen=aLayout[i].length ; j<jLen ; j++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2449 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2450 if ( aLayout[i][j].unique &&
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2451 (!aReturn[j] || !oSettings.bSortCellsTop) )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2452 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2453 aReturn[j] = aLayout[i][j].cell;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2454 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2455 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2456 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2457
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2458 return aReturn;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2459 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2460
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2461 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2462 * Create an Ajax call based on the table's settings, taking into account that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2463 * parameters can have multiple forms, and backwards compatibility.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2464 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2465 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2466 * @param {array} data Data to send to the server, required by
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2467 * DataTables - may be augmented by developer callbacks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2468 * @param {function} fn Callback function to run when data is obtained
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2469 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2470 function _fnBuildAjax( oSettings, data, fn )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2471 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2472 // Compatibility with 1.9-, allow fnServerData and event to manipulate
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2473 _fnCallbackFire( oSettings, 'aoServerParams', 'serverParams', [data] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2474
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2475 // Convert to object based for 1.10+ if using the old array scheme which can
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2476 // come from server-side processing or serverParams
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2477 if ( data && $.isArray(data) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2478 var tmp = {};
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2479 var rbracket = /(.*?)\[\]$/;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2480
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2481 $.each( data, function (key, val) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2482 var match = val.name.match(rbracket);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2483
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2484 if ( match ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2485 // Support for arrays
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2486 var name = match[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2487
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2488 if ( ! tmp[ name ] ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2489 tmp[ name ] = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2490 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2491 tmp[ name ].push( val.value );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2492 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2493 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2494 tmp[val.name] = val.value;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2495 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2496 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2497 data = tmp;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2498 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2499
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2500 var ajaxData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2501 var ajax = oSettings.ajax;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2502 var instance = oSettings.oInstance;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2503 var callback = function ( json ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2504 _fnCallbackFire( oSettings, null, 'xhr', [oSettings, json, oSettings.jqXHR] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2505 fn( json );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2506 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2507
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2508 if ( $.isPlainObject( ajax ) && ajax.data )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2509 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2510 ajaxData = ajax.data;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2511
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2512 var newData = $.isFunction( ajaxData ) ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2513 ajaxData( data, oSettings ) : // fn can manipulate data or return
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2514 ajaxData; // an object object or array to merge
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2515
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2516 // If the function returned something, use that alone
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2517 data = $.isFunction( ajaxData ) && newData ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2518 newData :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2519 $.extend( true, data, newData );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2520
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2521 // Remove the data property as we've resolved it already and don't want
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2522 // jQuery to do it again (it is restored at the end of the function)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2523 delete ajax.data;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2524 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2525
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2526 var baseAjax = {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2527 "data": data,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2528 "success": function (json) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2529 var error = json.error || json.sError;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2530 if ( error ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2531 _fnLog( oSettings, 0, error );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2532 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2533
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2534 oSettings.json = json;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2535 callback( json );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2536 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2537 "dataType": "json",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2538 "cache": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2539 "type": oSettings.sServerMethod,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2540 "error": function (xhr, error, thrown) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2541 var ret = _fnCallbackFire( oSettings, null, 'xhr', [oSettings, null, oSettings.jqXHR] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2542
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2543 if ( $.inArray( true, ret ) === -1 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2544 if ( error == "parsererror" ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2545 _fnLog( oSettings, 0, 'Invalid JSON response', 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2546 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2547 else if ( xhr.readyState === 4 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2548 _fnLog( oSettings, 0, 'Ajax error', 7 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2549 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2550 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2551
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2552 _fnProcessingDisplay( oSettings, false );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2553 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2554 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2555
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2556 // Store the data submitted for the API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2557 oSettings.oAjaxData = data;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2558
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2559 // Allow plug-ins and external processes to modify the data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2560 _fnCallbackFire( oSettings, null, 'preXhr', [oSettings, data] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2561
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2562 if ( oSettings.fnServerData )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2563 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2564 // DataTables 1.9- compatibility
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2565 oSettings.fnServerData.call( instance,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2566 oSettings.sAjaxSource,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2567 $.map( data, function (val, key) { // Need to convert back to 1.9 trad format
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2568 return { name: key, value: val };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2569 } ),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2570 callback,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2571 oSettings
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2572 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2573 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2574 else if ( oSettings.sAjaxSource || typeof ajax === 'string' )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2575 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2576 // DataTables 1.9- compatibility
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2577 oSettings.jqXHR = $.ajax( $.extend( baseAjax, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2578 url: ajax || oSettings.sAjaxSource
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2579 } ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2580 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2581 else if ( $.isFunction( ajax ) )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2582 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2583 // Is a function - let the caller define what needs to be done
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2584 oSettings.jqXHR = ajax.call( instance, data, callback, oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2585 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2586 else
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2587 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2588 // Object to extend the base settings
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2589 oSettings.jqXHR = $.ajax( $.extend( baseAjax, ajax ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2590
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2591 // Restore for next time around
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2592 ajax.data = ajaxData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2593 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2594 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2595
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2596
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2597 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2598 * Update the table using an Ajax call
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2599 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2600 * @returns {boolean} Block the table drawing or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2601 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2602 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2603 function _fnAjaxUpdate( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2604 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2605 if ( settings.bAjaxDataGet ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2606 settings.iDraw++;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2607 _fnProcessingDisplay( settings, true );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2608
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2609 _fnBuildAjax(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2610 settings,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2611 _fnAjaxParameters( settings ),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2612 function(json) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2613 _fnAjaxUpdateDraw( settings, json );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2614 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2615 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2616
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2617 return false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2618 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2619 return true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2620 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2621
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2622
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2623 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2624 * Build up the parameters in an object needed for a server-side processing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2625 * request. Note that this is basically done twice, is different ways - a modern
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2626 * method which is used by default in DataTables 1.10 which uses objects and
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2627 * arrays, or the 1.9- method with is name / value pairs. 1.9 method is used if
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2628 * the sAjaxSource option is used in the initialisation, or the legacyAjax
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2629 * option is set.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2630 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2631 * @returns {bool} block the table drawing or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2632 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2633 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2634 function _fnAjaxParameters( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2635 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2636 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2637 columns = settings.aoColumns,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2638 columnCount = columns.length,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2639 features = settings.oFeatures,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2640 preSearch = settings.oPreviousSearch,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2641 preColSearch = settings.aoPreSearchCols,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2642 i, data = [], dataProp, column, columnSearch,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2643 sort = _fnSortFlatten( settings ),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2644 displayStart = settings._iDisplayStart,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2645 displayLength = features.bPaginate !== false ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2646 settings._iDisplayLength :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2647 -1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2648
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2649 var param = function ( name, value ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2650 data.push( { 'name': name, 'value': value } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2651 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2652
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2653 // DataTables 1.9- compatible method
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2654 param( 'sEcho', settings.iDraw );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2655 param( 'iColumns', columnCount );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2656 param( 'sColumns', _pluck( columns, 'sName' ).join(',') );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2657 param( 'iDisplayStart', displayStart );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2658 param( 'iDisplayLength', displayLength );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2659
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2660 // DataTables 1.10+ method
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2661 var d = {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2662 draw: settings.iDraw,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2663 columns: [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2664 order: [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2665 start: displayStart,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2666 length: displayLength,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2667 search: {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2668 value: preSearch.sSearch,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2669 regex: preSearch.bRegex
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2670 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2671 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2672
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2673 for ( i=0 ; i<columnCount ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2674 column = columns[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2675 columnSearch = preColSearch[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2676 dataProp = typeof column.mData=="function" ? 'function' : column.mData ;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2677
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2678 d.columns.push( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2679 data: dataProp,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2680 name: column.sName,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2681 searchable: column.bSearchable,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2682 orderable: column.bSortable,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2683 search: {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2684 value: columnSearch.sSearch,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2685 regex: columnSearch.bRegex
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2686 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2687 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2688
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2689 param( "mDataProp_"+i, dataProp );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2690
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2691 if ( features.bFilter ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2692 param( 'sSearch_'+i, columnSearch.sSearch );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2693 param( 'bRegex_'+i, columnSearch.bRegex );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2694 param( 'bSearchable_'+i, column.bSearchable );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2695 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2696
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2697 if ( features.bSort ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2698 param( 'bSortable_'+i, column.bSortable );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2699 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2700 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2701
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2702 if ( features.bFilter ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2703 param( 'sSearch', preSearch.sSearch );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2704 param( 'bRegex', preSearch.bRegex );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2705 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2706
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2707 if ( features.bSort ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2708 $.each( sort, function ( i, val ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2709 d.order.push( { column: val.col, dir: val.dir } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2710
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2711 param( 'iSortCol_'+i, val.col );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2712 param( 'sSortDir_'+i, val.dir );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2713 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2714
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2715 param( 'iSortingCols', sort.length );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2716 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2717
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2718 // If the legacy.ajax parameter is null, then we automatically decide which
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2719 // form to use, based on sAjaxSource
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2720 var legacy = DataTable.ext.legacy.ajax;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2721 if ( legacy === null ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2722 return settings.sAjaxSource ? data : d;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2723 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2724
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2725 // Otherwise, if legacy has been specified then we use that to decide on the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2726 // form
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2727 return legacy ? data : d;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2728 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2729
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2730
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2731 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2732 * Data the data from the server (nuking the old) and redraw the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2733 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2734 * @param {object} json json data return from the server.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2735 * @param {string} json.sEcho Tracking flag for DataTables to match requests
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2736 * @param {int} json.iTotalRecords Number of records in the data set, not accounting for filtering
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2737 * @param {int} json.iTotalDisplayRecords Number of records in the data set, accounting for filtering
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2738 * @param {array} json.aaData The data to display on this page
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2739 * @param {string} [json.sColumns] Column ordering (sName, comma separated)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2740 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2741 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2742 function _fnAjaxUpdateDraw ( settings, json )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2743 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2744 // v1.10 uses camelCase variables, while 1.9 uses Hungarian notation.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2745 // Support both
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2746 var compat = function ( old, modern ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2747 return json[old] !== undefined ? json[old] : json[modern];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2748 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2749
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2750 var data = _fnAjaxDataSrc( settings, json );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2751 var draw = compat( 'sEcho', 'draw' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2752 var recordsTotal = compat( 'iTotalRecords', 'recordsTotal' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2753 var recordsFiltered = compat( 'iTotalDisplayRecords', 'recordsFiltered' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2754
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2755 if ( draw ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2756 // Protect against out of sequence returns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2757 if ( draw*1 < settings.iDraw ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2758 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2759 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2760 settings.iDraw = draw * 1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2761 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2762
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2763 _fnClearTable( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2764 settings._iRecordsTotal = parseInt(recordsTotal, 10);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2765 settings._iRecordsDisplay = parseInt(recordsFiltered, 10);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2766
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2767 for ( var i=0, ien=data.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2768 _fnAddData( settings, data[i] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2769 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2770 settings.aiDisplay = settings.aiDisplayMaster.slice();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2771
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2772 settings.bAjaxDataGet = false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2773 _fnDraw( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2774
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2775 if ( ! settings._bInitComplete ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2776 _fnInitComplete( settings, json );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2777 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2778
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2779 settings.bAjaxDataGet = true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2780 _fnProcessingDisplay( settings, false );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2781 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2782
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2783
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2784 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2785 * Get the data from the JSON data source to use for drawing a table. Using
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2786 * `_fnGetObjectDataFn` allows the data to be sourced from a property of the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2787 * source object, or from a processing function.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2788 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2789 * @param {object} json Data source object / array from the server
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2790 * @return {array} Array of data to use
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2791 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2792 function _fnAjaxDataSrc ( oSettings, json )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2793 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2794 var dataSrc = $.isPlainObject( oSettings.ajax ) && oSettings.ajax.dataSrc !== undefined ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2795 oSettings.ajax.dataSrc :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2796 oSettings.sAjaxDataProp; // Compatibility with 1.9-.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2797
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2798 // Compatibility with 1.9-. In order to read from aaData, check if the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2799 // default has been changed, if not, check for aaData
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2800 if ( dataSrc === 'data' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2801 return json.aaData || json[dataSrc];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2802 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2803
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2804 return dataSrc !== "" ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2805 _fnGetObjectDataFn( dataSrc )( json ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2806 json;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2807 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2808
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2809 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2810 * Generate the node required for filtering text
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2811 * @returns {node} Filter control element
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2812 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2813 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2814 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2815 function _fnFeatureHtmlFilter ( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2816 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2817 var classes = settings.oClasses;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2818 var tableId = settings.sTableId;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2819 var language = settings.oLanguage;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2820 var previousSearch = settings.oPreviousSearch;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2821 var features = settings.aanFeatures;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2822 var input = '<input type="search" class="'+classes.sFilterInput+'"/>';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2823
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2824 var str = language.sSearch;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2825 str = str.match(/_INPUT_/) ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2826 str.replace('_INPUT_', input) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2827 str+input;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2828
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2829 var filter = $('<div/>', {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2830 'id': ! features.f ? tableId+'_filter' : null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2831 'class': classes.sFilter
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2832 } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2833 .append( $('<label/>' ).append( str ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2834
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2835 var searchFn = function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2836 /* Update all other filter input elements for the new display */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2837 var n = features.f;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2838 var val = !this.value ? "" : this.value; // mental IE8 fix :-(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2839
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2840 /* Now do the filter */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2841 if ( val != previousSearch.sSearch ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2842 _fnFilterComplete( settings, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2843 "sSearch": val,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2844 "bRegex": previousSearch.bRegex,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2845 "bSmart": previousSearch.bSmart ,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2846 "bCaseInsensitive": previousSearch.bCaseInsensitive
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2847 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2848
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2849 // Need to redraw, without resorting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2850 settings._iDisplayStart = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2851 _fnDraw( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2852 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2853 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2854
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2855 var searchDelay = settings.searchDelay !== null ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2856 settings.searchDelay :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2857 _fnDataSource( settings ) === 'ssp' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2858 400 :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2859 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2860
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2861 var jqFilter = $('input', filter)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2862 .val( previousSearch.sSearch )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2863 .attr( 'placeholder', language.sSearchPlaceholder )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2864 .bind(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2865 'keyup.DT search.DT input.DT paste.DT cut.DT',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2866 searchDelay ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2867 _fnThrottle( searchFn, searchDelay ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2868 searchFn
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2869 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2870 .bind( 'keypress.DT', function(e) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2871 /* Prevent form submission */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2872 if ( e.keyCode == 13 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2873 return false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2874 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2875 } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2876 .attr('aria-controls', tableId);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2877
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2878 // Update the input elements whenever the table is filtered
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2879 $(settings.nTable).on( 'search.dt.DT', function ( ev, s ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2880 if ( settings === s ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2881 // IE9 throws an 'unknown error' if document.activeElement is used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2882 // inside an iframe or frame...
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2883 try {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2884 if ( jqFilter[0] !== document.activeElement ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2885 jqFilter.val( previousSearch.sSearch );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2886 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2887 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2888 catch ( e ) {}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2889 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2890 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2891
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2892 return filter[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2893 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2894
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2895
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2896 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2897 * Filter the table using both the global filter and column based filtering
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2898 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2899 * @param {object} oSearch search information
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2900 * @param {int} [iForce] force a research of the master array (1) or not (undefined or 0)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2901 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2902 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2903 function _fnFilterComplete ( oSettings, oInput, iForce )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2904 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2905 var oPrevSearch = oSettings.oPreviousSearch;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2906 var aoPrevSearch = oSettings.aoPreSearchCols;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2907 var fnSaveFilter = function ( oFilter ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2908 /* Save the filtering values */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2909 oPrevSearch.sSearch = oFilter.sSearch;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2910 oPrevSearch.bRegex = oFilter.bRegex;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2911 oPrevSearch.bSmart = oFilter.bSmart;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2912 oPrevSearch.bCaseInsensitive = oFilter.bCaseInsensitive;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2913 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2914 var fnRegex = function ( o ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2915 // Backwards compatibility with the bEscapeRegex option
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2916 return o.bEscapeRegex !== undefined ? !o.bEscapeRegex : o.bRegex;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2917 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2918
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2919 // Resolve any column types that are unknown due to addition or invalidation
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2920 // @todo As per sort - can this be moved into an event handler?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2921 _fnColumnTypes( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2922
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2923 /* In server-side processing all filtering is done by the server, so no point hanging around here */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2924 if ( _fnDataSource( oSettings ) != 'ssp' )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2925 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2926 /* Global filter */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2927 _fnFilter( oSettings, oInput.sSearch, iForce, fnRegex(oInput), oInput.bSmart, oInput.bCaseInsensitive );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2928 fnSaveFilter( oInput );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2929
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2930 /* Now do the individual column filter */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2931 for ( var i=0 ; i<aoPrevSearch.length ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2932 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2933 _fnFilterColumn( oSettings, aoPrevSearch[i].sSearch, i, fnRegex(aoPrevSearch[i]),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2934 aoPrevSearch[i].bSmart, aoPrevSearch[i].bCaseInsensitive );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2935 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2936
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2937 /* Custom filtering */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2938 _fnFilterCustom( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2939 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2940 else
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2941 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2942 fnSaveFilter( oInput );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2943 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2944
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2945 /* Tell the draw function we have been filtering */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2946 oSettings.bFiltered = true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2947 _fnCallbackFire( oSettings, null, 'search', [oSettings] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2948 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2949
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2950
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2951 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2952 * Apply custom filtering functions
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2953 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2954 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2955 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2956 function _fnFilterCustom( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2957 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2958 var filters = DataTable.ext.search;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2959 var displayRows = settings.aiDisplay;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2960 var row, rowIdx;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2961
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2962 for ( var i=0, ien=filters.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2963 var rows = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2964
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2965 // Loop over each row and see if it should be included
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2966 for ( var j=0, jen=displayRows.length ; j<jen ; j++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2967 rowIdx = displayRows[ j ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2968 row = settings.aoData[ rowIdx ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2969
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2970 if ( filters[i]( settings, row._aFilterData, rowIdx, row._aData, j ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2971 rows.push( rowIdx );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2972 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2973 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2974
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2975 // So the array reference doesn't break set the results into the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2976 // existing array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2977 displayRows.length = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2978 $.merge( displayRows, rows );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2979 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2980 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2981
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2982
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2983 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2984 * Filter the table on a per-column basis
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2985 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2986 * @param {string} sInput string to filter on
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2987 * @param {int} iColumn column to filter
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2988 * @param {bool} bRegex treat search string as a regular expression or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2989 * @param {bool} bSmart use smart filtering or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2990 * @param {bool} bCaseInsensitive Do case insenstive matching or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2991 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2992 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2993 function _fnFilterColumn ( settings, searchStr, colIdx, regex, smart, caseInsensitive )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2994 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2995 if ( searchStr === '' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2996 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2997 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2998
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
2999 var data;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3000 var display = settings.aiDisplay;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3001 var rpSearch = _fnFilterCreateSearch( searchStr, regex, smart, caseInsensitive );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3002
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3003 for ( var i=display.length-1 ; i>=0 ; i-- ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3004 data = settings.aoData[ display[i] ]._aFilterData[ colIdx ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3005
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3006 if ( ! rpSearch.test( data ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3007 display.splice( i, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3008 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3009 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3010 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3011
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3012
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3013 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3014 * Filter the data table based on user input and draw the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3015 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3016 * @param {string} input string to filter on
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3017 * @param {int} force optional - force a research of the master array (1) or not (undefined or 0)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3018 * @param {bool} regex treat as a regular expression or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3019 * @param {bool} smart perform smart filtering or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3020 * @param {bool} caseInsensitive Do case insenstive matching or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3021 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3022 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3023 function _fnFilter( settings, input, force, regex, smart, caseInsensitive )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3024 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3025 var rpSearch = _fnFilterCreateSearch( input, regex, smart, caseInsensitive );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3026 var prevSearch = settings.oPreviousSearch.sSearch;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3027 var displayMaster = settings.aiDisplayMaster;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3028 var display, invalidated, i;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3029
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3030 // Need to take account of custom filtering functions - always filter
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3031 if ( DataTable.ext.search.length !== 0 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3032 force = true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3033 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3034
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3035 // Check if any of the rows were invalidated
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3036 invalidated = _fnFilterData( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3037
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3038 // If the input is blank - we just want the full data set
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3039 if ( input.length <= 0 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3040 settings.aiDisplay = displayMaster.slice();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3041 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3042 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3043 // New search - start from the master array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3044 if ( invalidated ||
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3045 force ||
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3046 prevSearch.length > input.length ||
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3047 input.indexOf(prevSearch) !== 0 ||
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3048 settings.bSorted // On resort, the display master needs to be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3049 // re-filtered since indexes will have changed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3050 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3051 settings.aiDisplay = displayMaster.slice();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3052 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3053
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3054 // Search the display array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3055 display = settings.aiDisplay;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3056
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3057 for ( i=display.length-1 ; i>=0 ; i-- ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3058 if ( ! rpSearch.test( settings.aoData[ display[i] ]._sFilterRow ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3059 display.splice( i, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3060 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3061 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3062 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3063 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3064
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3065
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3066 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3067 * Build a regular expression object suitable for searching a table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3068 * @param {string} sSearch string to search for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3069 * @param {bool} bRegex treat as a regular expression or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3070 * @param {bool} bSmart perform smart filtering or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3071 * @param {bool} bCaseInsensitive Do case insensitive matching or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3072 * @returns {RegExp} constructed object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3073 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3074 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3075 function _fnFilterCreateSearch( search, regex, smart, caseInsensitive )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3076 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3077 search = regex ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3078 search :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3079 _fnEscapeRegex( search );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3080
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3081 if ( smart ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3082 /* For smart filtering we want to allow the search to work regardless of
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3083 * word order. We also want double quoted text to be preserved, so word
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3084 * order is important - a la google. So this is what we want to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3085 * generate:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3086 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3087 * ^(?=.*?\bone\b)(?=.*?\btwo three\b)(?=.*?\bfour\b).*$
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3088 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3089 var a = $.map( search.match( /"[^"]+"|[^ ]+/g ) || [''], function ( word ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3090 if ( word.charAt(0) === '"' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3091 var m = word.match( /^"(.*)"$/ );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3092 word = m ? m[1] : word;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3093 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3094
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3095 return word.replace('"', '');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3096 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3097
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3098 search = '^(?=.*?'+a.join( ')(?=.*?' )+').*$';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3099 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3100
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3101 return new RegExp( search, caseInsensitive ? 'i' : '' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3102 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3103
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3104
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3105 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3106 * Escape a string such that it can be used in a regular expression
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3107 * @param {string} sVal string to escape
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3108 * @returns {string} escaped string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3109 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3110 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3111 function _fnEscapeRegex ( sVal )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3112 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3113 return sVal.replace( _re_escape_regex, '\\$1' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3114 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3115
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3116
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3117
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3118 var __filter_div = $('<div>')[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3119 var __filter_div_textContent = __filter_div.textContent !== undefined;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3120
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3121 // Update the filtering data for each row if needed (by invalidation or first run)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3122 function _fnFilterData ( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3123 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3124 var columns = settings.aoColumns;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3125 var column;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3126 var i, j, ien, jen, filterData, cellData, row;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3127 var fomatters = DataTable.ext.type.search;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3128 var wasInvalidated = false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3129
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3130 for ( i=0, ien=settings.aoData.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3131 row = settings.aoData[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3132
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3133 if ( ! row._aFilterData ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3134 filterData = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3135
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3136 for ( j=0, jen=columns.length ; j<jen ; j++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3137 column = columns[j];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3138
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3139 if ( column.bSearchable ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3140 cellData = _fnGetCellData( settings, i, j, 'filter' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3141
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3142 if ( fomatters[ column.sType ] ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3143 cellData = fomatters[ column.sType ]( cellData );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3144 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3145
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3146 // Search in DataTables 1.10 is string based. In 1.11 this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3147 // should be altered to also allow strict type checking.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3148 if ( cellData === null ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3149 cellData = '';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3150 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3151
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3152 if ( typeof cellData !== 'string' && cellData.toString ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3153 cellData = cellData.toString();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3154 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3155 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3156 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3157 cellData = '';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3158 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3159
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3160 // If it looks like there is an HTML entity in the string,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3161 // attempt to decode it so sorting works as expected. Note that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3162 // we could use a single line of jQuery to do this, but the DOM
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3163 // method used here is much faster http://jsperf.com/html-decode
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3164 if ( cellData.indexOf && cellData.indexOf('&') !== -1 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3165 __filter_div.innerHTML = cellData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3166 cellData = __filter_div_textContent ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3167 __filter_div.textContent :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3168 __filter_div.innerText;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3169 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3170
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3171 if ( cellData.replace ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3172 cellData = cellData.replace(/[\r\n]/g, '');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3173 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3174
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3175 filterData.push( cellData );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3176 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3177
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3178 row._aFilterData = filterData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3179 row._sFilterRow = filterData.join(' ');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3180 wasInvalidated = true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3181 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3182 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3183
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3184 return wasInvalidated;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3185 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3186
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3187
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3188 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3189 * Convert from the internal Hungarian notation to camelCase for external
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3190 * interaction
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3191 * @param {object} obj Object to convert
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3192 * @returns {object} Inverted object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3193 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3194 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3195 function _fnSearchToCamel ( obj )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3196 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3197 return {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3198 search: obj.sSearch,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3199 smart: obj.bSmart,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3200 regex: obj.bRegex,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3201 caseInsensitive: obj.bCaseInsensitive
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3202 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3203 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3204
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3205
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3206
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3207 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3208 * Convert from camelCase notation to the internal Hungarian. We could use the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3209 * Hungarian convert function here, but this is cleaner
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3210 * @param {object} obj Object to convert
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3211 * @returns {object} Inverted object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3212 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3213 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3214 function _fnSearchToHung ( obj )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3215 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3216 return {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3217 sSearch: obj.search,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3218 bSmart: obj.smart,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3219 bRegex: obj.regex,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3220 bCaseInsensitive: obj.caseInsensitive
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3221 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3222 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3223
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3224 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3225 * Generate the node required for the info display
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3226 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3227 * @returns {node} Information element
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3228 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3229 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3230 function _fnFeatureHtmlInfo ( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3231 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3232 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3233 tid = settings.sTableId,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3234 nodes = settings.aanFeatures.i,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3235 n = $('<div/>', {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3236 'class': settings.oClasses.sInfo,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3237 'id': ! nodes ? tid+'_info' : null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3238 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3239
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3240 if ( ! nodes ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3241 // Update display on each draw
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3242 settings.aoDrawCallback.push( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3243 "fn": _fnUpdateInfo,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3244 "sName": "information"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3245 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3246
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3247 n
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3248 .attr( 'role', 'status' )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3249 .attr( 'aria-live', 'polite' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3250
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3251 // Table is described by our info div
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3252 $(settings.nTable).attr( 'aria-describedby', tid+'_info' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3253 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3254
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3255 return n[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3256 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3257
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3258
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3259 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3260 * Update the information elements in the display
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3261 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3262 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3263 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3264 function _fnUpdateInfo ( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3265 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3266 /* Show information about the table */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3267 var nodes = settings.aanFeatures.i;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3268 if ( nodes.length === 0 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3269 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3270 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3271
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3272 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3273 lang = settings.oLanguage,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3274 start = settings._iDisplayStart+1,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3275 end = settings.fnDisplayEnd(),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3276 max = settings.fnRecordsTotal(),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3277 total = settings.fnRecordsDisplay(),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3278 out = total ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3279 lang.sInfo :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3280 lang.sInfoEmpty;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3281
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3282 if ( total !== max ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3283 /* Record set after filtering */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3284 out += ' ' + lang.sInfoFiltered;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3285 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3286
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3287 // Convert the macros
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3288 out += lang.sInfoPostFix;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3289 out = _fnInfoMacros( settings, out );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3290
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3291 var callback = lang.fnInfoCallback;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3292 if ( callback !== null ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3293 out = callback.call( settings.oInstance,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3294 settings, start, end, max, total, out
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3295 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3296 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3297
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3298 $(nodes).html( out );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3299 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3300
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3301
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3302 function _fnInfoMacros ( settings, str )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3303 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3304 // When infinite scrolling, we are always starting at 1. _iDisplayStart is used only
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3305 // internally
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3306 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3307 formatter = settings.fnFormatNumber,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3308 start = settings._iDisplayStart+1,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3309 len = settings._iDisplayLength,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3310 vis = settings.fnRecordsDisplay(),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3311 all = len === -1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3312
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3313 return str.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3314 replace(/_START_/g, formatter.call( settings, start ) ).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3315 replace(/_END_/g, formatter.call( settings, settings.fnDisplayEnd() ) ).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3316 replace(/_MAX_/g, formatter.call( settings, settings.fnRecordsTotal() ) ).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3317 replace(/_TOTAL_/g, formatter.call( settings, vis ) ).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3318 replace(/_PAGE_/g, formatter.call( settings, all ? 1 : Math.ceil( start / len ) ) ).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3319 replace(/_PAGES_/g, formatter.call( settings, all ? 1 : Math.ceil( vis / len ) ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3320 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3321
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3322
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3323
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3324 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3325 * Draw the table for the first time, adding all required features
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3326 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3327 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3328 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3329 function _fnInitialise ( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3330 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3331 var i, iLen, iAjaxStart=settings.iInitDisplayStart;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3332 var columns = settings.aoColumns, column;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3333 var features = settings.oFeatures;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3334 var deferLoading = settings.bDeferLoading; // value modified by the draw
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3335
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3336 /* Ensure that the table data is fully initialised */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3337 if ( ! settings.bInitialised ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3338 setTimeout( function(){ _fnInitialise( settings ); }, 200 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3339 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3340 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3341
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3342 /* Show the display HTML options */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3343 _fnAddOptionsHtml( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3344
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3345 /* Build and draw the header / footer for the table */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3346 _fnBuildHead( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3347 _fnDrawHead( settings, settings.aoHeader );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3348 _fnDrawHead( settings, settings.aoFooter );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3349
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3350 /* Okay to show that something is going on now */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3351 _fnProcessingDisplay( settings, true );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3352
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3353 /* Calculate sizes for columns */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3354 if ( features.bAutoWidth ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3355 _fnCalculateColumnWidths( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3356 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3357
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3358 for ( i=0, iLen=columns.length ; i<iLen ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3359 column = columns[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3360
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3361 if ( column.sWidth ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3362 column.nTh.style.width = _fnStringToCss( column.sWidth );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3363 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3364 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3365
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3366 _fnCallbackFire( settings, null, 'preInit', [settings] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3367
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3368 // If there is default sorting required - let's do it. The sort function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3369 // will do the drawing for us. Otherwise we draw the table regardless of the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3370 // Ajax source - this allows the table to look initialised for Ajax sourcing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3371 // data (show 'loading' message possibly)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3372 _fnReDraw( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3373
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3374 // Server-side processing init complete is done by _fnAjaxUpdateDraw
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3375 var dataSrc = _fnDataSource( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3376 if ( dataSrc != 'ssp' || deferLoading ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3377 // if there is an ajax source load the data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3378 if ( dataSrc == 'ajax' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3379 _fnBuildAjax( settings, [], function(json) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3380 var aData = _fnAjaxDataSrc( settings, json );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3381
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3382 // Got the data - add it to the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3383 for ( i=0 ; i<aData.length ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3384 _fnAddData( settings, aData[i] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3385 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3386
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3387 // Reset the init display for cookie saving. We've already done
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3388 // a filter, and therefore cleared it before. So we need to make
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3389 // it appear 'fresh'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3390 settings.iInitDisplayStart = iAjaxStart;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3391
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3392 _fnReDraw( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3393
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3394 _fnProcessingDisplay( settings, false );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3395 _fnInitComplete( settings, json );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3396 }, settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3397 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3398 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3399 _fnProcessingDisplay( settings, false );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3400 _fnInitComplete( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3401 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3402 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3403 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3404
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3405
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3406 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3407 * Draw the table for the first time, adding all required features
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3408 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3409 * @param {object} [json] JSON from the server that completed the table, if using Ajax source
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3410 * with client-side processing (optional)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3411 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3412 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3413 function _fnInitComplete ( settings, json )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3414 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3415 settings._bInitComplete = true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3416
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3417 // When data was added after the initialisation (data or Ajax) we need to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3418 // calculate the column sizing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3419 if ( json || settings.oInit.aaData ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3420 _fnAdjustColumnSizing( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3421 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3422
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3423 _fnCallbackFire( settings, 'aoInitComplete', 'init', [settings, json] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3424 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3425
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3426
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3427 function _fnLengthChange ( settings, val )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3428 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3429 var len = parseInt( val, 10 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3430 settings._iDisplayLength = len;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3431
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3432 _fnLengthOverflow( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3433
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3434 // Fire length change event
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3435 _fnCallbackFire( settings, null, 'length', [settings, len] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3436 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3437
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3438
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3439 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3440 * Generate the node required for user display length changing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3441 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3442 * @returns {node} Display length feature node
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3443 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3444 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3445 function _fnFeatureHtmlLength ( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3446 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3447 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3448 classes = settings.oClasses,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3449 tableId = settings.sTableId,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3450 menu = settings.aLengthMenu,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3451 d2 = $.isArray( menu[0] ),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3452 lengths = d2 ? menu[0] : menu,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3453 language = d2 ? menu[1] : menu;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3454
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3455 var select = $('<select/>', {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3456 'name': tableId+'_length',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3457 'aria-controls': tableId,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3458 'class': classes.sLengthSelect
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3459 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3460
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3461 for ( var i=0, ien=lengths.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3462 select[0][ i ] = new Option( language[i], lengths[i] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3463 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3464
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3465 var div = $('<div><label/></div>').addClass( classes.sLength );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3466 if ( ! settings.aanFeatures.l ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3467 div[0].id = tableId+'_length';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3468 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3469
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3470 div.children().append(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3471 settings.oLanguage.sLengthMenu.replace( '_MENU_', select[0].outerHTML )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3472 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3473
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3474 // Can't use `select` variable as user might provide their own and the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3475 // reference is broken by the use of outerHTML
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3476 $('select', div)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3477 .val( settings._iDisplayLength )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3478 .bind( 'change.DT', function(e) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3479 _fnLengthChange( settings, $(this).val() );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3480 _fnDraw( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3481 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3482
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3483 // Update node value whenever anything changes the table's length
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3484 $(settings.nTable).bind( 'length.dt.DT', function (e, s, len) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3485 if ( settings === s ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3486 $('select', div).val( len );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3487 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3488 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3489
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3490 return div[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3491 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3492
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3493
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3494
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3495 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3496 * Note that most of the paging logic is done in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3497 * DataTable.ext.pager
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3498 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3499
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3500 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3501 * Generate the node required for default pagination
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3502 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3503 * @returns {node} Pagination feature node
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3504 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3505 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3506 function _fnFeatureHtmlPaginate ( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3507 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3508 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3509 type = settings.sPaginationType,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3510 plugin = DataTable.ext.pager[ type ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3511 modern = typeof plugin === 'function',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3512 redraw = function( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3513 _fnDraw( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3514 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3515 node = $('<div/>').addClass( settings.oClasses.sPaging + type )[0],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3516 features = settings.aanFeatures;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3517
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3518 if ( ! modern ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3519 plugin.fnInit( settings, node, redraw );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3520 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3521
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3522 /* Add a draw callback for the pagination on first instance, to update the paging display */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3523 if ( ! features.p )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3524 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3525 node.id = settings.sTableId+'_paginate';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3526
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3527 settings.aoDrawCallback.push( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3528 "fn": function( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3529 if ( modern ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3530 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3531 start = settings._iDisplayStart,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3532 len = settings._iDisplayLength,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3533 visRecords = settings.fnRecordsDisplay(),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3534 all = len === -1,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3535 page = all ? 0 : Math.ceil( start / len ),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3536 pages = all ? 1 : Math.ceil( visRecords / len ),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3537 buttons = plugin(page, pages),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3538 i, ien;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3539
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3540 for ( i=0, ien=features.p.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3541 _fnRenderer( settings, 'pageButton' )(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3542 settings, features.p[i], i, buttons, page, pages
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3543 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3544 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3545 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3546 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3547 plugin.fnUpdate( settings, redraw );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3548 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3549 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3550 "sName": "pagination"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3551 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3552 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3553
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3554 return node;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3555 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3556
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3557
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3558 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3559 * Alter the display settings to change the page
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3560 * @param {object} settings DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3561 * @param {string|int} action Paging action to take: "first", "previous",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3562 * "next" or "last" or page number to jump to (integer)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3563 * @param [bool] redraw Automatically draw the update or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3564 * @returns {bool} true page has changed, false - no change
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3565 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3566 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3567 function _fnPageChange ( settings, action, redraw )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3568 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3569 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3570 start = settings._iDisplayStart,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3571 len = settings._iDisplayLength,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3572 records = settings.fnRecordsDisplay();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3573
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3574 if ( records === 0 || len === -1 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3575 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3576 start = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3577 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3578 else if ( typeof action === "number" )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3579 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3580 start = action * len;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3581
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3582 if ( start > records )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3583 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3584 start = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3585 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3586 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3587 else if ( action == "first" )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3588 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3589 start = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3590 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3591 else if ( action == "previous" )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3592 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3593 start = len >= 0 ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3594 start - len :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3595 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3596
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3597 if ( start < 0 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3598 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3599 start = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3600 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3601 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3602 else if ( action == "next" )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3603 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3604 if ( start + len < records )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3605 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3606 start += len;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3607 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3608 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3609 else if ( action == "last" )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3610 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3611 start = Math.floor( (records-1) / len) * len;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3612 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3613 else
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3614 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3615 _fnLog( settings, 0, "Unknown paging action: "+action, 5 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3616 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3617
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3618 var changed = settings._iDisplayStart !== start;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3619 settings._iDisplayStart = start;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3620
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3621 if ( changed ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3622 _fnCallbackFire( settings, null, 'page', [settings] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3623
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3624 if ( redraw ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3625 _fnDraw( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3626 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3627 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3628
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3629 return changed;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3630 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3631
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3632
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3633
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3634 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3635 * Generate the node required for the processing node
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3636 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3637 * @returns {node} Processing element
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3638 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3639 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3640 function _fnFeatureHtmlProcessing ( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3641 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3642 return $('<div/>', {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3643 'id': ! settings.aanFeatures.r ? settings.sTableId+'_processing' : null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3644 'class': settings.oClasses.sProcessing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3645 } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3646 .html( settings.oLanguage.sProcessing )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3647 .insertBefore( settings.nTable )[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3648 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3649
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3650
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3651 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3652 * Display or hide the processing indicator
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3653 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3654 * @param {bool} show Show the processing indicator (true) or not (false)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3655 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3656 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3657 function _fnProcessingDisplay ( settings, show )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3658 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3659 if ( settings.oFeatures.bProcessing ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3660 $(settings.aanFeatures.r).css( 'display', show ? 'block' : 'none' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3661 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3662
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3663 _fnCallbackFire( settings, null, 'processing', [settings, show] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3664 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3665
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3666 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3667 * Add any control elements for the table - specifically scrolling
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3668 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3669 * @returns {node} Node to add to the DOM
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3670 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3671 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3672 function _fnFeatureHtmlTable ( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3673 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3674 var table = $(settings.nTable);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3675
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3676 // Add the ARIA grid role to the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3677 table.attr( 'role', 'grid' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3678
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3679 // Scrolling from here on in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3680 var scroll = settings.oScroll;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3681
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3682 if ( scroll.sX === '' && scroll.sY === '' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3683 return settings.nTable;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3684 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3685
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3686 var scrollX = scroll.sX;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3687 var scrollY = scroll.sY;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3688 var classes = settings.oClasses;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3689 var caption = table.children('caption');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3690 var captionSide = caption.length ? caption[0]._captionSide : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3691 var headerClone = $( table[0].cloneNode(false) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3692 var footerClone = $( table[0].cloneNode(false) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3693 var footer = table.children('tfoot');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3694 var _div = '<div/>';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3695 var size = function ( s ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3696 return !s ? null : _fnStringToCss( s );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3697 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3698
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3699 // This is fairly messy, but with x scrolling enabled, if the table has a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3700 // width attribute, regardless of any width applied using the column width
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3701 // options, the browser will shrink or grow the table as needed to fit into
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3702 // that 100%. That would make the width options useless. So we remove it.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3703 // This is okay, under the assumption that width:100% is applied to the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3704 // table in CSS (it is in the default stylesheet) which will set the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3705 // width as appropriate (the attribute and css behave differently...)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3706 if ( scroll.sX && table.attr('width') === '100%' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3707 table.removeAttr('width');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3708 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3709
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3710 if ( ! footer.length ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3711 footer = null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3712 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3713
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3714 /*
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3715 * The HTML structure that we want to generate in this function is:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3716 * div - scroller
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3717 * div - scroll head
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3718 * div - scroll head inner
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3719 * table - scroll head table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3720 * thead - thead
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3721 * div - scroll body
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3722 * table - table (master table)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3723 * thead - thead clone for sizing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3724 * tbody - tbody
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3725 * div - scroll foot
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3726 * div - scroll foot inner
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3727 * table - scroll foot table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3728 * tfoot - tfoot
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3729 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3730 var scroller = $( _div, { 'class': classes.sScrollWrapper } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3731 .append(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3732 $(_div, { 'class': classes.sScrollHead } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3733 .css( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3734 overflow: 'hidden',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3735 position: 'relative',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3736 border: 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3737 width: scrollX ? size(scrollX) : '100%'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3738 } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3739 .append(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3740 $(_div, { 'class': classes.sScrollHeadInner } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3741 .css( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3742 'box-sizing': 'content-box',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3743 width: scroll.sXInner || '100%'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3744 } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3745 .append(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3746 headerClone
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3747 .removeAttr('id')
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3748 .css( 'margin-left', 0 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3749 .append( captionSide === 'top' ? caption : null )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3750 .append(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3751 table.children('thead')
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3752 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3753 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3754 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3755 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3756 .append(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3757 $(_div, { 'class': classes.sScrollBody } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3758 .css( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3759 position: 'relative',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3760 overflow: 'auto',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3761 width: size( scrollX )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3762 } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3763 .append( table )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3764 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3765
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3766 if ( footer ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3767 scroller.append(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3768 $(_div, { 'class': classes.sScrollFoot } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3769 .css( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3770 overflow: 'hidden',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3771 border: 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3772 width: scrollX ? size(scrollX) : '100%'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3773 } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3774 .append(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3775 $(_div, { 'class': classes.sScrollFootInner } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3776 .append(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3777 footerClone
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3778 .removeAttr('id')
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3779 .css( 'margin-left', 0 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3780 .append( captionSide === 'bottom' ? caption : null )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3781 .append(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3782 table.children('tfoot')
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3783 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3784 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3785 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3786 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3787 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3788
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3789 var children = scroller.children();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3790 var scrollHead = children[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3791 var scrollBody = children[1];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3792 var scrollFoot = footer ? children[2] : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3793
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3794 // When the body is scrolled, then we also want to scroll the headers
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3795 if ( scrollX ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3796 $(scrollBody).on( 'scroll.DT', function (e) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3797 var scrollLeft = this.scrollLeft;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3798
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3799 scrollHead.scrollLeft = scrollLeft;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3800
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3801 if ( footer ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3802 scrollFoot.scrollLeft = scrollLeft;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3803 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3804 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3805 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3806
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3807 $(scrollBody).css(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3808 scrollY && scroll.bCollapse ? 'max-height' : 'height',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3809 scrollY
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3810 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3811
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3812 settings.nScrollHead = scrollHead;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3813 settings.nScrollBody = scrollBody;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3814 settings.nScrollFoot = scrollFoot;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3815
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3816 // On redraw - align columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3817 settings.aoDrawCallback.push( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3818 "fn": _fnScrollDraw,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3819 "sName": "scrolling"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3820 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3821
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3822 return scroller[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3823 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3824
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3825
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3826
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3827 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3828 * Update the header, footer and body tables for resizing - i.e. column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3829 * alignment.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3830 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3831 * Welcome to the most horrible function DataTables. The process that this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3832 * function follows is basically:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3833 * 1. Re-create the table inside the scrolling div
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3834 * 2. Take live measurements from the DOM
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3835 * 3. Apply the measurements to align the columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3836 * 4. Clean up
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3837 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3838 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3839 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3840 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3841 function _fnScrollDraw ( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3842 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3843 // Given that this is such a monster function, a lot of variables are use
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3844 // to try and keep the minimised size as small as possible
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3845 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3846 scroll = settings.oScroll,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3847 scrollX = scroll.sX,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3848 scrollXInner = scroll.sXInner,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3849 scrollY = scroll.sY,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3850 barWidth = scroll.iBarWidth,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3851 divHeader = $(settings.nScrollHead),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3852 divHeaderStyle = divHeader[0].style,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3853 divHeaderInner = divHeader.children('div'),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3854 divHeaderInnerStyle = divHeaderInner[0].style,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3855 divHeaderTable = divHeaderInner.children('table'),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3856 divBodyEl = settings.nScrollBody,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3857 divBody = $(divBodyEl),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3858 divBodyStyle = divBodyEl.style,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3859 divFooter = $(settings.nScrollFoot),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3860 divFooterInner = divFooter.children('div'),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3861 divFooterTable = divFooterInner.children('table'),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3862 header = $(settings.nTHead),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3863 table = $(settings.nTable),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3864 tableEl = table[0],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3865 tableStyle = tableEl.style,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3866 footer = settings.nTFoot ? $(settings.nTFoot) : null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3867 browser = settings.oBrowser,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3868 ie67 = browser.bScrollOversize,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3869 headerTrgEls, footerTrgEls,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3870 headerSrcEls, footerSrcEls,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3871 headerCopy, footerCopy,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3872 headerWidths=[], footerWidths=[],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3873 headerContent=[],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3874 idx, correction, sanityWidth,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3875 zeroOut = function(nSizer) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3876 var style = nSizer.style;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3877 style.paddingTop = "0";
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3878 style.paddingBottom = "0";
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3879 style.borderTopWidth = "0";
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3880 style.borderBottomWidth = "0";
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3881 style.height = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3882 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3883
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3884 /*
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3885 * 1. Re-create the table inside the scrolling div
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3886 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3887
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3888 // Remove the old minimised thead and tfoot elements in the inner table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3889 table.children('thead, tfoot').remove();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3890
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3891 // Clone the current header and footer elements and then place it into the inner table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3892 headerCopy = header.clone().prependTo( table );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3893 headerTrgEls = header.find('tr'); // original header is in its own table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3894 headerSrcEls = headerCopy.find('tr');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3895 headerCopy.find('th, td').removeAttr('tabindex');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3896
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3897 if ( footer ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3898 footerCopy = footer.clone().prependTo( table );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3899 footerTrgEls = footer.find('tr'); // the original tfoot is in its own table and must be sized
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3900 footerSrcEls = footerCopy.find('tr');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3901 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3902
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3903
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3904 /*
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3905 * 2. Take live measurements from the DOM - do not alter the DOM itself!
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3906 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3907
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3908 // Remove old sizing and apply the calculated column widths
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3909 // Get the unique column headers in the newly created (cloned) header. We want to apply the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3910 // calculated sizes to this header
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3911 if ( ! scrollX )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3912 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3913 divBodyStyle.width = '100%';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3914 divHeader[0].style.width = '100%';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3915 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3916
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3917 $.each( _fnGetUniqueThs( settings, headerCopy ), function ( i, el ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3918 idx = _fnVisibleToColumnIndex( settings, i );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3919 el.style.width = settings.aoColumns[idx].sWidth;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3920 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3921
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3922 if ( footer ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3923 _fnApplyToChildren( function(n) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3924 n.style.width = "";
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3925 }, footerSrcEls );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3926 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3927
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3928 // Size the table as a whole
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3929 sanityWidth = table.outerWidth();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3930 if ( scrollX === "" ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3931 // No x scrolling
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3932 tableStyle.width = "100%";
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3933
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3934 // IE7 will make the width of the table when 100% include the scrollbar
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3935 // - which is shouldn't. When there is a scrollbar we need to take this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3936 // into account.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3937 if ( ie67 && (table.find('tbody').height() > divBodyEl.offsetHeight ||
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3938 divBody.css('overflow-y') == "scroll")
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3939 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3940 tableStyle.width = _fnStringToCss( table.outerWidth() - barWidth);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3941 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3942
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3943 // Recalculate the sanity width
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3944 sanityWidth = table.outerWidth();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3945 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3946 else if ( scrollXInner !== "" ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3947 // legacy x scroll inner has been given - use it
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3948 tableStyle.width = _fnStringToCss(scrollXInner);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3949
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3950 // Recalculate the sanity width
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3951 sanityWidth = table.outerWidth();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3952 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3953
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3954 // Hidden header should have zero height, so remove padding and borders. Then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3955 // set the width based on the real headers
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3956
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3957 // Apply all styles in one pass
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3958 _fnApplyToChildren( zeroOut, headerSrcEls );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3959
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3960 // Read all widths in next pass
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3961 _fnApplyToChildren( function(nSizer) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3962 headerContent.push( nSizer.innerHTML );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3963 headerWidths.push( _fnStringToCss( $(nSizer).css('width') ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3964 }, headerSrcEls );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3965
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3966 // Apply all widths in final pass
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3967 _fnApplyToChildren( function(nToSize, i) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3968 nToSize.style.width = headerWidths[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3969 }, headerTrgEls );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3970
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3971 $(headerSrcEls).height(0);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3972
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3973 /* Same again with the footer if we have one */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3974 if ( footer )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3975 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3976 _fnApplyToChildren( zeroOut, footerSrcEls );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3977
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3978 _fnApplyToChildren( function(nSizer) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3979 footerWidths.push( _fnStringToCss( $(nSizer).css('width') ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3980 }, footerSrcEls );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3981
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3982 _fnApplyToChildren( function(nToSize, i) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3983 nToSize.style.width = footerWidths[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3984 }, footerTrgEls );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3985
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3986 $(footerSrcEls).height(0);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3987 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3988
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3989
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3990 /*
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3991 * 3. Apply the measurements
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3992 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3993
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3994 // "Hide" the header and footer that we used for the sizing. We need to keep
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3995 // the content of the cell so that the width applied to the header and body
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3996 // both match, but we want to hide it completely. We want to also fix their
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3997 // width to what they currently are
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3998 _fnApplyToChildren( function(nSizer, i) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
3999 nSizer.innerHTML = '<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+headerContent[i]+'</div>';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4000 nSizer.style.width = headerWidths[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4001 }, headerSrcEls );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4002
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4003 if ( footer )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4004 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4005 _fnApplyToChildren( function(nSizer, i) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4006 nSizer.innerHTML = "";
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4007 nSizer.style.width = footerWidths[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4008 }, footerSrcEls );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4009 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4010
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4011 // Sanity check that the table is of a sensible width. If not then we are going to get
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4012 // misalignment - try to prevent this by not allowing the table to shrink below its min width
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4013 if ( table.outerWidth() < sanityWidth )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4014 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4015 // The min width depends upon if we have a vertical scrollbar visible or not */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4016 correction = ((divBodyEl.scrollHeight > divBodyEl.offsetHeight ||
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4017 divBody.css('overflow-y') == "scroll")) ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4018 sanityWidth+barWidth :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4019 sanityWidth;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4020
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4021 // IE6/7 are a law unto themselves...
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4022 if ( ie67 && (divBodyEl.scrollHeight >
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4023 divBodyEl.offsetHeight || divBody.css('overflow-y') == "scroll")
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4024 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4025 tableStyle.width = _fnStringToCss( correction-barWidth );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4026 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4027
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4028 // And give the user a warning that we've stopped the table getting too small
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4029 if ( scrollX === "" || scrollXInner !== "" ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4030 _fnLog( settings, 1, 'Possible column misalignment', 6 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4031 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4032 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4033 else
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4034 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4035 correction = '100%';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4036 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4037
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4038 // Apply to the container elements
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4039 divBodyStyle.width = _fnStringToCss( correction );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4040 divHeaderStyle.width = _fnStringToCss( correction );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4041
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4042 if ( footer ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4043 settings.nScrollFoot.style.width = _fnStringToCss( correction );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4044 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4045
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4046
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4047 /*
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4048 * 4. Clean up
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4049 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4050 if ( ! scrollY ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4051 /* IE7< puts a vertical scrollbar in place (when it shouldn't be) due to subtracting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4052 * the scrollbar height from the visible display, rather than adding it on. We need to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4053 * set the height in order to sort this. Don't want to do it in any other browsers.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4054 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4055 if ( ie67 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4056 divBodyStyle.height = _fnStringToCss( tableEl.offsetHeight+barWidth );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4057 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4058 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4059
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4060 /* Finally set the width's of the header and footer tables */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4061 var iOuterWidth = table.outerWidth();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4062 divHeaderTable[0].style.width = _fnStringToCss( iOuterWidth );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4063 divHeaderInnerStyle.width = _fnStringToCss( iOuterWidth );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4064
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4065 // Figure out if there are scrollbar present - if so then we need a the header and footer to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4066 // provide a bit more space to allow "overflow" scrolling (i.e. past the scrollbar)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4067 var bScrolling = table.height() > divBodyEl.clientHeight || divBody.css('overflow-y') == "scroll";
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4068 var padding = 'padding' + (browser.bScrollbarLeft ? 'Left' : 'Right' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4069 divHeaderInnerStyle[ padding ] = bScrolling ? barWidth+"px" : "0px";
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4070
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4071 if ( footer ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4072 divFooterTable[0].style.width = _fnStringToCss( iOuterWidth );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4073 divFooterInner[0].style.width = _fnStringToCss( iOuterWidth );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4074 divFooterInner[0].style[padding] = bScrolling ? barWidth+"px" : "0px";
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4075 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4076
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4077 /* Adjust the position of the header in case we loose the y-scrollbar */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4078 divBody.scroll();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4079
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4080 // If sorting or filtering has occurred, jump the scrolling back to the top
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4081 // only if we aren't holding the position
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4082 if ( (settings.bSorted || settings.bFiltered) && ! settings._drawHold ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4083 divBodyEl.scrollTop = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4084 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4085 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4086
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4087
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4088
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4089 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4090 * Apply a given function to the display child nodes of an element array (typically
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4091 * TD children of TR rows
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4092 * @param {function} fn Method to apply to the objects
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4093 * @param array {nodes} an1 List of elements to look through for display children
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4094 * @param array {nodes} an2 Another list (identical structure to the first) - optional
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4095 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4096 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4097 function _fnApplyToChildren( fn, an1, an2 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4098 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4099 var index=0, i=0, iLen=an1.length;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4100 var nNode1, nNode2;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4101
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4102 while ( i < iLen ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4103 nNode1 = an1[i].firstChild;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4104 nNode2 = an2 ? an2[i].firstChild : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4105
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4106 while ( nNode1 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4107 if ( nNode1.nodeType === 1 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4108 if ( an2 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4109 fn( nNode1, nNode2, index );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4110 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4111 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4112 fn( nNode1, index );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4113 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4114
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4115 index++;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4116 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4117
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4118 nNode1 = nNode1.nextSibling;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4119 nNode2 = an2 ? nNode2.nextSibling : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4120 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4121
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4122 i++;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4123 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4124 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4125
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4126
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4127
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4128 var __re_html_remove = /<.*?>/g;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4129
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4130
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4131 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4132 * Calculate the width of columns for the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4133 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4134 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4135 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4136 function _fnCalculateColumnWidths ( oSettings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4137 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4138 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4139 table = oSettings.nTable,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4140 columns = oSettings.aoColumns,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4141 scroll = oSettings.oScroll,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4142 scrollY = scroll.sY,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4143 scrollX = scroll.sX,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4144 scrollXInner = scroll.sXInner,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4145 columnCount = columns.length,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4146 visibleColumns = _fnGetColumns( oSettings, 'bVisible' ),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4147 headerCells = $('th', oSettings.nTHead),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4148 tableWidthAttr = table.getAttribute('width'), // from DOM element
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4149 tableContainer = table.parentNode,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4150 userInputs = false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4151 i, column, columnIdx, width, outerWidth,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4152 browser = oSettings.oBrowser,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4153 ie67 = browser.bScrollOversize;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4154
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4155 var styleWidth = table.style.width;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4156 if ( styleWidth && styleWidth.indexOf('%') !== -1 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4157 tableWidthAttr = styleWidth;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4158 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4159
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4160 /* Convert any user input sizes into pixel sizes */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4161 for ( i=0 ; i<visibleColumns.length ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4162 column = columns[ visibleColumns[i] ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4163
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4164 if ( column.sWidth !== null ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4165 column.sWidth = _fnConvertToWidth( column.sWidthOrig, tableContainer );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4166
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4167 userInputs = true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4168 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4169 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4170
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4171 /* If the number of columns in the DOM equals the number that we have to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4172 * process in DataTables, then we can use the offsets that are created by
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4173 * the web- browser. No custom sizes can be set in order for this to happen,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4174 * nor scrolling used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4175 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4176 if ( ie67 || ! userInputs && ! scrollX && ! scrollY &&
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4177 columnCount == _fnVisbleColumns( oSettings ) &&
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4178 columnCount == headerCells.length
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4179 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4180 for ( i=0 ; i<columnCount ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4181 var colIdx = _fnVisibleToColumnIndex( oSettings, i );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4182
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4183 if ( colIdx ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4184 columns[ colIdx ].sWidth = _fnStringToCss( headerCells.eq(i).width() );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4185 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4186 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4187 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4188 else
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4189 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4190 // Otherwise construct a single row, worst case, table with the widest
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4191 // node in the data, assign any user defined widths, then insert it into
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4192 // the DOM and allow the browser to do all the hard work of calculating
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4193 // table widths
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4194 var tmpTable = $(table).clone() // don't use cloneNode - IE8 will remove events on the main table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4195 .css( 'visibility', 'hidden' )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4196 .removeAttr( 'id' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4197
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4198 // Clean up the table body
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4199 tmpTable.find('tbody tr').remove();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4200 var tr = $('<tr/>').appendTo( tmpTable.find('tbody') );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4201
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4202 // Clone the table header and footer - we can't use the header / footer
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4203 // from the cloned table, since if scrolling is active, the table's
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4204 // real header and footer are contained in different table tags
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4205 tmpTable.find('thead, tfoot').remove();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4206 tmpTable
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4207 .append( $(oSettings.nTHead).clone() )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4208 .append( $(oSettings.nTFoot).clone() );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4209
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4210 // Remove any assigned widths from the footer (from scrolling)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4211 tmpTable.find('tfoot th, tfoot td').css('width', '');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4212
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4213 // Apply custom sizing to the cloned header
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4214 headerCells = _fnGetUniqueThs( oSettings, tmpTable.find('thead')[0] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4215
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4216 for ( i=0 ; i<visibleColumns.length ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4217 column = columns[ visibleColumns[i] ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4218
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4219 headerCells[i].style.width = column.sWidthOrig !== null && column.sWidthOrig !== '' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4220 _fnStringToCss( column.sWidthOrig ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4221 '';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4222 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4223
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4224 // Find the widest cell for each column and put it into the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4225 if ( oSettings.aoData.length ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4226 for ( i=0 ; i<visibleColumns.length ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4227 columnIdx = visibleColumns[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4228 column = columns[ columnIdx ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4229
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4230 $( _fnGetWidestNode( oSettings, columnIdx ) )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4231 .clone( false )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4232 .append( column.sContentPadding )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4233 .appendTo( tr );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4234 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4235 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4236
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4237 // Table has been built, attach to the document so we can work with it.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4238 // A holding element is used, positioned at the top of the container
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4239 // with minimal height, so it has no effect on if the container scrolls
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4240 // or not. Otherwise it might trigger scrolling when it actually isn't
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4241 // needed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4242 var holder = $('<div/>').css( scrollX || scrollY ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4243 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4244 position: 'absolute',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4245 top: 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4246 left: 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4247 height: 1,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4248 right: 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4249 overflow: 'hidden'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4250 } :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4251 {}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4252 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4253 .append( tmpTable )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4254 .appendTo( tableContainer );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4255
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4256 // When scrolling (X or Y) we want to set the width of the table as
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4257 // appropriate. However, when not scrolling leave the table width as it
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4258 // is. This results in slightly different, but I think correct behaviour
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4259 if ( scrollX && scrollXInner ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4260 tmpTable.width( scrollXInner );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4261 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4262 else if ( scrollX ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4263 tmpTable.css( 'width', 'auto' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4264
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4265 if ( tmpTable.width() < tableContainer.clientWidth ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4266 tmpTable.width( tableContainer.clientWidth );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4267 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4268 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4269 else if ( scrollY ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4270 tmpTable.width( tableContainer.clientWidth );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4271 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4272 else if ( tableWidthAttr ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4273 tmpTable.width( tableWidthAttr );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4274 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4275
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4276 // Browsers need a bit of a hand when a width is assigned to any columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4277 // when x-scrolling as they tend to collapse the table to the min-width,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4278 // even if we sent the column widths. So we need to keep track of what
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4279 // the table width should be by summing the user given values, and the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4280 // automatic values
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4281 if ( scrollX )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4282 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4283 var total = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4284
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4285 for ( i=0 ; i<visibleColumns.length ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4286 column = columns[ visibleColumns[i] ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4287
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4288 // Much prefer to use getBoundingClientRect due to its sub-pixel
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4289 // resolution, but IE8- do not support the width property.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4290 outerWidth = browser.bBounding ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4291 headerCells[i].getBoundingClientRect().width :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4292 $(headerCells[i]).outerWidth();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4293
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4294 total += column.sWidthOrig === null ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4295 outerWidth :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4296 parseInt( column.sWidth, 10 ) + outerWidth - $(headerCells[i]).width();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4297 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4298
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4299 tmpTable.width( _fnStringToCss( total ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4300 table.style.width = _fnStringToCss( total );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4301 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4302
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4303 // Get the width of each column in the constructed table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4304 for ( i=0 ; i<visibleColumns.length ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4305 column = columns[ visibleColumns[i] ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4306 width = $(headerCells[i]).width();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4307
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4308 if ( width ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4309 column.sWidth = _fnStringToCss( width );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4310 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4311 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4312
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4313 table.style.width = _fnStringToCss( tmpTable.css('width') );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4314
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4315 // Finished with the table - ditch it
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4316 holder.remove();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4317 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4318
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4319 // If there is a width attr, we want to attach an event listener which
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4320 // allows the table sizing to automatically adjust when the window is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4321 // resized. Use the width attr rather than CSS, since we can't know if the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4322 // CSS is a relative value or absolute - DOM read is always px.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4323 if ( tableWidthAttr ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4324 table.style.width = _fnStringToCss( tableWidthAttr );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4325 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4326
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4327 if ( (tableWidthAttr || scrollX) && ! oSettings._reszEvt ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4328 var bindResize = function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4329 $(window).bind('resize.DT-'+oSettings.sInstance, _fnThrottle( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4330 _fnAdjustColumnSizing( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4331 } ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4332 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4333
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4334 // IE6/7 will crash if we bind a resize event handler on page load.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4335 // To be removed in 1.11 which drops IE6/7 support
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4336 if ( ie67 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4337 setTimeout( bindResize, 1000 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4338 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4339 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4340 bindResize();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4341 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4342
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4343 oSettings._reszEvt = true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4344 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4345 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4346
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4347
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4348 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4349 * Throttle the calls to a function. Arguments and context are maintained for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4350 * the throttled function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4351 * @param {function} fn Function to be called
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4352 * @param {int} [freq=200] call frequency in mS
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4353 * @returns {function} wrapped function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4354 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4355 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4356 function _fnThrottle( fn, freq ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4357 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4358 frequency = freq !== undefined ? freq : 200,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4359 last,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4360 timer;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4361
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4362 return function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4363 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4364 that = this,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4365 now = +new Date(),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4366 args = arguments;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4367
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4368 if ( last && now < last + frequency ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4369 clearTimeout( timer );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4370
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4371 timer = setTimeout( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4372 last = undefined;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4373 fn.apply( that, args );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4374 }, frequency );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4375 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4376 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4377 last = now;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4378 fn.apply( that, args );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4379 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4380 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4381 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4382
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4383
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4384 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4385 * Convert a CSS unit width to pixels (e.g. 2em)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4386 * @param {string} width width to be converted
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4387 * @param {node} parent parent to get the with for (required for relative widths) - optional
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4388 * @returns {int} width in pixels
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4389 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4390 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4391 function _fnConvertToWidth ( width, parent )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4392 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4393 if ( ! width ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4394 return 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4395 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4396
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4397 var n = $('<div/>')
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4398 .css( 'width', _fnStringToCss( width ) )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4399 .appendTo( parent || document.body );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4400
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4401 var val = n[0].offsetWidth;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4402 n.remove();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4403
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4404 return val;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4405 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4406
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4407
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4408 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4409 * Get the widest node
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4410 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4411 * @param {int} colIdx column of interest
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4412 * @returns {node} widest table node
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4413 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4414 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4415 function _fnGetWidestNode( settings, colIdx )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4416 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4417 var idx = _fnGetMaxLenString( settings, colIdx );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4418 if ( idx < 0 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4419 return null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4420 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4421
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4422 var data = settings.aoData[ idx ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4423 return ! data.nTr ? // Might not have been created when deferred rendering
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4424 $('<td/>').html( _fnGetCellData( settings, idx, colIdx, 'display' ) )[0] :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4425 data.anCells[ colIdx ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4426 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4427
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4428
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4429 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4430 * Get the maximum strlen for each data column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4431 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4432 * @param {int} colIdx column of interest
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4433 * @returns {string} max string length for each column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4434 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4435 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4436 function _fnGetMaxLenString( settings, colIdx )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4437 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4438 var s, max=-1, maxIdx = -1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4439
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4440 for ( var i=0, ien=settings.aoData.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4441 s = _fnGetCellData( settings, i, colIdx, 'display' )+'';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4442 s = s.replace( __re_html_remove, '' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4443
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4444 if ( s.length > max ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4445 max = s.length;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4446 maxIdx = i;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4447 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4448 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4449
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4450 return maxIdx;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4451 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4452
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4453
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4454 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4455 * Append a CSS unit (only if required) to a string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4456 * @param {string} value to css-ify
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4457 * @returns {string} value with css unit
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4458 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4459 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4460 function _fnStringToCss( s )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4461 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4462 if ( s === null ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4463 return '0px';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4464 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4465
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4466 if ( typeof s == 'number' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4467 return s < 0 ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4468 '0px' :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4469 s+'px';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4470 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4471
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4472 // Check it has a unit character already
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4473 return s.match(/\d$/) ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4474 s+'px' :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4475 s;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4476 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4477
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4478
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4479
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4480 function _fnSortFlatten ( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4481 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4482 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4483 i, iLen, k, kLen,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4484 aSort = [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4485 aiOrig = [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4486 aoColumns = settings.aoColumns,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4487 aDataSort, iCol, sType, srcCol,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4488 fixed = settings.aaSortingFixed,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4489 fixedObj = $.isPlainObject( fixed ),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4490 nestedSort = [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4491 add = function ( a ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4492 if ( a.length && ! $.isArray( a[0] ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4493 // 1D array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4494 nestedSort.push( a );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4495 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4496 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4497 // 2D array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4498 $.merge( nestedSort, a );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4499 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4500 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4501
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4502 // Build the sort array, with pre-fix and post-fix options if they have been
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4503 // specified
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4504 if ( $.isArray( fixed ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4505 add( fixed );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4506 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4507
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4508 if ( fixedObj && fixed.pre ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4509 add( fixed.pre );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4510 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4511
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4512 add( settings.aaSorting );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4513
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4514 if (fixedObj && fixed.post ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4515 add( fixed.post );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4516 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4517
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4518 for ( i=0 ; i<nestedSort.length ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4519 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4520 srcCol = nestedSort[i][0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4521 aDataSort = aoColumns[ srcCol ].aDataSort;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4522
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4523 for ( k=0, kLen=aDataSort.length ; k<kLen ; k++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4524 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4525 iCol = aDataSort[k];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4526 sType = aoColumns[ iCol ].sType || 'string';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4527
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4528 if ( nestedSort[i]._idx === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4529 nestedSort[i]._idx = $.inArray( nestedSort[i][1], aoColumns[iCol].asSorting );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4530 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4531
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4532 aSort.push( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4533 src: srcCol,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4534 col: iCol,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4535 dir: nestedSort[i][1],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4536 index: nestedSort[i]._idx,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4537 type: sType,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4538 formatter: DataTable.ext.type.order[ sType+"-pre" ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4539 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4540 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4541 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4542
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4543 return aSort;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4544 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4545
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4546 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4547 * Change the order of the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4548 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4549 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4550 * @todo This really needs split up!
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4551 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4552 function _fnSort ( oSettings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4553 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4554 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4555 i, ien, iLen, j, jLen, k, kLen,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4556 sDataType, nTh,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4557 aiOrig = [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4558 oExtSort = DataTable.ext.type.order,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4559 aoData = oSettings.aoData,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4560 aoColumns = oSettings.aoColumns,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4561 aDataSort, data, iCol, sType, oSort,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4562 formatters = 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4563 sortCol,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4564 displayMaster = oSettings.aiDisplayMaster,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4565 aSort;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4566
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4567 // Resolve any column types that are unknown due to addition or invalidation
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4568 // @todo Can this be moved into a 'data-ready' handler which is called when
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4569 // data is going to be used in the table?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4570 _fnColumnTypes( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4571
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4572 aSort = _fnSortFlatten( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4573
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4574 for ( i=0, ien=aSort.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4575 sortCol = aSort[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4576
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4577 // Track if we can use the fast sort algorithm
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4578 if ( sortCol.formatter ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4579 formatters++;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4580 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4581
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4582 // Load the data needed for the sort, for each cell
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4583 _fnSortData( oSettings, sortCol.col );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4584 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4585
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4586 /* No sorting required if server-side or no sorting array */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4587 if ( _fnDataSource( oSettings ) != 'ssp' && aSort.length !== 0 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4588 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4589 // Create a value - key array of the current row positions such that we can use their
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4590 // current position during the sort, if values match, in order to perform stable sorting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4591 for ( i=0, iLen=displayMaster.length ; i<iLen ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4592 aiOrig[ displayMaster[i] ] = i;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4593 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4594
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4595 /* Do the sort - here we want multi-column sorting based on a given data source (column)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4596 * and sorting function (from oSort) in a certain direction. It's reasonably complex to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4597 * follow on it's own, but this is what we want (example two column sorting):
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4598 * fnLocalSorting = function(a,b){
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4599 * var iTest;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4600 * iTest = oSort['string-asc']('data11', 'data12');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4601 * if (iTest !== 0)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4602 * return iTest;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4603 * iTest = oSort['numeric-desc']('data21', 'data22');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4604 * if (iTest !== 0)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4605 * return iTest;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4606 * return oSort['numeric-asc']( aiOrig[a], aiOrig[b] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4607 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4608 * Basically we have a test for each sorting column, if the data in that column is equal,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4609 * test the next column. If all columns match, then we use a numeric sort on the row
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4610 * positions in the original data array to provide a stable sort.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4611 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4612 * Note - I know it seems excessive to have two sorting methods, but the first is around
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4613 * 15% faster, so the second is only maintained for backwards compatibility with sorting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4614 * methods which do not have a pre-sort formatting function.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4615 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4616 if ( formatters === aSort.length ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4617 // All sort types have formatting functions
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4618 displayMaster.sort( function ( a, b ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4619 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4620 x, y, k, test, sort,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4621 len=aSort.length,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4622 dataA = aoData[a]._aSortData,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4623 dataB = aoData[b]._aSortData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4624
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4625 for ( k=0 ; k<len ; k++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4626 sort = aSort[k];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4627
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4628 x = dataA[ sort.col ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4629 y = dataB[ sort.col ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4630
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4631 test = x<y ? -1 : x>y ? 1 : 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4632 if ( test !== 0 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4633 return sort.dir === 'asc' ? test : -test;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4634 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4635 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4636
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4637 x = aiOrig[a];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4638 y = aiOrig[b];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4639 return x<y ? -1 : x>y ? 1 : 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4640 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4641 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4642 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4643 // Depreciated - remove in 1.11 (providing a plug-in option)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4644 // Not all sort types have formatting methods, so we have to call their sorting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4645 // methods.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4646 displayMaster.sort( function ( a, b ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4647 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4648 x, y, k, l, test, sort, fn,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4649 len=aSort.length,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4650 dataA = aoData[a]._aSortData,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4651 dataB = aoData[b]._aSortData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4652
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4653 for ( k=0 ; k<len ; k++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4654 sort = aSort[k];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4655
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4656 x = dataA[ sort.col ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4657 y = dataB[ sort.col ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4658
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4659 fn = oExtSort[ sort.type+"-"+sort.dir ] || oExtSort[ "string-"+sort.dir ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4660 test = fn( x, y );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4661 if ( test !== 0 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4662 return test;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4663 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4664 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4665
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4666 x = aiOrig[a];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4667 y = aiOrig[b];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4668 return x<y ? -1 : x>y ? 1 : 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4669 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4670 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4671 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4672
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4673 /* Tell the draw function that we have sorted the data */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4674 oSettings.bSorted = true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4675 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4676
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4677
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4678 function _fnSortAria ( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4679 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4680 var label;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4681 var nextSort;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4682 var columns = settings.aoColumns;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4683 var aSort = _fnSortFlatten( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4684 var oAria = settings.oLanguage.oAria;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4685
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4686 // ARIA attributes - need to loop all columns, to update all (removing old
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4687 // attributes as needed)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4688 for ( var i=0, iLen=columns.length ; i<iLen ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4689 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4690 var col = columns[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4691 var asSorting = col.asSorting;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4692 var sTitle = col.sTitle.replace( /<.*?>/g, "" );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4693 var th = col.nTh;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4694
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4695 // IE7 is throwing an error when setting these properties with jQuery's
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4696 // attr() and removeAttr() methods...
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4697 th.removeAttribute('aria-sort');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4698
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4699 /* In ARIA only the first sorting column can be marked as sorting - no multi-sort option */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4700 if ( col.bSortable ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4701 if ( aSort.length > 0 && aSort[0].col == i ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4702 th.setAttribute('aria-sort', aSort[0].dir=="asc" ? "ascending" : "descending" );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4703 nextSort = asSorting[ aSort[0].index+1 ] || asSorting[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4704 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4705 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4706 nextSort = asSorting[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4707 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4708
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4709 label = sTitle + ( nextSort === "asc" ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4710 oAria.sSortAscending :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4711 oAria.sSortDescending
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4712 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4713 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4714 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4715 label = sTitle;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4716 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4717
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4718 th.setAttribute('aria-label', label);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4719 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4720 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4721
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4722
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4723 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4724 * Function to run on user sort request
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4725 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4726 * @param {node} attachTo node to attach the handler to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4727 * @param {int} colIdx column sorting index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4728 * @param {boolean} [append=false] Append the requested sort to the existing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4729 * sort if true (i.e. multi-column sort)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4730 * @param {function} [callback] callback function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4731 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4732 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4733 function _fnSortListener ( settings, colIdx, append, callback )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4734 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4735 var col = settings.aoColumns[ colIdx ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4736 var sorting = settings.aaSorting;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4737 var asSorting = col.asSorting;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4738 var nextSortIdx;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4739 var next = function ( a, overflow ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4740 var idx = a._idx;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4741 if ( idx === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4742 idx = $.inArray( a[1], asSorting );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4743 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4744
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4745 return idx+1 < asSorting.length ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4746 idx+1 :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4747 overflow ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4748 null :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4749 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4750 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4751
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4752 // Convert to 2D array if needed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4753 if ( typeof sorting[0] === 'number' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4754 sorting = settings.aaSorting = [ sorting ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4755 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4756
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4757 // If appending the sort then we are multi-column sorting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4758 if ( append && settings.oFeatures.bSortMulti ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4759 // Are we already doing some kind of sort on this column?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4760 var sortIdx = $.inArray( colIdx, _pluck(sorting, '0') );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4761
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4762 if ( sortIdx !== -1 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4763 // Yes, modify the sort
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4764 nextSortIdx = next( sorting[sortIdx], true );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4765
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4766 if ( nextSortIdx === null && sorting.length === 1 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4767 nextSortIdx = 0; // can't remove sorting completely
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4768 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4769
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4770 if ( nextSortIdx === null ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4771 sorting.splice( sortIdx, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4772 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4773 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4774 sorting[sortIdx][1] = asSorting[ nextSortIdx ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4775 sorting[sortIdx]._idx = nextSortIdx;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4776 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4777 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4778 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4779 // No sort on this column yet
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4780 sorting.push( [ colIdx, asSorting[0], 0 ] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4781 sorting[sorting.length-1]._idx = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4782 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4783 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4784 else if ( sorting.length && sorting[0][0] == colIdx ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4785 // Single column - already sorting on this column, modify the sort
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4786 nextSortIdx = next( sorting[0] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4787
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4788 sorting.length = 1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4789 sorting[0][1] = asSorting[ nextSortIdx ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4790 sorting[0]._idx = nextSortIdx;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4791 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4792 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4793 // Single column - sort only on this column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4794 sorting.length = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4795 sorting.push( [ colIdx, asSorting[0] ] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4796 sorting[0]._idx = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4797 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4798
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4799 // Run the sort by calling a full redraw
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4800 _fnReDraw( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4801
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4802 // callback used for async user interaction
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4803 if ( typeof callback == 'function' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4804 callback( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4805 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4806 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4807
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4808
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4809 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4810 * Attach a sort handler (click) to a node
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4811 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4812 * @param {node} attachTo node to attach the handler to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4813 * @param {int} colIdx column sorting index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4814 * @param {function} [callback] callback function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4815 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4816 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4817 function _fnSortAttachListener ( settings, attachTo, colIdx, callback )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4818 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4819 var col = settings.aoColumns[ colIdx ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4820
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4821 _fnBindAction( attachTo, {}, function (e) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4822 /* If the column is not sortable - don't to anything */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4823 if ( col.bSortable === false ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4824 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4825 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4826
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4827 // If processing is enabled use a timeout to allow the processing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4828 // display to be shown - otherwise to it synchronously
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4829 if ( settings.oFeatures.bProcessing ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4830 _fnProcessingDisplay( settings, true );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4831
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4832 setTimeout( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4833 _fnSortListener( settings, colIdx, e.shiftKey, callback );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4834
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4835 // In server-side processing, the draw callback will remove the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4836 // processing display
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4837 if ( _fnDataSource( settings ) !== 'ssp' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4838 _fnProcessingDisplay( settings, false );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4839 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4840 }, 0 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4841 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4842 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4843 _fnSortListener( settings, colIdx, e.shiftKey, callback );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4844 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4845 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4846 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4847
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4848
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4849 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4850 * Set the sorting classes on table's body, Note: it is safe to call this function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4851 * when bSort and bSortClasses are false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4852 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4853 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4854 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4855 function _fnSortingClasses( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4856 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4857 var oldSort = settings.aLastSort;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4858 var sortClass = settings.oClasses.sSortColumn;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4859 var sort = _fnSortFlatten( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4860 var features = settings.oFeatures;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4861 var i, ien, colIdx;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4862
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4863 if ( features.bSort && features.bSortClasses ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4864 // Remove old sorting classes
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4865 for ( i=0, ien=oldSort.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4866 colIdx = oldSort[i].src;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4867
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4868 // Remove column sorting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4869 $( _pluck( settings.aoData, 'anCells', colIdx ) )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4870 .removeClass( sortClass + (i<2 ? i+1 : 3) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4871 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4872
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4873 // Add new column sorting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4874 for ( i=0, ien=sort.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4875 colIdx = sort[i].src;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4876
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4877 $( _pluck( settings.aoData, 'anCells', colIdx ) )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4878 .addClass( sortClass + (i<2 ? i+1 : 3) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4879 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4880 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4881
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4882 settings.aLastSort = sort;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4883 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4884
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4885
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4886 // Get the data to sort a column, be it from cache, fresh (populating the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4887 // cache), or from a sort formatter
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4888 function _fnSortData( settings, idx )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4889 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4890 // Custom sorting function - provided by the sort data type
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4891 var column = settings.aoColumns[ idx ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4892 var customSort = DataTable.ext.order[ column.sSortDataType ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4893 var customData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4894
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4895 if ( customSort ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4896 customData = customSort.call( settings.oInstance, settings, idx,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4897 _fnColumnIndexToVisible( settings, idx )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4898 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4899 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4900
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4901 // Use / populate cache
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4902 var row, cellData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4903 var formatter = DataTable.ext.type.order[ column.sType+"-pre" ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4904
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4905 for ( var i=0, ien=settings.aoData.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4906 row = settings.aoData[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4907
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4908 if ( ! row._aSortData ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4909 row._aSortData = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4910 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4911
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4912 if ( ! row._aSortData[idx] || customSort ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4913 cellData = customSort ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4914 customData[i] : // If there was a custom sort function, use data from there
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4915 _fnGetCellData( settings, i, idx, 'sort' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4916
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4917 row._aSortData[ idx ] = formatter ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4918 formatter( cellData ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4919 cellData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4920 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4921 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4922 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4923
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4924
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4925
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4926 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4927 * Save the state of a table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4928 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4929 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4930 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4931 function _fnSaveState ( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4932 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4933 if ( !settings.oFeatures.bStateSave || settings.bDestroying )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4934 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4935 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4936 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4937
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4938 /* Store the interesting variables */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4939 var state = {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4940 time: +new Date(),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4941 start: settings._iDisplayStart,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4942 length: settings._iDisplayLength,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4943 order: $.extend( true, [], settings.aaSorting ),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4944 search: _fnSearchToCamel( settings.oPreviousSearch ),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4945 columns: $.map( settings.aoColumns, function ( col, i ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4946 return {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4947 visible: col.bVisible,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4948 search: _fnSearchToCamel( settings.aoPreSearchCols[i] )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4949 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4950 } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4951 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4952
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4953 _fnCallbackFire( settings, "aoStateSaveParams", 'stateSaveParams', [settings, state] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4954
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4955 settings.oSavedState = state;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4956 settings.fnStateSaveCallback.call( settings.oInstance, settings, state );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4957 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4958
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4959
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4960 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4961 * Attempt to load a saved table state
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4962 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4963 * @param {object} oInit DataTables init object so we can override settings
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4964 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4965 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4966 function _fnLoadState ( settings, oInit )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4967 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4968 var i, ien;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4969 var columns = settings.aoColumns;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4970
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4971 if ( ! settings.oFeatures.bStateSave ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4972 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4973 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4974
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4975 var state = settings.fnStateLoadCallback.call( settings.oInstance, settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4976 if ( ! state || ! state.time ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4977 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4978 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4979
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4980 /* Allow custom and plug-in manipulation functions to alter the saved data set and
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4981 * cancelling of loading by returning false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4982 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4983 var abStateLoad = _fnCallbackFire( settings, 'aoStateLoadParams', 'stateLoadParams', [settings, state] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4984 if ( $.inArray( false, abStateLoad ) !== -1 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4985 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4986 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4987
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4988 /* Reject old data */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4989 var duration = settings.iStateDuration;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4990 if ( duration > 0 && state.time < +new Date() - (duration*1000) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4991 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4992 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4993
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4994 // Number of columns have changed - all bets are off, no restore of settings
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4995 if ( columns.length !== state.columns.length ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4996 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4997 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4998
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
4999 // Store the saved state so it might be accessed at any time
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5000 settings.oLoadedState = $.extend( true, {}, state );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5001
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5002 // Restore key features - todo - for 1.11 this needs to be done by
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5003 // subscribed events
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5004 if ( state.start !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5005 settings._iDisplayStart = state.start;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5006 settings.iInitDisplayStart = state.start;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5007 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5008 if ( state.length !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5009 settings._iDisplayLength = state.length;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5010 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5011
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5012 // Order
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5013 if ( state.order !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5014 settings.aaSorting = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5015 $.each( state.order, function ( i, col ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5016 settings.aaSorting.push( col[0] >= columns.length ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5017 [ 0, col[1] ] :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5018 col
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5019 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5020 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5021 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5022
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5023 // Search
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5024 if ( state.search !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5025 $.extend( settings.oPreviousSearch, _fnSearchToHung( state.search ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5026 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5027
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5028 // Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5029 for ( i=0, ien=state.columns.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5030 var col = state.columns[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5031
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5032 // Visibility
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5033 if ( col.visible !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5034 columns[i].bVisible = col.visible;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5035 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5036
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5037 // Search
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5038 if ( col.search !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5039 $.extend( settings.aoPreSearchCols[i], _fnSearchToHung( col.search ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5040 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5041 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5042
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5043 _fnCallbackFire( settings, 'aoStateLoaded', 'stateLoaded', [settings, state] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5044 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5045
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5046
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5047 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5048 * Return the settings object for a particular table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5049 * @param {node} table table we are using as a dataTable
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5050 * @returns {object} Settings object - or null if not found
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5051 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5052 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5053 function _fnSettingsFromNode ( table )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5054 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5055 var settings = DataTable.settings;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5056 var idx = $.inArray( table, _pluck( settings, 'nTable' ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5057
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5058 return idx !== -1 ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5059 settings[ idx ] :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5060 null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5061 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5062
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5063
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5064 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5065 * Log an error message
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5066 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5067 * @param {int} level log error messages, or display them to the user
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5068 * @param {string} msg error message
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5069 * @param {int} tn Technical note id to get more information about the error.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5070 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5071 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5072 function _fnLog( settings, level, msg, tn )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5073 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5074 msg = 'DataTables warning: '+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5075 (settings ? 'table id='+settings.sTableId+' - ' : '')+msg;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5076
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5077 if ( tn ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5078 msg += '. For more information about this error, please see '+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5079 'http://datatables.net/tn/'+tn;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5080 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5081
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5082 if ( ! level ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5083 // Backwards compatibility pre 1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5084 var ext = DataTable.ext;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5085 var type = ext.sErrMode || ext.errMode;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5086
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5087 if ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5088 _fnCallbackFire( settings, null, 'error', [ settings, tn, msg ] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5089 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5090
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5091 if ( type == 'alert' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5092 alert( msg );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5093 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5094 else if ( type == 'throw' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5095 throw new Error(msg);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5096 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5097 else if ( typeof type == 'function' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5098 type( settings, tn, msg );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5099 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5100 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5101 else if ( window.console && console.log ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5102 console.log( msg );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5103 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5104 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5105
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5106
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5107 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5108 * See if a property is defined on one object, if so assign it to the other object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5109 * @param {object} ret target object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5110 * @param {object} src source object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5111 * @param {string} name property
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5112 * @param {string} [mappedName] name to map too - optional, name used if not given
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5113 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5114 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5115 function _fnMap( ret, src, name, mappedName )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5116 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5117 if ( $.isArray( name ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5118 $.each( name, function (i, val) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5119 if ( $.isArray( val ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5120 _fnMap( ret, src, val[0], val[1] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5121 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5122 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5123 _fnMap( ret, src, val );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5124 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5125 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5126
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5127 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5128 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5129
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5130 if ( mappedName === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5131 mappedName = name;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5132 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5133
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5134 if ( src[name] !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5135 ret[mappedName] = src[name];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5136 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5137 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5138
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5139
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5140 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5141 * Extend objects - very similar to jQuery.extend, but deep copy objects, and
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5142 * shallow copy arrays. The reason we need to do this, is that we don't want to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5143 * deep copy array init values (such as aaSorting) since the dev wouldn't be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5144 * able to override them, but we do want to deep copy arrays.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5145 * @param {object} out Object to extend
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5146 * @param {object} extender Object from which the properties will be applied to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5147 * out
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5148 * @param {boolean} breakRefs If true, then arrays will be sliced to take an
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5149 * independent copy with the exception of the `data` or `aaData` parameters
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5150 * if they are present. This is so you can pass in a collection to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5151 * DataTables and have that used as your data source without breaking the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5152 * references
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5153 * @returns {object} out Reference, just for convenience - out === the return.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5154 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5155 * @todo This doesn't take account of arrays inside the deep copied objects.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5156 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5157 function _fnExtend( out, extender, breakRefs )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5158 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5159 var val;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5160
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5161 for ( var prop in extender ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5162 if ( extender.hasOwnProperty(prop) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5163 val = extender[prop];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5164
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5165 if ( $.isPlainObject( val ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5166 if ( ! $.isPlainObject( out[prop] ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5167 out[prop] = {};
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5168 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5169 $.extend( true, out[prop], val );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5170 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5171 else if ( breakRefs && prop !== 'data' && prop !== 'aaData' && $.isArray(val) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5172 out[prop] = val.slice();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5173 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5174 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5175 out[prop] = val;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5176 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5177 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5178 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5179
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5180 return out;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5181 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5182
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5183
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5184 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5185 * Bind an event handers to allow a click or return key to activate the callback.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5186 * This is good for accessibility since a return on the keyboard will have the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5187 * same effect as a click, if the element has focus.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5188 * @param {element} n Element to bind the action to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5189 * @param {object} oData Data object to pass to the triggered function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5190 * @param {function} fn Callback function for when the event is triggered
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5191 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5192 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5193 function _fnBindAction( n, oData, fn )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5194 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5195 $(n)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5196 .bind( 'click.DT', oData, function (e) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5197 n.blur(); // Remove focus outline for mouse users
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5198 fn(e);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5199 } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5200 .bind( 'keypress.DT', oData, function (e){
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5201 if ( e.which === 13 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5202 e.preventDefault();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5203 fn(e);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5204 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5205 } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5206 .bind( 'selectstart.DT', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5207 /* Take the brutal approach to cancelling text selection */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5208 return false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5209 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5210 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5211
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5212
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5213 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5214 * Register a callback function. Easily allows a callback function to be added to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5215 * an array store of callback functions that can then all be called together.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5216 * @param {object} oSettings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5217 * @param {string} sStore Name of the array storage for the callbacks in oSettings
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5218 * @param {function} fn Function to be called back
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5219 * @param {string} sName Identifying name for the callback (i.e. a label)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5220 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5221 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5222 function _fnCallbackReg( oSettings, sStore, fn, sName )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5223 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5224 if ( fn )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5225 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5226 oSettings[sStore].push( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5227 "fn": fn,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5228 "sName": sName
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5229 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5230 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5231 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5232
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5233
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5234 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5235 * Fire callback functions and trigger events. Note that the loop over the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5236 * callback array store is done backwards! Further note that you do not want to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5237 * fire off triggers in time sensitive applications (for example cell creation)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5238 * as its slow.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5239 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5240 * @param {string} callbackArr Name of the array storage for the callbacks in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5241 * oSettings
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5242 * @param {string} eventName Name of the jQuery custom event to trigger. If
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5243 * null no trigger is fired
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5244 * @param {array} args Array of arguments to pass to the callback function /
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5245 * trigger
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5246 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5247 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5248 function _fnCallbackFire( settings, callbackArr, eventName, args )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5249 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5250 var ret = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5251
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5252 if ( callbackArr ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5253 ret = $.map( settings[callbackArr].slice().reverse(), function (val, i) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5254 return val.fn.apply( settings.oInstance, args );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5255 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5256 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5257
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5258 if ( eventName !== null ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5259 var e = $.Event( eventName+'.dt' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5260
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5261 $(settings.nTable).trigger( e, args );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5262
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5263 ret.push( e.result );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5264 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5265
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5266 return ret;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5267 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5268
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5269
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5270 function _fnLengthOverflow ( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5271 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5272 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5273 start = settings._iDisplayStart,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5274 end = settings.fnDisplayEnd(),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5275 len = settings._iDisplayLength;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5276
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5277 /* If we have space to show extra rows (backing up from the end point - then do so */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5278 if ( start >= end )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5279 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5280 start = end - len;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5281 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5282
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5283 // Keep the start record on the current page
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5284 start -= (start % len);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5285
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5286 if ( len === -1 || start < 0 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5287 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5288 start = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5289 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5290
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5291 settings._iDisplayStart = start;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5292 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5293
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5294
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5295 function _fnRenderer( settings, type )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5296 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5297 var renderer = settings.renderer;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5298 var host = DataTable.ext.renderer[type];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5299
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5300 if ( $.isPlainObject( renderer ) && renderer[type] ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5301 // Specific renderer for this type. If available use it, otherwise use
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5302 // the default.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5303 return host[renderer[type]] || host._;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5304 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5305 else if ( typeof renderer === 'string' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5306 // Common renderer - if there is one available for this type use it,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5307 // otherwise use the default
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5308 return host[renderer] || host._;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5309 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5310
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5311 // Use the default
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5312 return host._;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5313 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5314
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5315
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5316 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5317 * Detect the data source being used for the table. Used to simplify the code
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5318 * a little (ajax) and to make it compress a little smaller.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5319 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5320 * @param {object} settings dataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5321 * @returns {string} Data source
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5322 * @memberof DataTable#oApi
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5323 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5324 function _fnDataSource ( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5325 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5326 if ( settings.oFeatures.bServerSide ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5327 return 'ssp';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5328 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5329 else if ( settings.ajax || settings.sAjaxSource ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5330 return 'ajax';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5331 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5332 return 'dom';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5333 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5334
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5335
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5336 DataTable = function( options )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5337 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5338 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5339 * Perform a jQuery selector action on the table's TR elements (from the tbody) and
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5340 * return the resulting jQuery object.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5341 * @param {string|node|jQuery} sSelector jQuery selector or node collection to act on
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5342 * @param {object} [oOpts] Optional parameters for modifying the rows to be included
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5343 * @param {string} [oOpts.filter=none] Select TR elements that meet the current filter
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5344 * criterion ("applied") or all TR elements (i.e. no filter).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5345 * @param {string} [oOpts.order=current] Order of the TR elements in the processed array.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5346 * Can be either 'current', whereby the current sorting of the table is used, or
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5347 * 'original' whereby the original order the data was read into the table is used.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5348 * @param {string} [oOpts.page=all] Limit the selection to the currently displayed page
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5349 * ("current") or not ("all"). If 'current' is given, then order is assumed to be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5350 * 'current' and filter is 'applied', regardless of what they might be given as.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5351 * @returns {object} jQuery object, filtered by the given selector.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5352 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5353 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5354 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5355 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5356 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5357 * var oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5358 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5359 * // Highlight every second row
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5360 * oTable.$('tr:odd').css('backgroundColor', 'blue');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5361 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5362 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5363 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5364 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5365 * var oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5366 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5367 * // Filter to rows with 'Webkit' in them, add a background colour and then
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5368 * // remove the filter, thus highlighting the 'Webkit' rows only.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5369 * oTable.fnFilter('Webkit');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5370 * oTable.$('tr', {"search": "applied"}).css('backgroundColor', 'blue');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5371 * oTable.fnFilter('');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5372 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5373 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5374 this.$ = function ( sSelector, oOpts )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5375 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5376 return this.api(true).$( sSelector, oOpts );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5377 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5378
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5379
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5380 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5381 * Almost identical to $ in operation, but in this case returns the data for the matched
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5382 * rows - as such, the jQuery selector used should match TR row nodes or TD/TH cell nodes
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5383 * rather than any descendants, so the data can be obtained for the row/cell. If matching
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5384 * rows are found, the data returned is the original data array/object that was used to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5385 * create the row (or a generated array if from a DOM source).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5386 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5387 * This method is often useful in-combination with $ where both functions are given the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5388 * same parameters and the array indexes will match identically.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5389 * @param {string|node|jQuery} sSelector jQuery selector or node collection to act on
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5390 * @param {object} [oOpts] Optional parameters for modifying the rows to be included
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5391 * @param {string} [oOpts.filter=none] Select elements that meet the current filter
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5392 * criterion ("applied") or all elements (i.e. no filter).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5393 * @param {string} [oOpts.order=current] Order of the data in the processed array.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5394 * Can be either 'current', whereby the current sorting of the table is used, or
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5395 * 'original' whereby the original order the data was read into the table is used.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5396 * @param {string} [oOpts.page=all] Limit the selection to the currently displayed page
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5397 * ("current") or not ("all"). If 'current' is given, then order is assumed to be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5398 * 'current' and filter is 'applied', regardless of what they might be given as.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5399 * @returns {array} Data for the matched elements. If any elements, as a result of the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5400 * selector, were not TR, TD or TH elements in the DataTable, they will have a null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5401 * entry in the array.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5402 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5403 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5404 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5405 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5406 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5407 * var oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5408 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5409 * // Get the data from the first row in the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5410 * var data = oTable._('tr:first');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5411 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5412 * // Do something useful with the data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5413 * alert( "First cell is: "+data[0] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5414 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5415 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5416 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5417 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5418 * var oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5419 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5420 * // Filter to 'Webkit' and get all data for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5421 * oTable.fnFilter('Webkit');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5422 * var data = oTable._('tr', {"search": "applied"});
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5423 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5424 * // Do something with the data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5425 * alert( data.length+" rows matched the search" );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5426 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5427 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5428 this._ = function ( sSelector, oOpts )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5429 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5430 return this.api(true).rows( sSelector, oOpts ).data();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5431 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5432
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5433
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5434 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5435 * Create a DataTables Api instance, with the currently selected tables for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5436 * the Api's context.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5437 * @param {boolean} [traditional=false] Set the API instance's context to be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5438 * only the table referred to by the `DataTable.ext.iApiIndex` option, as was
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5439 * used in the API presented by DataTables 1.9- (i.e. the traditional mode),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5440 * or if all tables captured in the jQuery object should be used.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5441 * @return {DataTables.Api}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5442 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5443 this.api = function ( traditional )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5444 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5445 return traditional ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5446 new _Api(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5447 _fnSettingsFromNode( this[ _ext.iApiIndex ] )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5448 ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5449 new _Api( this );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5450 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5451
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5452
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5453 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5454 * Add a single new row or multiple rows of data to the table. Please note
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5455 * that this is suitable for client-side processing only - if you are using
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5456 * server-side processing (i.e. "bServerSide": true), then to add data, you
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5457 * must add it to the data source, i.e. the server-side, through an Ajax call.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5458 * @param {array|object} data The data to be added to the table. This can be:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5459 * <ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5460 * <li>1D array of data - add a single row with the data provided</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5461 * <li>2D array of arrays - add multiple rows in a single call</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5462 * <li>object - data object when using <i>mData</i></li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5463 * <li>array of objects - multiple data objects when using <i>mData</i></li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5464 * </ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5465 * @param {bool} [redraw=true] redraw the table or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5466 * @returns {array} An array of integers, representing the list of indexes in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5467 * <i>aoData</i> ({@link DataTable.models.oSettings}) that have been added to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5468 * the table.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5469 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5470 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5471 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5472 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5473 * // Global var for counter
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5474 * var giCount = 2;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5475 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5476 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5477 * $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5478 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5479 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5480 * function fnClickAddRow() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5481 * $('#example').dataTable().fnAddData( [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5482 * giCount+".1",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5483 * giCount+".2",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5484 * giCount+".3",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5485 * giCount+".4" ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5486 * );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5487 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5488 * giCount++;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5489 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5490 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5491 this.fnAddData = function( data, redraw )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5492 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5493 var api = this.api( true );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5494
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5495 /* Check if we want to add multiple rows or not */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5496 var rows = $.isArray(data) && ( $.isArray(data[0]) || $.isPlainObject(data[0]) ) ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5497 api.rows.add( data ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5498 api.row.add( data );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5499
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5500 if ( redraw === undefined || redraw ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5501 api.draw();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5502 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5503
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5504 return rows.flatten().toArray();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5505 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5506
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5507
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5508 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5509 * This function will make DataTables recalculate the column sizes, based on the data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5510 * contained in the table and the sizes applied to the columns (in the DOM, CSS or
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5511 * through the sWidth parameter). This can be useful when the width of the table's
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5512 * parent element changes (for example a window resize).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5513 * @param {boolean} [bRedraw=true] Redraw the table or not, you will typically want to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5514 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5515 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5516 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5517 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5518 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5519 * var oTable = $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5520 * "sScrollY": "200px",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5521 * "bPaginate": false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5522 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5523 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5524 * $(window).bind('resize', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5525 * oTable.fnAdjustColumnSizing();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5526 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5527 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5528 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5529 this.fnAdjustColumnSizing = function ( bRedraw )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5530 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5531 var api = this.api( true ).columns.adjust();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5532 var settings = api.settings()[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5533 var scroll = settings.oScroll;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5534
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5535 if ( bRedraw === undefined || bRedraw ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5536 api.draw( false );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5537 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5538 else if ( scroll.sX !== "" || scroll.sY !== "" ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5539 /* If not redrawing, but scrolling, we want to apply the new column sizes anyway */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5540 _fnScrollDraw( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5541 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5542 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5543
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5544
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5545 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5546 * Quickly and simply clear a table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5547 * @param {bool} [bRedraw=true] redraw the table or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5548 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5549 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5550 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5551 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5552 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5553 * var oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5554 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5555 * // Immediately 'nuke' the current rows (perhaps waiting for an Ajax callback...)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5556 * oTable.fnClearTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5557 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5558 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5559 this.fnClearTable = function( bRedraw )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5560 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5561 var api = this.api( true ).clear();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5562
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5563 if ( bRedraw === undefined || bRedraw ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5564 api.draw();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5565 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5566 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5567
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5568
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5569 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5570 * The exact opposite of 'opening' a row, this function will close any rows which
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5571 * are currently 'open'.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5572 * @param {node} nTr the table row to 'close'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5573 * @returns {int} 0 on success, or 1 if failed (can't find the row)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5574 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5575 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5576 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5577 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5578 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5579 * var oTable;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5580 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5581 * // 'open' an information row when a row is clicked on
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5582 * $('#example tbody tr').click( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5583 * if ( oTable.fnIsOpen(this) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5584 * oTable.fnClose( this );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5585 * } else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5586 * oTable.fnOpen( this, "Temporary row opened", "info_row" );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5587 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5588 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5589 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5590 * oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5591 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5592 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5593 this.fnClose = function( nTr )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5594 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5595 this.api( true ).row( nTr ).child.hide();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5596 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5597
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5598
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5599 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5600 * Remove a row for the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5601 * @param {mixed} target The index of the row from aoData to be deleted, or
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5602 * the TR element you want to delete
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5603 * @param {function|null} [callBack] Callback function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5604 * @param {bool} [redraw=true] Redraw the table or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5605 * @returns {array} The row that was deleted
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5606 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5607 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5608 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5609 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5610 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5611 * var oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5612 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5613 * // Immediately remove the first row
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5614 * oTable.fnDeleteRow( 0 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5615 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5616 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5617 this.fnDeleteRow = function( target, callback, redraw )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5618 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5619 var api = this.api( true );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5620 var rows = api.rows( target );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5621 var settings = rows.settings()[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5622 var data = settings.aoData[ rows[0][0] ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5623
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5624 rows.remove();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5625
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5626 if ( callback ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5627 callback.call( this, settings, data );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5628 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5629
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5630 if ( redraw === undefined || redraw ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5631 api.draw();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5632 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5633
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5634 return data;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5635 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5636
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5637
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5638 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5639 * Restore the table to it's original state in the DOM by removing all of DataTables
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5640 * enhancements, alterations to the DOM structure of the table and event listeners.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5641 * @param {boolean} [remove=false] Completely remove the table from the DOM
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5642 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5643 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5644 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5645 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5646 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5647 * // This example is fairly pointless in reality, but shows how fnDestroy can be used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5648 * var oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5649 * oTable.fnDestroy();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5650 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5651 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5652 this.fnDestroy = function ( remove )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5653 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5654 this.api( true ).destroy( remove );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5655 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5656
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5657
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5658 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5659 * Redraw the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5660 * @param {bool} [complete=true] Re-filter and resort (if enabled) the table before the draw.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5661 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5662 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5663 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5664 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5665 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5666 * var oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5667 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5668 * // Re-draw the table - you wouldn't want to do it here, but it's an example :-)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5669 * oTable.fnDraw();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5670 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5671 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5672 this.fnDraw = function( complete )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5673 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5674 // Note that this isn't an exact match to the old call to _fnDraw - it takes
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5675 // into account the new data, but can hold position.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5676 this.api( true ).draw( complete );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5677 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5678
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5679
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5680 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5681 * Filter the input based on data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5682 * @param {string} sInput String to filter the table on
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5683 * @param {int|null} [iColumn] Column to limit filtering to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5684 * @param {bool} [bRegex=false] Treat as regular expression or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5685 * @param {bool} [bSmart=true] Perform smart filtering or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5686 * @param {bool} [bShowGlobal=true] Show the input global filter in it's input box(es)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5687 * @param {bool} [bCaseInsensitive=true] Do case-insensitive matching (true) or not (false)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5688 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5689 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5690 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5691 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5692 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5693 * var oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5694 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5695 * // Sometime later - filter...
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5696 * oTable.fnFilter( 'test string' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5697 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5698 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5699 this.fnFilter = function( sInput, iColumn, bRegex, bSmart, bShowGlobal, bCaseInsensitive )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5700 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5701 var api = this.api( true );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5702
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5703 if ( iColumn === null || iColumn === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5704 api.search( sInput, bRegex, bSmart, bCaseInsensitive );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5705 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5706 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5707 api.column( iColumn ).search( sInput, bRegex, bSmart, bCaseInsensitive );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5708 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5709
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5710 api.draw();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5711 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5712
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5713
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5714 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5715 * Get the data for the whole table, an individual row or an individual cell based on the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5716 * provided parameters.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5717 * @param {int|node} [src] A TR row node, TD/TH cell node or an integer. If given as
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5718 * a TR node then the data source for the whole row will be returned. If given as a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5719 * TD/TH cell node then iCol will be automatically calculated and the data for the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5720 * cell returned. If given as an integer, then this is treated as the aoData internal
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5721 * data index for the row (see fnGetPosition) and the data for that row used.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5722 * @param {int} [col] Optional column index that you want the data of.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5723 * @returns {array|object|string} If mRow is undefined, then the data for all rows is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5724 * returned. If mRow is defined, just data for that row, and is iCol is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5725 * defined, only data for the designated cell is returned.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5726 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5727 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5728 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5729 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5730 * // Row data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5731 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5732 * oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5733 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5734 * oTable.$('tr').click( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5735 * var data = oTable.fnGetData( this );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5736 * // ... do something with the array / object of data for the row
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5737 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5738 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5739 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5740 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5741 * // Individual cell data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5742 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5743 * oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5744 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5745 * oTable.$('td').click( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5746 * var sData = oTable.fnGetData( this );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5747 * alert( 'The cell clicked on had the value of '+sData );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5748 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5749 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5750 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5751 this.fnGetData = function( src, col )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5752 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5753 var api = this.api( true );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5754
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5755 if ( src !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5756 var type = src.nodeName ? src.nodeName.toLowerCase() : '';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5757
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5758 return col !== undefined || type == 'td' || type == 'th' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5759 api.cell( src, col ).data() :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5760 api.row( src ).data() || null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5761 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5762
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5763 return api.data().toArray();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5764 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5765
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5766
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5767 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5768 * Get an array of the TR nodes that are used in the table's body. Note that you will
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5769 * typically want to use the '$' API method in preference to this as it is more
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5770 * flexible.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5771 * @param {int} [iRow] Optional row index for the TR element you want
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5772 * @returns {array|node} If iRow is undefined, returns an array of all TR elements
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5773 * in the table's body, or iRow is defined, just the TR element requested.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5774 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5775 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5776 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5777 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5778 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5779 * var oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5780 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5781 * // Get the nodes from the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5782 * var nNodes = oTable.fnGetNodes( );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5783 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5784 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5785 this.fnGetNodes = function( iRow )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5786 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5787 var api = this.api( true );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5788
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5789 return iRow !== undefined ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5790 api.row( iRow ).node() :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5791 api.rows().nodes().flatten().toArray();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5792 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5793
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5794
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5795 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5796 * Get the array indexes of a particular cell from it's DOM element
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5797 * and column index including hidden columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5798 * @param {node} node this can either be a TR, TD or TH in the table's body
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5799 * @returns {int} If nNode is given as a TR, then a single index is returned, or
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5800 * if given as a cell, an array of [row index, column index (visible),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5801 * column index (all)] is given.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5802 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5803 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5804 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5805 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5806 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5807 * $('#example tbody td').click( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5808 * // Get the position of the current data from the node
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5809 * var aPos = oTable.fnGetPosition( this );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5810 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5811 * // Get the data array for this row
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5812 * var aData = oTable.fnGetData( aPos[0] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5813 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5814 * // Update the data array and return the value
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5815 * aData[ aPos[1] ] = 'clicked';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5816 * this.innerHTML = 'clicked';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5817 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5818 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5819 * // Init DataTables
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5820 * oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5821 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5822 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5823 this.fnGetPosition = function( node )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5824 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5825 var api = this.api( true );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5826 var nodeName = node.nodeName.toUpperCase();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5827
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5828 if ( nodeName == 'TR' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5829 return api.row( node ).index();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5830 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5831 else if ( nodeName == 'TD' || nodeName == 'TH' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5832 var cell = api.cell( node ).index();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5833
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5834 return [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5835 cell.row,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5836 cell.columnVisible,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5837 cell.column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5838 ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5839 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5840 return null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5841 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5842
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5843
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5844 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5845 * Check to see if a row is 'open' or not.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5846 * @param {node} nTr the table row to check
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5847 * @returns {boolean} true if the row is currently open, false otherwise
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5848 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5849 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5850 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5851 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5852 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5853 * var oTable;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5854 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5855 * // 'open' an information row when a row is clicked on
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5856 * $('#example tbody tr').click( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5857 * if ( oTable.fnIsOpen(this) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5858 * oTable.fnClose( this );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5859 * } else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5860 * oTable.fnOpen( this, "Temporary row opened", "info_row" );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5861 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5862 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5863 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5864 * oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5865 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5866 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5867 this.fnIsOpen = function( nTr )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5868 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5869 return this.api( true ).row( nTr ).child.isShown();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5870 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5871
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5872
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5873 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5874 * This function will place a new row directly after a row which is currently
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5875 * on display on the page, with the HTML contents that is passed into the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5876 * function. This can be used, for example, to ask for confirmation that a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5877 * particular record should be deleted.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5878 * @param {node} nTr The table row to 'open'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5879 * @param {string|node|jQuery} mHtml The HTML to put into the row
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5880 * @param {string} sClass Class to give the new TD cell
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5881 * @returns {node} The row opened. Note that if the table row passed in as the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5882 * first parameter, is not found in the table, this method will silently
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5883 * return.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5884 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5885 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5886 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5887 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5888 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5889 * var oTable;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5890 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5891 * // 'open' an information row when a row is clicked on
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5892 * $('#example tbody tr').click( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5893 * if ( oTable.fnIsOpen(this) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5894 * oTable.fnClose( this );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5895 * } else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5896 * oTable.fnOpen( this, "Temporary row opened", "info_row" );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5897 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5898 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5899 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5900 * oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5901 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5902 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5903 this.fnOpen = function( nTr, mHtml, sClass )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5904 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5905 return this.api( true )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5906 .row( nTr )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5907 .child( mHtml, sClass )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5908 .show()
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5909 .child()[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5910 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5911
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5912
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5913 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5914 * Change the pagination - provides the internal logic for pagination in a simple API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5915 * function. With this function you can have a DataTables table go to the next,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5916 * previous, first or last pages.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5917 * @param {string|int} mAction Paging action to take: "first", "previous", "next" or "last"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5918 * or page number to jump to (integer), note that page 0 is the first page.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5919 * @param {bool} [bRedraw=true] Redraw the table or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5920 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5921 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5922 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5923 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5924 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5925 * var oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5926 * oTable.fnPageChange( 'next' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5927 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5928 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5929 this.fnPageChange = function ( mAction, bRedraw )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5930 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5931 var api = this.api( true ).page( mAction );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5932
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5933 if ( bRedraw === undefined || bRedraw ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5934 api.draw(false);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5935 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5936 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5937
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5938
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5939 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5940 * Show a particular column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5941 * @param {int} iCol The column whose display should be changed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5942 * @param {bool} bShow Show (true) or hide (false) the column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5943 * @param {bool} [bRedraw=true] Redraw the table or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5944 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5945 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5946 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5947 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5948 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5949 * var oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5950 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5951 * // Hide the second column after initialisation
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5952 * oTable.fnSetColumnVis( 1, false );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5953 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5954 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5955 this.fnSetColumnVis = function ( iCol, bShow, bRedraw )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5956 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5957 var api = this.api( true ).column( iCol ).visible( bShow );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5958
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5959 if ( bRedraw === undefined || bRedraw ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5960 api.columns.adjust().draw();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5961 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5962 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5963
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5964
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5965 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5966 * Get the settings for a particular table for external manipulation
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5967 * @returns {object} DataTables settings object. See
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5968 * {@link DataTable.models.oSettings}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5969 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5970 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5971 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5972 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5973 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5974 * var oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5975 * var oSettings = oTable.fnSettings();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5976 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5977 * // Show an example parameter from the settings
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5978 * alert( oSettings._iDisplayStart );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5979 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5980 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5981 this.fnSettings = function()
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5982 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5983 return _fnSettingsFromNode( this[_ext.iApiIndex] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5984 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5985
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5986
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5987 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5988 * Sort the table by a particular column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5989 * @param {int} iCol the data index to sort on. Note that this will not match the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5990 * 'display index' if you have hidden data entries
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5991 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5992 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5993 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5994 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5995 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5996 * var oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5997 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5998 * // Sort immediately with columns 0 and 1
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
5999 * oTable.fnSort( [ [0,'asc'], [1,'asc'] ] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6000 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6001 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6002 this.fnSort = function( aaSort )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6003 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6004 this.api( true ).order( aaSort ).draw();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6005 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6006
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6007
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6008 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6009 * Attach a sort listener to an element for a given column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6010 * @param {node} nNode the element to attach the sort listener to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6011 * @param {int} iColumn the column that a click on this node will sort on
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6012 * @param {function} [fnCallback] callback function when sort is run
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6013 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6014 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6015 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6016 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6017 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6018 * var oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6019 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6020 * // Sort on column 1, when 'sorter' is clicked on
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6021 * oTable.fnSortListener( document.getElementById('sorter'), 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6022 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6023 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6024 this.fnSortListener = function( nNode, iColumn, fnCallback )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6025 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6026 this.api( true ).order.listener( nNode, iColumn, fnCallback );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6027 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6028
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6029
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6030 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6031 * Update a table cell or row - this method will accept either a single value to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6032 * update the cell with, an array of values with one element for each column or
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6033 * an object in the same format as the original data source. The function is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6034 * self-referencing in order to make the multi column updates easier.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6035 * @param {object|array|string} mData Data to update the cell/row with
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6036 * @param {node|int} mRow TR element you want to update or the aoData index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6037 * @param {int} [iColumn] The column to update, give as null or undefined to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6038 * update a whole row.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6039 * @param {bool} [bRedraw=true] Redraw the table or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6040 * @param {bool} [bAction=true] Perform pre-draw actions or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6041 * @returns {int} 0 on success, 1 on error
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6042 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6043 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6044 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6045 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6046 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6047 * var oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6048 * oTable.fnUpdate( 'Example update', 0, 0 ); // Single cell
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6049 * oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], $('tbody tr')[0] ); // Row
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6050 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6051 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6052 this.fnUpdate = function( mData, mRow, iColumn, bRedraw, bAction )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6053 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6054 var api = this.api( true );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6055
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6056 if ( iColumn === undefined || iColumn === null ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6057 api.row( mRow ).data( mData );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6058 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6059 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6060 api.cell( mRow, iColumn ).data( mData );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6061 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6062
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6063 if ( bAction === undefined || bAction ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6064 api.columns.adjust();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6065 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6066
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6067 if ( bRedraw === undefined || bRedraw ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6068 api.draw();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6069 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6070 return 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6071 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6072
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6073
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6074 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6075 * Provide a common method for plug-ins to check the version of DataTables being used, in order
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6076 * to ensure compatibility.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6077 * @param {string} sVersion Version string to check for, in the format "X.Y.Z". Note that the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6078 * formats "X" and "X.Y" are also acceptable.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6079 * @returns {boolean} true if this version of DataTables is greater or equal to the required
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6080 * version, or false if this version of DataTales is not suitable
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6081 * @method
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6082 * @dtopt API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6083 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6084 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6085 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6086 * $(document).ready(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6087 * var oTable = $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6088 * alert( oTable.fnVersionCheck( '1.9.0' ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6089 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6090 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6091 this.fnVersionCheck = _ext.fnVersionCheck;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6092
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6093
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6094 var _that = this;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6095 var emptyInit = options === undefined;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6096 var len = this.length;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6097
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6098 if ( emptyInit ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6099 options = {};
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6100 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6101
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6102 this.oApi = this.internal = _ext.internal;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6103
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6104 // Extend with old style plug-in API methods
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6105 for ( var fn in DataTable.ext.internal ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6106 if ( fn ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6107 this[fn] = _fnExternApiFunc(fn);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6108 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6109 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6110
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6111 this.each(function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6112 // For each initialisation we want to give it a clean initialisation
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6113 // object that can be bashed around
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6114 var o = {};
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6115 var oInit = len > 1 ? // optimisation for single table case
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6116 _fnExtend( o, options, true ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6117 options;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6118
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6119 /*global oInit,_that,emptyInit*/
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6120 var i=0, iLen, j, jLen, k, kLen;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6121 var sId = this.getAttribute( 'id' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6122 var bInitHandedOff = false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6123 var defaults = DataTable.defaults;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6124 var $this = $(this);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6125
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6126
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6127 /* Sanity check */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6128 if ( this.nodeName.toLowerCase() != 'table' )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6129 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6130 _fnLog( null, 0, 'Non-table node initialisation ('+this.nodeName+')', 2 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6131 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6132 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6133
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6134 /* Backwards compatibility for the defaults */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6135 _fnCompatOpts( defaults );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6136 _fnCompatCols( defaults.column );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6137
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6138 /* Convert the camel-case defaults to Hungarian */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6139 _fnCamelToHungarian( defaults, defaults, true );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6140 _fnCamelToHungarian( defaults.column, defaults.column, true );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6141
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6142 /* Setting up the initialisation object */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6143 _fnCamelToHungarian( defaults, $.extend( oInit, $this.data() ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6144
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6145
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6146
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6147 /* Check to see if we are re-initialising a table */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6148 var allSettings = DataTable.settings;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6149 for ( i=0, iLen=allSettings.length ; i<iLen ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6150 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6151 var s = allSettings[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6152
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6153 /* Base check on table node */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6154 if ( s.nTable == this || s.nTHead.parentNode == this || (s.nTFoot && s.nTFoot.parentNode == this) )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6155 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6156 var bRetrieve = oInit.bRetrieve !== undefined ? oInit.bRetrieve : defaults.bRetrieve;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6157 var bDestroy = oInit.bDestroy !== undefined ? oInit.bDestroy : defaults.bDestroy;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6158
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6159 if ( emptyInit || bRetrieve )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6160 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6161 return s.oInstance;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6162 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6163 else if ( bDestroy )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6164 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6165 s.oInstance.fnDestroy();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6166 break;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6167 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6168 else
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6169 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6170 _fnLog( s, 0, 'Cannot reinitialise DataTable', 3 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6171 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6172 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6173 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6174
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6175 /* If the element we are initialising has the same ID as a table which was previously
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6176 * initialised, but the table nodes don't match (from before) then we destroy the old
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6177 * instance by simply deleting it. This is under the assumption that the table has been
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6178 * destroyed by other methods. Anyone using non-id selectors will need to do this manually
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6179 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6180 if ( s.sTableId == this.id )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6181 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6182 allSettings.splice( i, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6183 break;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6184 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6185 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6186
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6187 /* Ensure the table has an ID - required for accessibility */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6188 if ( sId === null || sId === "" )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6189 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6190 sId = "DataTables_Table_"+(DataTable.ext._unique++);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6191 this.id = sId;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6192 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6193
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6194 /* Create the settings object for this table and set some of the default parameters */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6195 var oSettings = $.extend( true, {}, DataTable.models.oSettings, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6196 "sDestroyWidth": $this[0].style.width,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6197 "sInstance": sId,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6198 "sTableId": sId
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6199 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6200 oSettings.nTable = this;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6201 oSettings.oApi = _that.internal;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6202 oSettings.oInit = oInit;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6203
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6204 allSettings.push( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6205
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6206 // Need to add the instance after the instance after the settings object has been added
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6207 // to the settings array, so we can self reference the table instance if more than one
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6208 oSettings.oInstance = (_that.length===1) ? _that : $this.dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6209
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6210 // Backwards compatibility, before we apply all the defaults
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6211 _fnCompatOpts( oInit );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6212
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6213 if ( oInit.oLanguage )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6214 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6215 _fnLanguageCompat( oInit.oLanguage );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6216 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6217
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6218 // If the length menu is given, but the init display length is not, use the length menu
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6219 if ( oInit.aLengthMenu && ! oInit.iDisplayLength )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6220 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6221 oInit.iDisplayLength = $.isArray( oInit.aLengthMenu[0] ) ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6222 oInit.aLengthMenu[0][0] : oInit.aLengthMenu[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6223 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6224
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6225 // Apply the defaults and init options to make a single init object will all
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6226 // options defined from defaults and instance options.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6227 oInit = _fnExtend( $.extend( true, {}, defaults ), oInit );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6228
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6229
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6230 // Map the initialisation options onto the settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6231 _fnMap( oSettings.oFeatures, oInit, [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6232 "bPaginate",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6233 "bLengthChange",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6234 "bFilter",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6235 "bSort",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6236 "bSortMulti",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6237 "bInfo",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6238 "bProcessing",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6239 "bAutoWidth",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6240 "bSortClasses",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6241 "bServerSide",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6242 "bDeferRender"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6243 ] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6244 _fnMap( oSettings, oInit, [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6245 "asStripeClasses",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6246 "ajax",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6247 "fnServerData",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6248 "fnFormatNumber",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6249 "sServerMethod",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6250 "aaSorting",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6251 "aaSortingFixed",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6252 "aLengthMenu",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6253 "sPaginationType",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6254 "sAjaxSource",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6255 "sAjaxDataProp",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6256 "iStateDuration",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6257 "sDom",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6258 "bSortCellsTop",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6259 "iTabIndex",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6260 "fnStateLoadCallback",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6261 "fnStateSaveCallback",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6262 "renderer",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6263 "searchDelay",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6264 "rowId",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6265 [ "iCookieDuration", "iStateDuration" ], // backwards compat
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6266 [ "oSearch", "oPreviousSearch" ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6267 [ "aoSearchCols", "aoPreSearchCols" ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6268 [ "iDisplayLength", "_iDisplayLength" ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6269 [ "bJQueryUI", "bJUI" ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6270 ] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6271 _fnMap( oSettings.oScroll, oInit, [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6272 [ "sScrollX", "sX" ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6273 [ "sScrollXInner", "sXInner" ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6274 [ "sScrollY", "sY" ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6275 [ "bScrollCollapse", "bCollapse" ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6276 ] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6277 _fnMap( oSettings.oLanguage, oInit, "fnInfoCallback" );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6278
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6279 /* Callback functions which are array driven */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6280 _fnCallbackReg( oSettings, 'aoDrawCallback', oInit.fnDrawCallback, 'user' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6281 _fnCallbackReg( oSettings, 'aoServerParams', oInit.fnServerParams, 'user' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6282 _fnCallbackReg( oSettings, 'aoStateSaveParams', oInit.fnStateSaveParams, 'user' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6283 _fnCallbackReg( oSettings, 'aoStateLoadParams', oInit.fnStateLoadParams, 'user' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6284 _fnCallbackReg( oSettings, 'aoStateLoaded', oInit.fnStateLoaded, 'user' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6285 _fnCallbackReg( oSettings, 'aoRowCallback', oInit.fnRowCallback, 'user' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6286 _fnCallbackReg( oSettings, 'aoRowCreatedCallback', oInit.fnCreatedRow, 'user' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6287 _fnCallbackReg( oSettings, 'aoHeaderCallback', oInit.fnHeaderCallback, 'user' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6288 _fnCallbackReg( oSettings, 'aoFooterCallback', oInit.fnFooterCallback, 'user' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6289 _fnCallbackReg( oSettings, 'aoInitComplete', oInit.fnInitComplete, 'user' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6290 _fnCallbackReg( oSettings, 'aoPreDrawCallback', oInit.fnPreDrawCallback, 'user' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6291
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6292 oSettings.rowIdFn = _fnGetObjectDataFn( oInit.rowId );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6293
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6294 /* Browser support detection */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6295 _fnBrowserDetect( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6296
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6297 var oClasses = oSettings.oClasses;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6298
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6299 // @todo Remove in 1.11
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6300 if ( oInit.bJQueryUI )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6301 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6302 /* Use the JUI classes object for display. You could clone the oStdClasses object if
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6303 * you want to have multiple tables with multiple independent classes
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6304 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6305 $.extend( oClasses, DataTable.ext.oJUIClasses, oInit.oClasses );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6306
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6307 if ( oInit.sDom === defaults.sDom && defaults.sDom === "lfrtip" )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6308 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6309 /* Set the DOM to use a layout suitable for jQuery UI's theming */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6310 oSettings.sDom = '<"H"lfr>t<"F"ip>';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6311 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6312
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6313 if ( ! oSettings.renderer ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6314 oSettings.renderer = 'jqueryui';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6315 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6316 else if ( $.isPlainObject( oSettings.renderer ) && ! oSettings.renderer.header ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6317 oSettings.renderer.header = 'jqueryui';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6318 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6319 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6320 else
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6321 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6322 $.extend( oClasses, DataTable.ext.classes, oInit.oClasses );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6323 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6324 $this.addClass( oClasses.sTable );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6325
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6326
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6327 if ( oSettings.iInitDisplayStart === undefined )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6328 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6329 /* Display start point, taking into account the save saving */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6330 oSettings.iInitDisplayStart = oInit.iDisplayStart;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6331 oSettings._iDisplayStart = oInit.iDisplayStart;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6332 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6333
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6334 if ( oInit.iDeferLoading !== null )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6335 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6336 oSettings.bDeferLoading = true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6337 var tmp = $.isArray( oInit.iDeferLoading );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6338 oSettings._iRecordsDisplay = tmp ? oInit.iDeferLoading[0] : oInit.iDeferLoading;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6339 oSettings._iRecordsTotal = tmp ? oInit.iDeferLoading[1] : oInit.iDeferLoading;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6340 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6341
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6342 /* Language definitions */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6343 var oLanguage = oSettings.oLanguage;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6344 $.extend( true, oLanguage, oInit.oLanguage );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6345
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6346 if ( oLanguage.sUrl !== "" )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6347 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6348 /* Get the language definitions from a file - because this Ajax call makes the language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6349 * get async to the remainder of this function we use bInitHandedOff to indicate that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6350 * _fnInitialise will be fired by the returned Ajax handler, rather than the constructor
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6351 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6352 $.ajax( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6353 dataType: 'json',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6354 url: oLanguage.sUrl,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6355 success: function ( json ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6356 _fnLanguageCompat( json );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6357 _fnCamelToHungarian( defaults.oLanguage, json );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6358 $.extend( true, oLanguage, json );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6359 _fnInitialise( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6360 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6361 error: function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6362 // Error occurred loading language file, continue on as best we can
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6363 _fnInitialise( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6364 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6365 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6366 bInitHandedOff = true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6367 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6368
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6369 /*
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6370 * Stripes
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6371 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6372 if ( oInit.asStripeClasses === null )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6373 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6374 oSettings.asStripeClasses =[
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6375 oClasses.sStripeOdd,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6376 oClasses.sStripeEven
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6377 ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6378 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6379
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6380 /* Remove row stripe classes if they are already on the table row */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6381 var stripeClasses = oSettings.asStripeClasses;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6382 var rowOne = $this.children('tbody').find('tr').eq(0);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6383 if ( $.inArray( true, $.map( stripeClasses, function(el, i) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6384 return rowOne.hasClass(el);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6385 } ) ) !== -1 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6386 $('tbody tr', this).removeClass( stripeClasses.join(' ') );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6387 oSettings.asDestroyStripes = stripeClasses.slice();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6388 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6389
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6390 /*
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6391 * Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6392 * See if we should load columns automatically or use defined ones
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6393 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6394 var anThs = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6395 var aoColumnsInit;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6396 var nThead = this.getElementsByTagName('thead');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6397 if ( nThead.length !== 0 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6398 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6399 _fnDetectHeader( oSettings.aoHeader, nThead[0] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6400 anThs = _fnGetUniqueThs( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6401 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6402
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6403 /* If not given a column array, generate one with nulls */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6404 if ( oInit.aoColumns === null )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6405 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6406 aoColumnsInit = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6407 for ( i=0, iLen=anThs.length ; i<iLen ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6408 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6409 aoColumnsInit.push( null );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6410 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6411 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6412 else
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6413 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6414 aoColumnsInit = oInit.aoColumns;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6415 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6416
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6417 /* Add the columns */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6418 for ( i=0, iLen=aoColumnsInit.length ; i<iLen ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6419 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6420 _fnAddColumn( oSettings, anThs ? anThs[i] : null );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6421 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6422
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6423 /* Apply the column definitions */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6424 _fnApplyColumnDefs( oSettings, oInit.aoColumnDefs, aoColumnsInit, function (iCol, oDef) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6425 _fnColumnOptions( oSettings, iCol, oDef );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6426 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6427
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6428 /* HTML5 attribute detection - build an mData object automatically if the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6429 * attributes are found
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6430 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6431 if ( rowOne.length ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6432 var a = function ( cell, name ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6433 return cell.getAttribute( 'data-'+name ) !== null ? name : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6434 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6435
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6436 $( rowOne[0] ).children('th, td').each( function (i, cell) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6437 var col = oSettings.aoColumns[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6438
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6439 if ( col.mData === i ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6440 var sort = a( cell, 'sort' ) || a( cell, 'order' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6441 var filter = a( cell, 'filter' ) || a( cell, 'search' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6442
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6443 if ( sort !== null || filter !== null ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6444 col.mData = {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6445 _: i+'.display',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6446 sort: sort !== null ? i+'.@data-'+sort : undefined,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6447 type: sort !== null ? i+'.@data-'+sort : undefined,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6448 filter: filter !== null ? i+'.@data-'+filter : undefined
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6449 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6450
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6451 _fnColumnOptions( oSettings, i );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6452 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6453 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6454 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6455 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6456
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6457 var features = oSettings.oFeatures;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6458
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6459 /* Must be done after everything which can be overridden by the state saving! */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6460 if ( oInit.bStateSave )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6461 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6462 features.bStateSave = true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6463 _fnLoadState( oSettings, oInit );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6464 _fnCallbackReg( oSettings, 'aoDrawCallback', _fnSaveState, 'state_save' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6465 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6466
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6467
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6468 /*
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6469 * Sorting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6470 * @todo For modularisation (1.11) this needs to do into a sort start up handler
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6471 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6472
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6473 // If aaSorting is not defined, then we use the first indicator in asSorting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6474 // in case that has been altered, so the default sort reflects that option
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6475 if ( oInit.aaSorting === undefined )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6476 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6477 var sorting = oSettings.aaSorting;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6478 for ( i=0, iLen=sorting.length ; i<iLen ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6479 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6480 sorting[i][1] = oSettings.aoColumns[ i ].asSorting[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6481 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6482 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6483
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6484 /* Do a first pass on the sorting classes (allows any size changes to be taken into
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6485 * account, and also will apply sorting disabled classes if disabled
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6486 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6487 _fnSortingClasses( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6488
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6489 if ( features.bSort )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6490 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6491 _fnCallbackReg( oSettings, 'aoDrawCallback', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6492 if ( oSettings.bSorted ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6493 var aSort = _fnSortFlatten( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6494 var sortedColumns = {};
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6495
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6496 $.each( aSort, function (i, val) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6497 sortedColumns[ val.src ] = val.dir;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6498 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6499
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6500 _fnCallbackFire( oSettings, null, 'order', [oSettings, aSort, sortedColumns] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6501 _fnSortAria( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6502 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6503 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6504 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6505
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6506 _fnCallbackReg( oSettings, 'aoDrawCallback', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6507 if ( oSettings.bSorted || _fnDataSource( oSettings ) === 'ssp' || features.bDeferRender ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6508 _fnSortingClasses( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6509 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6510 }, 'sc' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6511
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6512
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6513 /*
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6514 * Final init
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6515 * Cache the header, body and footer as required, creating them if needed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6516 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6517
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6518 // Work around for Webkit bug 83867 - store the caption-side before removing from doc
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6519 var captions = $this.children('caption').each( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6520 this._captionSide = $this.css('caption-side');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6521 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6522
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6523 var thead = $this.children('thead');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6524 if ( thead.length === 0 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6525 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6526 thead = $('<thead/>').appendTo(this);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6527 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6528 oSettings.nTHead = thead[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6529
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6530 var tbody = $this.children('tbody');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6531 if ( tbody.length === 0 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6532 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6533 tbody = $('<tbody/>').appendTo(this);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6534 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6535 oSettings.nTBody = tbody[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6536
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6537 var tfoot = $this.children('tfoot');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6538 if ( tfoot.length === 0 && captions.length > 0 && (oSettings.oScroll.sX !== "" || oSettings.oScroll.sY !== "") )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6539 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6540 // If we are a scrolling table, and no footer has been given, then we need to create
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6541 // a tfoot element for the caption element to be appended to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6542 tfoot = $('<tfoot/>').appendTo(this);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6543 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6544
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6545 if ( tfoot.length === 0 || tfoot.children().length === 0 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6546 $this.addClass( oClasses.sNoFooter );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6547 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6548 else if ( tfoot.length > 0 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6549 oSettings.nTFoot = tfoot[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6550 _fnDetectHeader( oSettings.aoFooter, oSettings.nTFoot );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6551 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6552
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6553 /* Check if there is data passing into the constructor */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6554 if ( oInit.aaData )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6555 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6556 for ( i=0 ; i<oInit.aaData.length ; i++ )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6557 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6558 _fnAddData( oSettings, oInit.aaData[ i ] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6559 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6560 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6561 else if ( oSettings.bDeferLoading || _fnDataSource( oSettings ) == 'dom' )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6562 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6563 /* Grab the data from the page - only do this when deferred loading or no Ajax
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6564 * source since there is no point in reading the DOM data if we are then going
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6565 * to replace it with Ajax data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6566 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6567 _fnAddTr( oSettings, $(oSettings.nTBody).children('tr') );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6568 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6569
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6570 /* Copy the data index array */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6571 oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6572
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6573 /* Initialisation complete - table can be drawn */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6574 oSettings.bInitialised = true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6575
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6576 /* Check if we need to initialise the table (it might not have been handed off to the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6577 * language processor)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6578 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6579 if ( bInitHandedOff === false )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6580 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6581 _fnInitialise( oSettings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6582 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6583 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6584 _that = null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6585 return this;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6586 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6587
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6588
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6589
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6590 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6591 * Computed structure of the DataTables API, defined by the options passed to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6592 * `DataTable.Api.register()` when building the API.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6593 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6594 * The structure is built in order to speed creation and extension of the Api
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6595 * objects since the extensions are effectively pre-parsed.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6596 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6597 * The array is an array of objects with the following structure, where this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6598 * base array represents the Api prototype base:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6599 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6600 * [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6601 * {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6602 * name: 'data' -- string - Property name
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6603 * val: function () {}, -- function - Api method (or undefined if just an object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6604 * methodExt: [ ... ], -- array - Array of Api object definitions to extend the method result
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6605 * propExt: [ ... ] -- array - Array of Api object definitions to extend the property
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6606 * },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6607 * {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6608 * name: 'row'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6609 * val: {},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6610 * methodExt: [ ... ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6611 * propExt: [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6612 * {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6613 * name: 'data'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6614 * val: function () {},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6615 * methodExt: [ ... ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6616 * propExt: [ ... ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6617 * },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6618 * ...
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6619 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6620 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6621 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6622 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6623 * @type {Array}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6624 * @ignore
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6625 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6626 var __apiStruct = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6627
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6628
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6629 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6630 * `Array.prototype` reference.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6631 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6632 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6633 * @ignore
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6634 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6635 var __arrayProto = Array.prototype;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6636
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6637
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6638 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6639 * Abstraction for `context` parameter of the `Api` constructor to allow it to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6640 * take several different forms for ease of use.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6641 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6642 * Each of the input parameter types will be converted to a DataTables settings
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6643 * object where possible.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6644 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6645 * @param {string|node|jQuery|object} mixed DataTable identifier. Can be one
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6646 * of:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6647 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6648 * * `string` - jQuery selector. Any DataTables' matching the given selector
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6649 * with be found and used.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6650 * * `node` - `TABLE` node which has already been formed into a DataTable.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6651 * * `jQuery` - A jQuery object of `TABLE` nodes.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6652 * * `object` - DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6653 * * `DataTables.Api` - API instance
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6654 * @return {array|null} Matching DataTables settings objects. `null` or
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6655 * `undefined` is returned if no matching DataTable is found.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6656 * @ignore
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6657 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6658 var _toSettings = function ( mixed )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6659 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6660 var idx, jq;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6661 var settings = DataTable.settings;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6662 var tables = $.map( settings, function (el, i) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6663 return el.nTable;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6664 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6665
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6666 if ( ! mixed ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6667 return [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6668 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6669 else if ( mixed.nTable && mixed.oApi ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6670 // DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6671 return [ mixed ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6672 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6673 else if ( mixed.nodeName && mixed.nodeName.toLowerCase() === 'table' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6674 // Table node
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6675 idx = $.inArray( mixed, tables );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6676 return idx !== -1 ? [ settings[idx] ] : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6677 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6678 else if ( mixed && typeof mixed.settings === 'function' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6679 return mixed.settings().toArray();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6680 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6681 else if ( typeof mixed === 'string' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6682 // jQuery selector
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6683 jq = $(mixed);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6684 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6685 else if ( mixed instanceof $ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6686 // jQuery object (also DataTables instance)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6687 jq = mixed;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6688 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6689
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6690 if ( jq ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6691 return jq.map( function(i) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6692 idx = $.inArray( this, tables );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6693 return idx !== -1 ? settings[idx] : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6694 } ).toArray();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6695 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6696 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6697
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6698
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6699 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6700 * DataTables API class - used to control and interface with one or more
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6701 * DataTables enhanced tables.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6702 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6703 * The API class is heavily based on jQuery, presenting a chainable interface
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6704 * that you can use to interact with tables. Each instance of the API class has
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6705 * a "context" - i.e. the tables that it will operate on. This could be a single
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6706 * table, all tables on a page or a sub-set thereof.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6707 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6708 * Additionally the API is designed to allow you to easily work with the data in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6709 * the tables, retrieving and manipulating it as required. This is done by
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6710 * presenting the API class as an array like interface. The contents of the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6711 * array depend upon the actions requested by each method (for example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6712 * `rows().nodes()` will return an array of nodes, while `rows().data()` will
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6713 * return an array of objects or arrays depending upon your table's
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6714 * configuration). The API object has a number of array like methods (`push`,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6715 * `pop`, `reverse` etc) as well as additional helper methods (`each`, `pluck`,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6716 * `unique` etc) to assist your working with the data held in a table.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6717 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6718 * Most methods (those which return an Api instance) are chainable, which means
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6719 * the return from a method call also has all of the methods available that the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6720 * top level object had. For example, these two calls are equivalent:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6721 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6722 * // Not chained
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6723 * api.row.add( {...} );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6724 * api.draw();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6725 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6726 * // Chained
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6727 * api.row.add( {...} ).draw();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6728 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6729 * @class DataTable.Api
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6730 * @param {array|object|string|jQuery} context DataTable identifier. This is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6731 * used to define which DataTables enhanced tables this API will operate on.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6732 * Can be one of:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6733 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6734 * * `string` - jQuery selector. Any DataTables' matching the given selector
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6735 * with be found and used.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6736 * * `node` - `TABLE` node which has already been formed into a DataTable.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6737 * * `jQuery` - A jQuery object of `TABLE` nodes.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6738 * * `object` - DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6739 * @param {array} [data] Data to initialise the Api instance with.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6740 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6741 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6742 * // Direct initialisation during DataTables construction
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6743 * var api = $('#example').DataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6744 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6745 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6746 * // Initialisation using a DataTables jQuery object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6747 * var api = $('#example').dataTable().api();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6748 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6749 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6750 * // Initialisation as a constructor
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6751 * var api = new $.fn.DataTable.Api( 'table.dataTable' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6752 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6753 _Api = function ( context, data )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6754 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6755 if ( ! (this instanceof _Api) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6756 return new _Api( context, data );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6757 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6758
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6759 var settings = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6760 var ctxSettings = function ( o ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6761 var a = _toSettings( o );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6762 if ( a ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6763 settings = settings.concat( a );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6764 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6765 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6766
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6767 if ( $.isArray( context ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6768 for ( var i=0, ien=context.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6769 ctxSettings( context[i] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6770 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6771 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6772 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6773 ctxSettings( context );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6774 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6775
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6776 // Remove duplicates
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6777 this.context = _unique( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6778
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6779 // Initial data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6780 if ( data ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6781 $.merge( this, data );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6782 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6783
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6784 // selector
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6785 this.selector = {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6786 rows: null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6787 cols: null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6788 opts: null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6789 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6790
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6791 _Api.extend( this, this, __apiStruct );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6792 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6793
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6794 DataTable.Api = _Api;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6795
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6796 // Don't destroy the existing prototype, just extend it. Required for jQuery 2's
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6797 // isPlainObject.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6798 $.extend( _Api.prototype, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6799 any: function ()
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6800 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6801 return this.count() !== 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6802 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6803
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6804
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6805 concat: __arrayProto.concat,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6806
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6807
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6808 context: [], // array of table settings objects
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6809
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6810
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6811 count: function ()
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6812 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6813 return this.flatten().length;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6814 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6815
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6816
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6817 each: function ( fn )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6818 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6819 for ( var i=0, ien=this.length ; i<ien; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6820 fn.call( this, this[i], i, this );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6821 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6822
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6823 return this;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6824 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6825
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6826
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6827 eq: function ( idx )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6828 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6829 var ctx = this.context;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6830
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6831 return ctx.length > idx ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6832 new _Api( ctx[idx], this[idx] ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6833 null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6834 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6835
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6836
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6837 filter: function ( fn )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6838 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6839 var a = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6840
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6841 if ( __arrayProto.filter ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6842 a = __arrayProto.filter.call( this, fn, this );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6843 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6844 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6845 // Compatibility for browsers without EMCA-252-5 (JS 1.6)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6846 for ( var i=0, ien=this.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6847 if ( fn.call( this, this[i], i, this ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6848 a.push( this[i] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6849 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6850 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6851 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6852
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6853 return new _Api( this.context, a );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6854 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6855
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6856
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6857 flatten: function ()
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6858 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6859 var a = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6860 return new _Api( this.context, a.concat.apply( a, this.toArray() ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6861 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6862
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6863
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6864 join: __arrayProto.join,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6865
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6866
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6867 indexOf: __arrayProto.indexOf || function (obj, start)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6868 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6869 for ( var i=(start || 0), ien=this.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6870 if ( this[i] === obj ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6871 return i;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6872 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6873 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6874 return -1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6875 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6876
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6877 iterator: function ( flatten, type, fn, alwaysNew ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6878 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6879 a = [], ret,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6880 i, ien, j, jen,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6881 context = this.context,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6882 rows, items, item,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6883 selector = this.selector;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6884
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6885 // Argument shifting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6886 if ( typeof flatten === 'string' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6887 alwaysNew = fn;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6888 fn = type;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6889 type = flatten;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6890 flatten = false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6891 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6892
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6893 for ( i=0, ien=context.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6894 var apiInst = new _Api( context[i] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6895
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6896 if ( type === 'table' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6897 ret = fn.call( apiInst, context[i], i );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6898
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6899 if ( ret !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6900 a.push( ret );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6901 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6902 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6903 else if ( type === 'columns' || type === 'rows' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6904 // this has same length as context - one entry for each table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6905 ret = fn.call( apiInst, context[i], this[i], i );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6906
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6907 if ( ret !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6908 a.push( ret );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6909 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6910 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6911 else if ( type === 'column' || type === 'column-rows' || type === 'row' || type === 'cell' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6912 // columns and rows share the same structure.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6913 // 'this' is an array of column indexes for each context
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6914 items = this[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6915
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6916 if ( type === 'column-rows' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6917 rows = _selector_row_indexes( context[i], selector.opts );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6918 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6919
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6920 for ( j=0, jen=items.length ; j<jen ; j++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6921 item = items[j];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6922
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6923 if ( type === 'cell' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6924 ret = fn.call( apiInst, context[i], item.row, item.column, i, j );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6925 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6926 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6927 ret = fn.call( apiInst, context[i], item, i, j, rows );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6928 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6929
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6930 if ( ret !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6931 a.push( ret );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6932 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6933 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6934 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6935 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6936
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6937 if ( a.length || alwaysNew ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6938 var api = new _Api( context, flatten ? a.concat.apply( [], a ) : a );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6939 var apiSelector = api.selector;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6940 apiSelector.rows = selector.rows;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6941 apiSelector.cols = selector.cols;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6942 apiSelector.opts = selector.opts;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6943 return api;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6944 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6945 return this;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6946 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6947
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6948
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6949 lastIndexOf: __arrayProto.lastIndexOf || function (obj, start)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6950 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6951 // Bit cheeky...
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6952 return this.indexOf.apply( this.toArray.reverse(), arguments );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6953 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6954
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6955
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6956 length: 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6957
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6958
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6959 map: function ( fn )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6960 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6961 var a = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6962
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6963 if ( __arrayProto.map ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6964 a = __arrayProto.map.call( this, fn, this );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6965 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6966 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6967 // Compatibility for browsers without EMCA-252-5 (JS 1.6)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6968 for ( var i=0, ien=this.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6969 a.push( fn.call( this, this[i], i ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6970 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6971 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6972
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6973 return new _Api( this.context, a );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6974 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6975
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6976
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6977 pluck: function ( prop )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6978 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6979 return this.map( function ( el ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6980 return el[ prop ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6981 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6982 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6983
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6984 pop: __arrayProto.pop,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6985
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6986
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6987 push: __arrayProto.push,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6988
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6989
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6990 // Does not return an API instance
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6991 reduce: __arrayProto.reduce || function ( fn, init )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6992 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6993 return _fnReduce( this, fn, init, 0, this.length, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6994 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6995
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6996
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6997 reduceRight: __arrayProto.reduceRight || function ( fn, init )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6998 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
6999 return _fnReduce( this, fn, init, this.length-1, -1, -1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7000 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7001
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7002
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7003 reverse: __arrayProto.reverse,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7004
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7005
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7006 // Object with rows, columns and opts
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7007 selector: null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7008
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7009
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7010 shift: __arrayProto.shift,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7011
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7012
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7013 sort: __arrayProto.sort, // ? name - order?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7014
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7015
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7016 splice: __arrayProto.splice,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7017
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7018
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7019 toArray: function ()
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7020 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7021 return __arrayProto.slice.call( this );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7022 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7023
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7024
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7025 to$: function ()
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7026 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7027 return $( this );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7028 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7029
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7030
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7031 toJQuery: function ()
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7032 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7033 return $( this );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7034 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7035
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7036
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7037 unique: function ()
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7038 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7039 return new _Api( this.context, _unique(this) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7040 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7041
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7042
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7043 unshift: __arrayProto.unshift
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7044 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7045
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7046
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7047 _Api.extend = function ( scope, obj, ext )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7048 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7049 // Only extend API instances and static properties of the API
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7050 if ( ! ext.length || ! obj || ( ! (obj instanceof _Api) && ! obj.__dt_wrapper ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7051 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7052 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7053
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7054 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7055 i, ien,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7056 j, jen,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7057 struct, inner,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7058 methodScoping = function ( scope, fn, struc ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7059 return function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7060 var ret = fn.apply( scope, arguments );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7061
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7062 // Method extension
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7063 _Api.extend( ret, ret, struc.methodExt );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7064 return ret;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7065 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7066 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7067
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7068 for ( i=0, ien=ext.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7069 struct = ext[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7070
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7071 // Value
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7072 obj[ struct.name ] = typeof struct.val === 'function' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7073 methodScoping( scope, struct.val, struct ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7074 $.isPlainObject( struct.val ) ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7075 {} :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7076 struct.val;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7077
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7078 obj[ struct.name ].__dt_wrapper = true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7079
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7080 // Property extension
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7081 _Api.extend( scope, obj[ struct.name ], struct.propExt );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7082 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7083 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7084
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7085
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7086 // @todo - Is there need for an augment function?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7087 // _Api.augment = function ( inst, name )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7088 // {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7089 // // Find src object in the structure from the name
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7090 // var parts = name.split('.');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7091
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7092 // _Api.extend( inst, obj );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7093 // };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7094
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7095
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7096 // [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7097 // {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7098 // name: 'data' -- string - Property name
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7099 // val: function () {}, -- function - Api method (or undefined if just an object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7100 // methodExt: [ ... ], -- array - Array of Api object definitions to extend the method result
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7101 // propExt: [ ... ] -- array - Array of Api object definitions to extend the property
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7102 // },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7103 // {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7104 // name: 'row'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7105 // val: {},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7106 // methodExt: [ ... ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7107 // propExt: [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7108 // {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7109 // name: 'data'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7110 // val: function () {},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7111 // methodExt: [ ... ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7112 // propExt: [ ... ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7113 // },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7114 // ...
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7115 // ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7116 // }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7117 // ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7118
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7119 _Api.register = _api_register = function ( name, val )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7120 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7121 if ( $.isArray( name ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7122 for ( var j=0, jen=name.length ; j<jen ; j++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7123 _Api.register( name[j], val );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7124 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7125 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7126 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7127
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7128 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7129 i, ien,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7130 heir = name.split('.'),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7131 struct = __apiStruct,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7132 key, method;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7133
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7134 var find = function ( src, name ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7135 for ( var i=0, ien=src.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7136 if ( src[i].name === name ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7137 return src[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7138 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7139 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7140 return null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7141 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7142
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7143 for ( i=0, ien=heir.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7144 method = heir[i].indexOf('()') !== -1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7145 key = method ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7146 heir[i].replace('()', '') :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7147 heir[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7148
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7149 var src = find( struct, key );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7150 if ( ! src ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7151 src = {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7152 name: key,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7153 val: {},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7154 methodExt: [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7155 propExt: []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7156 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7157 struct.push( src );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7158 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7159
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7160 if ( i === ien-1 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7161 src.val = val;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7162 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7163 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7164 struct = method ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7165 src.methodExt :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7166 src.propExt;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7167 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7168 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7169 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7170
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7171
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7172 _Api.registerPlural = _api_registerPlural = function ( pluralName, singularName, val ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7173 _Api.register( pluralName, val );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7174
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7175 _Api.register( singularName, function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7176 var ret = val.apply( this, arguments );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7177
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7178 if ( ret === this ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7179 // Returned item is the API instance that was passed in, return it
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7180 return this;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7181 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7182 else if ( ret instanceof _Api ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7183 // New API instance returned, want the value from the first item
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7184 // in the returned array for the singular result.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7185 return ret.length ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7186 $.isArray( ret[0] ) ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7187 new _Api( ret.context, ret[0] ) : // Array results are 'enhanced'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7188 ret[0] :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7189 undefined;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7190 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7191
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7192 // Non-API return - just fire it back
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7193 return ret;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7194 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7195 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7196
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7197
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7198 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7199 * Selector for HTML tables. Apply the given selector to the give array of
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7200 * DataTables settings objects.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7201 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7202 * @param {string|integer} [selector] jQuery selector string or integer
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7203 * @param {array} Array of DataTables settings objects to be filtered
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7204 * @return {array}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7205 * @ignore
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7206 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7207 var __table_selector = function ( selector, a )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7208 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7209 // Integer is used to pick out a table by index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7210 if ( typeof selector === 'number' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7211 return [ a[ selector ] ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7212 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7213
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7214 // Perform a jQuery selector on the table nodes
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7215 var nodes = $.map( a, function (el, i) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7216 return el.nTable;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7217 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7218
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7219 return $(nodes)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7220 .filter( selector )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7221 .map( function (i) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7222 // Need to translate back from the table node to the settings
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7223 var idx = $.inArray( this, nodes );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7224 return a[ idx ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7225 } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7226 .toArray();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7227 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7228
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7229
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7230
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7231 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7232 * Context selector for the API's context (i.e. the tables the API instance
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7233 * refers to.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7234 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7235 * @name DataTable.Api#tables
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7236 * @param {string|integer} [selector] Selector to pick which tables the iterator
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7237 * should operate on. If not given, all tables in the current context are
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7238 * used. This can be given as a jQuery selector (for example `':gt(0)'`) to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7239 * select multiple tables or as an integer to select a single table.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7240 * @returns {DataTable.Api} Returns a new API instance if a selector is given.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7241 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7242 _api_register( 'tables()', function ( selector ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7243 // A new instance is created if there was a selector specified
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7244 return selector ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7245 new _Api( __table_selector( selector, this.context ) ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7246 this;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7247 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7248
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7249
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7250 _api_register( 'table()', function ( selector ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7251 var tables = this.tables( selector );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7252 var ctx = tables.context;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7253
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7254 // Truncate to the first matched table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7255 return ctx.length ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7256 new _Api( ctx[0] ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7257 tables;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7258 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7259
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7260
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7261 _api_registerPlural( 'tables().nodes()', 'table().node()' , function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7262 return this.iterator( 'table', function ( ctx ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7263 return ctx.nTable;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7264 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7265 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7266
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7267
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7268 _api_registerPlural( 'tables().body()', 'table().body()' , function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7269 return this.iterator( 'table', function ( ctx ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7270 return ctx.nTBody;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7271 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7272 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7273
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7274
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7275 _api_registerPlural( 'tables().header()', 'table().header()' , function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7276 return this.iterator( 'table', function ( ctx ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7277 return ctx.nTHead;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7278 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7279 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7280
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7281
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7282 _api_registerPlural( 'tables().footer()', 'table().footer()' , function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7283 return this.iterator( 'table', function ( ctx ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7284 return ctx.nTFoot;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7285 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7286 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7287
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7288
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7289 _api_registerPlural( 'tables().containers()', 'table().container()' , function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7290 return this.iterator( 'table', function ( ctx ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7291 return ctx.nTableWrapper;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7292 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7293 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7294
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7295
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7296
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7297 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7298 * Redraw the tables in the current context.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7299 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7300 _api_register( 'draw()', function ( paging ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7301 return this.iterator( 'table', function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7302 if ( paging === 'page' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7303 _fnDraw( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7304 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7305 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7306 if ( typeof paging === 'string' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7307 paging = paging === 'full-hold' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7308 false :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7309 true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7310 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7311
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7312 _fnReDraw( settings, paging===false );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7313 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7314 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7315 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7316
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7317
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7318
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7319 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7320 * Get the current page index.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7321 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7322 * @return {integer} Current page index (zero based)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7323 *//**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7324 * Set the current page.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7325 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7326 * Note that if you attempt to show a page which does not exist, DataTables will
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7327 * not throw an error, but rather reset the paging.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7328 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7329 * @param {integer|string} action The paging action to take. This can be one of:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7330 * * `integer` - The page index to jump to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7331 * * `string` - An action to take:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7332 * * `first` - Jump to first page.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7333 * * `next` - Jump to the next page
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7334 * * `previous` - Jump to previous page
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7335 * * `last` - Jump to the last page.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7336 * @returns {DataTables.Api} this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7337 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7338 _api_register( 'page()', function ( action ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7339 if ( action === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7340 return this.page.info().page; // not an expensive call
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7341 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7342
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7343 // else, have an action to take on all tables
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7344 return this.iterator( 'table', function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7345 _fnPageChange( settings, action );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7346 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7347 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7348
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7349
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7350 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7351 * Paging information for the first table in the current context.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7352 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7353 * If you require paging information for another table, use the `table()` method
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7354 * with a suitable selector.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7355 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7356 * @return {object} Object with the following properties set:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7357 * * `page` - Current page index (zero based - i.e. the first page is `0`)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7358 * * `pages` - Total number of pages
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7359 * * `start` - Display index for the first record shown on the current page
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7360 * * `end` - Display index for the last record shown on the current page
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7361 * * `length` - Display length (number of records). Note that generally `start
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7362 * + length = end`, but this is not always true, for example if there are
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7363 * only 2 records to show on the final page, with a length of 10.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7364 * * `recordsTotal` - Full data set length
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7365 * * `recordsDisplay` - Data set length once the current filtering criterion
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7366 * are applied.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7367 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7368 _api_register( 'page.info()', function ( action ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7369 if ( this.context.length === 0 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7370 return undefined;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7371 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7372
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7373 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7374 settings = this.context[0],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7375 start = settings._iDisplayStart,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7376 len = settings._iDisplayLength,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7377 visRecords = settings.fnRecordsDisplay(),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7378 all = len === -1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7379
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7380 return {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7381 "page": all ? 0 : Math.floor( start / len ),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7382 "pages": all ? 1 : Math.ceil( visRecords / len ),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7383 "start": start,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7384 "end": settings.fnDisplayEnd(),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7385 "length": len,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7386 "recordsTotal": settings.fnRecordsTotal(),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7387 "recordsDisplay": visRecords,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7388 "serverSide": _fnDataSource( settings ) === 'ssp'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7389 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7390 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7391
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7392
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7393 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7394 * Get the current page length.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7395 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7396 * @return {integer} Current page length. Note `-1` indicates that all records
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7397 * are to be shown.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7398 *//**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7399 * Set the current page length.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7400 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7401 * @param {integer} Page length to set. Use `-1` to show all records.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7402 * @returns {DataTables.Api} this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7403 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7404 _api_register( 'page.len()', function ( len ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7405 // Note that we can't call this function 'length()' because `length`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7406 // is a Javascript property of functions which defines how many arguments
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7407 // the function expects.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7408 if ( len === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7409 return this.context.length !== 0 ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7410 this.context[0]._iDisplayLength :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7411 undefined;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7412 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7413
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7414 // else, set the page length
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7415 return this.iterator( 'table', function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7416 _fnLengthChange( settings, len );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7417 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7418 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7419
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7420
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7421
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7422 var __reload = function ( settings, holdPosition, callback ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7423 // Use the draw event to trigger a callback
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7424 if ( callback ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7425 var api = new _Api( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7426
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7427 api.one( 'draw', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7428 callback( api.ajax.json() );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7429 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7430 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7431
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7432 if ( _fnDataSource( settings ) == 'ssp' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7433 _fnReDraw( settings, holdPosition );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7434 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7435 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7436 _fnProcessingDisplay( settings, true );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7437
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7438 // Cancel an existing request
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7439 var xhr = settings.jqXHR;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7440 if ( xhr && xhr.readyState !== 4 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7441 xhr.abort();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7442 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7443
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7444 // Trigger xhr
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7445 _fnBuildAjax( settings, [], function( json ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7446 _fnClearTable( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7447
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7448 var data = _fnAjaxDataSrc( settings, json );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7449 for ( var i=0, ien=data.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7450 _fnAddData( settings, data[i] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7451 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7452
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7453 _fnReDraw( settings, holdPosition );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7454 _fnProcessingDisplay( settings, false );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7455 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7456 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7457 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7458
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7459
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7460 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7461 * Get the JSON response from the last Ajax request that DataTables made to the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7462 * server. Note that this returns the JSON from the first table in the current
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7463 * context.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7464 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7465 * @return {object} JSON received from the server.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7466 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7467 _api_register( 'ajax.json()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7468 var ctx = this.context;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7469
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7470 if ( ctx.length > 0 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7471 return ctx[0].json;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7472 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7473
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7474 // else return undefined;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7475 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7476
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7477
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7478 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7479 * Get the data submitted in the last Ajax request
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7480 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7481 _api_register( 'ajax.params()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7482 var ctx = this.context;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7483
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7484 if ( ctx.length > 0 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7485 return ctx[0].oAjaxData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7486 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7487
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7488 // else return undefined;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7489 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7490
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7491
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7492 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7493 * Reload tables from the Ajax data source. Note that this function will
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7494 * automatically re-draw the table when the remote data has been loaded.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7495 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7496 * @param {boolean} [reset=true] Reset (default) or hold the current paging
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7497 * position. A full re-sort and re-filter is performed when this method is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7498 * called, which is why the pagination reset is the default action.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7499 * @returns {DataTables.Api} this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7500 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7501 _api_register( 'ajax.reload()', function ( callback, resetPaging ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7502 return this.iterator( 'table', function (settings) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7503 __reload( settings, resetPaging===false, callback );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7504 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7505 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7506
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7507
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7508 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7509 * Get the current Ajax URL. Note that this returns the URL from the first
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7510 * table in the current context.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7511 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7512 * @return {string} Current Ajax source URL
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7513 *//**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7514 * Set the Ajax URL. Note that this will set the URL for all tables in the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7515 * current context.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7516 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7517 * @param {string} url URL to set.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7518 * @returns {DataTables.Api} this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7519 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7520 _api_register( 'ajax.url()', function ( url ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7521 var ctx = this.context;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7522
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7523 if ( url === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7524 // get
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7525 if ( ctx.length === 0 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7526 return undefined;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7527 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7528 ctx = ctx[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7529
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7530 return ctx.ajax ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7531 $.isPlainObject( ctx.ajax ) ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7532 ctx.ajax.url :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7533 ctx.ajax :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7534 ctx.sAjaxSource;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7535 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7536
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7537 // set
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7538 return this.iterator( 'table', function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7539 if ( $.isPlainObject( settings.ajax ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7540 settings.ajax.url = url;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7541 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7542 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7543 settings.ajax = url;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7544 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7545 // No need to consider sAjaxSource here since DataTables gives priority
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7546 // to `ajax` over `sAjaxSource`. So setting `ajax` here, renders any
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7547 // value of `sAjaxSource` redundant.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7548 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7549 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7550
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7551
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7552 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7553 * Load data from the newly set Ajax URL. Note that this method is only
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7554 * available when `ajax.url()` is used to set a URL. Additionally, this method
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7555 * has the same effect as calling `ajax.reload()` but is provided for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7556 * convenience when setting a new URL. Like `ajax.reload()` it will
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7557 * automatically redraw the table once the remote data has been loaded.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7558 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7559 * @returns {DataTables.Api} this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7560 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7561 _api_register( 'ajax.url().load()', function ( callback, resetPaging ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7562 // Same as a reload, but makes sense to present it for easy access after a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7563 // url change
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7564 return this.iterator( 'table', function ( ctx ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7565 __reload( ctx, resetPaging===false, callback );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7566 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7567 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7568
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7569
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7570
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7571
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7572 var _selector_run = function ( type, selector, selectFn, settings, opts )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7573 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7574 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7575 out = [], res,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7576 a, i, ien, j, jen,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7577 selectorType = typeof selector;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7578
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7579 // Can't just check for isArray here, as an API or jQuery instance might be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7580 // given with their array like look
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7581 if ( ! selector || selectorType === 'string' || selectorType === 'function' || selector.length === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7582 selector = [ selector ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7583 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7584
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7585 for ( i=0, ien=selector.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7586 a = selector[i] && selector[i].split ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7587 selector[i].split(',') :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7588 [ selector[i] ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7589
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7590 for ( j=0, jen=a.length ; j<jen ; j++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7591 res = selectFn( typeof a[j] === 'string' ? $.trim(a[j]) : a[j] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7592
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7593 if ( res && res.length ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7594 out = out.concat( res );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7595 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7596 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7597 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7598
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7599 // selector extensions
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7600 var ext = _ext.selector[ type ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7601 if ( ext.length ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7602 for ( i=0, ien=ext.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7603 out = ext[i]( settings, opts, out );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7604 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7605 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7606
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7607 return _unique( out );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7608 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7609
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7610
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7611 var _selector_opts = function ( opts )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7612 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7613 if ( ! opts ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7614 opts = {};
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7615 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7616
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7617 // Backwards compatibility for 1.9- which used the terminology filter rather
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7618 // than search
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7619 if ( opts.filter && opts.search === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7620 opts.search = opts.filter;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7621 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7622
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7623 return $.extend( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7624 search: 'none',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7625 order: 'current',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7626 page: 'all'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7627 }, opts );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7628 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7629
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7630
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7631 var _selector_first = function ( inst )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7632 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7633 // Reduce the API instance to the first item found
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7634 for ( var i=0, ien=inst.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7635 if ( inst[i].length > 0 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7636 // Assign the first element to the first item in the instance
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7637 // and truncate the instance and context
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7638 inst[0] = inst[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7639 inst[0].length = 1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7640 inst.length = 1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7641 inst.context = [ inst.context[i] ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7642
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7643 return inst;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7644 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7645 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7646
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7647 // Not found - return an empty instance
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7648 inst.length = 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7649 return inst;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7650 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7651
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7652
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7653 var _selector_row_indexes = function ( settings, opts )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7654 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7655 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7656 i, ien, tmp, a=[],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7657 displayFiltered = settings.aiDisplay,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7658 displayMaster = settings.aiDisplayMaster;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7659
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7660 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7661 search = opts.search, // none, applied, removed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7662 order = opts.order, // applied, current, index (original - compatibility with 1.9)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7663 page = opts.page; // all, current
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7664
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7665 if ( _fnDataSource( settings ) == 'ssp' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7666 // In server-side processing mode, most options are irrelevant since
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7667 // rows not shown don't exist and the index order is the applied order
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7668 // Removed is a special case - for consistency just return an empty
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7669 // array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7670 return search === 'removed' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7671 [] :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7672 _range( 0, displayMaster.length );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7673 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7674 else if ( page == 'current' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7675 // Current page implies that order=current and fitler=applied, since it is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7676 // fairly senseless otherwise, regardless of what order and search actually
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7677 // are
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7678 for ( i=settings._iDisplayStart, ien=settings.fnDisplayEnd() ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7679 a.push( displayFiltered[i] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7680 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7681 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7682 else if ( order == 'current' || order == 'applied' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7683 a = search == 'none' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7684 displayMaster.slice() : // no search
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7685 search == 'applied' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7686 displayFiltered.slice() : // applied search
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7687 $.map( displayMaster, function (el, i) { // removed search
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7688 return $.inArray( el, displayFiltered ) === -1 ? el : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7689 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7690 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7691 else if ( order == 'index' || order == 'original' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7692 for ( i=0, ien=settings.aoData.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7693 if ( search == 'none' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7694 a.push( i );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7695 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7696 else { // applied | removed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7697 tmp = $.inArray( i, displayFiltered );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7698
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7699 if ((tmp === -1 && search == 'removed') ||
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7700 (tmp >= 0 && search == 'applied') )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7701 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7702 a.push( i );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7703 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7704 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7705 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7706 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7707
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7708 return a;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7709 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7710
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7711
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7712 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7713 * Rows
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7714 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7715 * {} - no selector - use all available rows
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7716 * {integer} - row aoData index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7717 * {node} - TR node
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7718 * {string} - jQuery selector to apply to the TR elements
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7719 * {array} - jQuery array of nodes, or simply an array of TR nodes
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7720 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7721 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7722
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7723
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7724 var __row_selector = function ( settings, selector, opts )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7725 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7726 var run = function ( sel ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7727 var selInt = _intVal( sel );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7728 var i, ien;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7729
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7730 // Short cut - selector is a number and no options provided (default is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7731 // all records, so no need to check if the index is in there, since it
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7732 // must be - dev error if the index doesn't exist).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7733 if ( selInt !== null && ! opts ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7734 return [ selInt ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7735 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7736
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7737 var rows = _selector_row_indexes( settings, opts );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7738
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7739 if ( selInt !== null && $.inArray( selInt, rows ) !== -1 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7740 // Selector - integer
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7741 return [ selInt ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7742 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7743 else if ( ! sel ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7744 // Selector - none
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7745 return rows;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7746 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7747
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7748 // Selector - function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7749 if ( typeof sel === 'function' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7750 return $.map( rows, function (idx) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7751 var row = settings.aoData[ idx ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7752 return sel( idx, row._aData, row.nTr ) ? idx : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7753 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7754 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7755
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7756 // Get nodes in the order from the `rows` array with null values removed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7757 var nodes = _removeEmpty(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7758 _pluck_order( settings.aoData, rows, 'nTr' )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7759 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7760
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7761 // Selector - node
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7762 if ( sel.nodeName ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7763 if ( $.inArray( sel, nodes ) !== -1 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7764 return [ sel._DT_RowIndex ]; // sel is a TR node that is in the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7765 // and DataTables adds a prop for fast lookup
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7766 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7767 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7768
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7769 // ID selector. Want to always be able to select rows by id, regardless
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7770 // of if the tr element has been created or not, so can't rely upon
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7771 // jQuery here - hence a custom implementation. This does not match
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7772 // Sizzle's fast selector or HTML4 - in HTML5 the ID can be anything,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7773 // but to select it using a CSS selector engine (like Sizzle or
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7774 // querySelect) it would need to need to be escaped for some characters.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7775 // DataTables simplifies this for row selectors since you can select
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7776 // only a row. A # indicates an id any anything that follows is the id -
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7777 // unescaped.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7778 if ( typeof sel === 'string' && sel.charAt(0) === '#' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7779 // get row index from id
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7780 var rowObj = settings.aIds[ sel.replace( /^#/, '' ) ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7781 if ( rowObj !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7782 return [ rowObj.idx ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7783 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7784
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7785 // need to fall through to jQuery in case there is DOM id that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7786 // matches
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7787 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7788
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7789 // Selector - jQuery selector string, array of nodes or jQuery object/
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7790 // As jQuery's .filter() allows jQuery objects to be passed in filter,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7791 // it also allows arrays, so this will cope with all three options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7792 return $(nodes)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7793 .filter( sel )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7794 .map( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7795 return this._DT_RowIndex;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7796 } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7797 .toArray();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7798 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7799
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7800 return _selector_run( 'row', selector, run, settings, opts );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7801 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7802
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7803
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7804 _api_register( 'rows()', function ( selector, opts ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7805 // argument shifting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7806 if ( selector === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7807 selector = '';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7808 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7809 else if ( $.isPlainObject( selector ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7810 opts = selector;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7811 selector = '';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7812 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7813
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7814 opts = _selector_opts( opts );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7815
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7816 var inst = this.iterator( 'table', function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7817 return __row_selector( settings, selector, opts );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7818 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7819
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7820 // Want argument shifting here and in __row_selector?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7821 inst.selector.rows = selector;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7822 inst.selector.opts = opts;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7823
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7824 return inst;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7825 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7826
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7827 _api_register( 'rows().nodes()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7828 return this.iterator( 'row', function ( settings, row ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7829 return settings.aoData[ row ].nTr || undefined;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7830 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7831 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7832
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7833 _api_register( 'rows().data()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7834 return this.iterator( true, 'rows', function ( settings, rows ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7835 return _pluck_order( settings.aoData, rows, '_aData' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7836 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7837 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7838
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7839 _api_registerPlural( 'rows().cache()', 'row().cache()', function ( type ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7840 return this.iterator( 'row', function ( settings, row ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7841 var r = settings.aoData[ row ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7842 return type === 'search' ? r._aFilterData : r._aSortData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7843 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7844 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7845
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7846 _api_registerPlural( 'rows().invalidate()', 'row().invalidate()', function ( src ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7847 return this.iterator( 'row', function ( settings, row ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7848 _fnInvalidate( settings, row, src );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7849 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7850 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7851
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7852 _api_registerPlural( 'rows().indexes()', 'row().index()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7853 return this.iterator( 'row', function ( settings, row ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7854 return row;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7855 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7856 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7857
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7858 _api_registerPlural( 'rows().ids()', 'row().id()', function ( hash ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7859 var a = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7860 var context = this.context;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7861
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7862 // `iterator` will drop undefined values, but in this case we want them
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7863 for ( var i=0, ien=context.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7864 for ( var j=0, jen=this[i].length ; j<jen ; j++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7865 var id = context[i].rowIdFn( context[i].aoData[ this[i][j] ]._aData );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7866 a.push( (hash === true ? '#' : '' )+ id );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7867 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7868 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7869
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7870 return new _Api( context, a );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7871 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7872
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7873 _api_registerPlural( 'rows().remove()', 'row().remove()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7874 var that = this;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7875
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7876 this.iterator( 'row', function ( settings, row, thatIdx ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7877 var data = settings.aoData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7878 var rowData = data[ row ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7879
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7880 data.splice( row, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7881
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7882 // Update the _DT_RowIndex parameter on all rows in the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7883 for ( var i=0, ien=data.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7884 if ( data[i].nTr !== null ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7885 data[i].nTr._DT_RowIndex = i;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7886 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7887 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7888
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7889 // Delete from the display arrays
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7890 _fnDeleteIndex( settings.aiDisplayMaster, row );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7891 _fnDeleteIndex( settings.aiDisplay, row );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7892 _fnDeleteIndex( that[ thatIdx ], row, false ); // maintain local indexes
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7893
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7894 // Check for an 'overflow' they case for displaying the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7895 _fnLengthOverflow( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7896
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7897 // Remove the row's ID reference if there is one
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7898 var id = settings.rowIdFn( rowData._aData );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7899 if ( id !== undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7900 delete settings.aIds[ id ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7901 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7902 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7903
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7904 this.iterator( 'table', function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7905 for ( var i=0, ien=settings.aoData.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7906 settings.aoData[i].idx = i;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7907 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7908 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7909
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7910 return this;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7911 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7912
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7913
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7914 _api_register( 'rows.add()', function ( rows ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7915 var newRows = this.iterator( 'table', function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7916 var row, i, ien;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7917 var out = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7918
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7919 for ( i=0, ien=rows.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7920 row = rows[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7921
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7922 if ( row.nodeName && row.nodeName.toUpperCase() === 'TR' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7923 out.push( _fnAddTr( settings, row )[0] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7924 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7925 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7926 out.push( _fnAddData( settings, row ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7927 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7928 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7929
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7930 return out;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7931 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7932
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7933 // Return an Api.rows() extended instance, so rows().nodes() etc can be used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7934 var modRows = this.rows( -1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7935 modRows.pop();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7936 $.merge( modRows, newRows );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7937
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7938 return modRows;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7939 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7940
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7941
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7942
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7943
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7944
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7945 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7946 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7947 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7948 _api_register( 'row()', function ( selector, opts ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7949 return _selector_first( this.rows( selector, opts ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7950 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7951
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7952
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7953 _api_register( 'row().data()', function ( data ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7954 var ctx = this.context;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7955
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7956 if ( data === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7957 // Get
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7958 return ctx.length && this.length ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7959 ctx[0].aoData[ this[0] ]._aData :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7960 undefined;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7961 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7962
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7963 // Set
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7964 ctx[0].aoData[ this[0] ]._aData = data;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7965
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7966 // Automatically invalidate
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7967 _fnInvalidate( ctx[0], this[0], 'data' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7968
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7969 return this;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7970 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7971
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7972
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7973 _api_register( 'row().node()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7974 var ctx = this.context;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7975
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7976 return ctx.length && this.length ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7977 ctx[0].aoData[ this[0] ].nTr || null :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7978 null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7979 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7980
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7981
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7982 _api_register( 'row.add()', function ( row ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7983 // Allow a jQuery object to be passed in - only a single row is added from
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7984 // it though - the first element in the set
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7985 if ( row instanceof $ && row.length ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7986 row = row[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7987 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7988
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7989 var rows = this.iterator( 'table', function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7990 if ( row.nodeName && row.nodeName.toUpperCase() === 'TR' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7991 return _fnAddTr( settings, row )[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7992 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7993 return _fnAddData( settings, row );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7994 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7995
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7996 // Return an Api.rows() extended instance, with the newly added row selected
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7997 return this.row( rows[0] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7998 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
7999
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8000
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8001
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8002 var __details_add = function ( ctx, row, data, klass )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8003 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8004 // Convert to array of TR elements
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8005 var rows = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8006 var addRow = function ( r, k ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8007 // Recursion to allow for arrays of jQuery objects
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8008 if ( $.isArray( r ) || r instanceof $ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8009 for ( var i=0, ien=r.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8010 addRow( r[i], k );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8011 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8012 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8013 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8014
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8015 // If we get a TR element, then just add it directly - up to the dev
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8016 // to add the correct number of columns etc
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8017 if ( r.nodeName && r.nodeName.toLowerCase() === 'tr' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8018 rows.push( r );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8019 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8020 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8021 // Otherwise create a row with a wrapper
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8022 var created = $('<tr><td/></tr>').addClass( k );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8023 $('td', created)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8024 .addClass( k )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8025 .html( r )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8026 [0].colSpan = _fnVisbleColumns( ctx );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8027
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8028 rows.push( created[0] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8029 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8030 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8031
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8032 addRow( data, klass );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8033
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8034 if ( row._details ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8035 row._details.remove();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8036 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8037
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8038 row._details = $(rows);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8039
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8040 // If the children were already shown, that state should be retained
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8041 if ( row._detailsShow ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8042 row._details.insertAfter( row.nTr );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8043 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8044 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8045
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8046
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8047 var __details_remove = function ( api, idx )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8048 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8049 var ctx = api.context;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8050
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8051 if ( ctx.length ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8052 var row = ctx[0].aoData[ idx !== undefined ? idx : api[0] ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8053
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8054 if ( row && row._details ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8055 row._details.remove();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8056
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8057 row._detailsShow = undefined;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8058 row._details = undefined;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8059 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8060 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8061 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8062
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8063
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8064 var __details_display = function ( api, show ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8065 var ctx = api.context;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8066
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8067 if ( ctx.length && api.length ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8068 var row = ctx[0].aoData[ api[0] ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8069
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8070 if ( row._details ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8071 row._detailsShow = show;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8072
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8073 if ( show ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8074 row._details.insertAfter( row.nTr );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8075 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8076 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8077 row._details.detach();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8078 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8079
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8080 __details_events( ctx[0] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8081 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8082 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8083 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8084
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8085
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8086 var __details_events = function ( settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8087 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8088 var api = new _Api( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8089 var namespace = '.dt.DT_details';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8090 var drawEvent = 'draw'+namespace;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8091 var colvisEvent = 'column-visibility'+namespace;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8092 var destroyEvent = 'destroy'+namespace;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8093 var data = settings.aoData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8094
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8095 api.off( drawEvent +' '+ colvisEvent +' '+ destroyEvent );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8096
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8097 if ( _pluck( data, '_details' ).length > 0 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8098 // On each draw, insert the required elements into the document
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8099 api.on( drawEvent, function ( e, ctx ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8100 if ( settings !== ctx ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8101 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8102 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8103
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8104 api.rows( {page:'current'} ).eq(0).each( function (idx) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8105 // Internal data grab
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8106 var row = data[ idx ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8107
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8108 if ( row._detailsShow ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8109 row._details.insertAfter( row.nTr );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8110 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8111 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8112 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8113
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8114 // Column visibility change - update the colspan
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8115 api.on( colvisEvent, function ( e, ctx, idx, vis ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8116 if ( settings !== ctx ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8117 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8118 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8119
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8120 // Update the colspan for the details rows (note, only if it already has
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8121 // a colspan)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8122 var row, visible = _fnVisbleColumns( ctx );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8123
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8124 for ( var i=0, ien=data.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8125 row = data[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8126
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8127 if ( row._details ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8128 row._details.children('td[colspan]').attr('colspan', visible );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8129 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8130 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8131 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8132
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8133 // Table destroyed - nuke any child rows
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8134 api.on( destroyEvent, function ( e, ctx ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8135 if ( settings !== ctx ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8136 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8137 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8138
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8139 for ( var i=0, ien=data.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8140 if ( data[i]._details ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8141 __details_remove( api, i );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8142 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8143 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8144 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8145 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8146 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8147
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8148 // Strings for the method names to help minification
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8149 var _emp = '';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8150 var _child_obj = _emp+'row().child';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8151 var _child_mth = _child_obj+'()';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8152
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8153 // data can be:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8154 // tr
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8155 // string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8156 // jQuery or array of any of the above
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8157 _api_register( _child_mth, function ( data, klass ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8158 var ctx = this.context;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8159
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8160 if ( data === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8161 // get
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8162 return ctx.length && this.length ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8163 ctx[0].aoData[ this[0] ]._details :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8164 undefined;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8165 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8166 else if ( data === true ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8167 // show
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8168 this.child.show();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8169 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8170 else if ( data === false ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8171 // remove
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8172 __details_remove( this );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8173 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8174 else if ( ctx.length && this.length ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8175 // set
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8176 __details_add( ctx[0], ctx[0].aoData[ this[0] ], data, klass );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8177 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8178
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8179 return this;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8180 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8181
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8182
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8183 _api_register( [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8184 _child_obj+'.show()',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8185 _child_mth+'.show()' // only when `child()` was called with parameters (without
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8186 ], function ( show ) { // it returns an object and this method is not executed)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8187 __details_display( this, true );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8188 return this;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8189 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8190
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8191
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8192 _api_register( [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8193 _child_obj+'.hide()',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8194 _child_mth+'.hide()' // only when `child()` was called with parameters (without
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8195 ], function () { // it returns an object and this method is not executed)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8196 __details_display( this, false );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8197 return this;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8198 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8199
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8200
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8201 _api_register( [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8202 _child_obj+'.remove()',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8203 _child_mth+'.remove()' // only when `child()` was called with parameters (without
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8204 ], function () { // it returns an object and this method is not executed)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8205 __details_remove( this );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8206 return this;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8207 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8208
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8209
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8210 _api_register( _child_obj+'.isShown()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8211 var ctx = this.context;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8212
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8213 if ( ctx.length && this.length ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8214 // _detailsShown as false or undefined will fall through to return false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8215 return ctx[0].aoData[ this[0] ]._detailsShow || false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8216 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8217 return false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8218 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8219
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8220
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8221
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8222 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8223 * Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8224 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8225 * {integer} - column index (>=0 count from left, <0 count from right)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8226 * "{integer}:visIdx" - visible column index (i.e. translate to column index) (>=0 count from left, <0 count from right)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8227 * "{integer}:visible" - alias for {integer}:visIdx (>=0 count from left, <0 count from right)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8228 * "{string}:name" - column name
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8229 * "{string}" - jQuery selector on column header nodes
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8230 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8231 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8232
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8233 // can be an array of these items, comma separated list, or an array of comma
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8234 // separated lists
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8235
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8236 var __re_column_selector = /^(.+):(name|visIdx|visible)$/;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8237
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8238
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8239 // r1 and r2 are redundant - but it means that the parameters match for the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8240 // iterator callback in columns().data()
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8241 var __columnData = function ( settings, column, r1, r2, rows ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8242 var a = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8243 for ( var row=0, ien=rows.length ; row<ien ; row++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8244 a.push( _fnGetCellData( settings, rows[row], column ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8245 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8246 return a;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8247 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8248
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8249
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8250 var __column_selector = function ( settings, selector, opts )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8251 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8252 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8253 columns = settings.aoColumns,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8254 names = _pluck( columns, 'sName' ),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8255 nodes = _pluck( columns, 'nTh' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8256
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8257 var run = function ( s ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8258 var selInt = _intVal( s );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8259
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8260 // Selector - all
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8261 if ( s === '' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8262 return _range( columns.length );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8263 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8264
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8265 // Selector - index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8266 if ( selInt !== null ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8267 return [ selInt >= 0 ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8268 selInt : // Count from left
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8269 columns.length + selInt // Count from right (+ because its a negative value)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8270 ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8271 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8272
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8273 // Selector = function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8274 if ( typeof s === 'function' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8275 var rows = _selector_row_indexes( settings, opts );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8276
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8277 return $.map( columns, function (col, idx) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8278 return s(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8279 idx,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8280 __columnData( settings, idx, 0, 0, rows ),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8281 nodes[ idx ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8282 ) ? idx : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8283 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8284 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8285
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8286 // jQuery or string selector
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8287 var match = typeof s === 'string' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8288 s.match( __re_column_selector ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8289 '';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8290
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8291 if ( match ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8292 switch( match[2] ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8293 case 'visIdx':
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8294 case 'visible':
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8295 var idx = parseInt( match[1], 10 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8296 // Visible index given, convert to column index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8297 if ( idx < 0 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8298 // Counting from the right
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8299 var visColumns = $.map( columns, function (col,i) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8300 return col.bVisible ? i : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8301 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8302 return [ visColumns[ visColumns.length + idx ] ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8303 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8304 // Counting from the left
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8305 return [ _fnVisibleToColumnIndex( settings, idx ) ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8306
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8307 case 'name':
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8308 // match by name. `names` is column index complete and in order
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8309 return $.map( names, function (name, i) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8310 return name === match[1] ? i : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8311 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8312 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8313 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8314 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8315 // jQuery selector on the TH elements for the columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8316 return $( nodes )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8317 .filter( s )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8318 .map( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8319 return $.inArray( this, nodes ); // `nodes` is column index complete and in order
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8320 } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8321 .toArray();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8322 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8323 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8324
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8325 return _selector_run( 'column', selector, run, settings, opts );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8326 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8327
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8328
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8329 var __setColumnVis = function ( settings, column, vis, recalc ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8330 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8331 cols = settings.aoColumns,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8332 col = cols[ column ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8333 data = settings.aoData,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8334 row, cells, i, ien, tr;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8335
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8336 // Get
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8337 if ( vis === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8338 return col.bVisible;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8339 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8340
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8341 // Set
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8342 // No change
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8343 if ( col.bVisible === vis ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8344 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8345 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8346
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8347 if ( vis ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8348 // Insert column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8349 // Need to decide if we should use appendChild or insertBefore
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8350 var insertBefore = $.inArray( true, _pluck(cols, 'bVisible'), column+1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8351
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8352 for ( i=0, ien=data.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8353 tr = data[i].nTr;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8354 cells = data[i].anCells;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8355
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8356 if ( tr ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8357 // insertBefore can act like appendChild if 2nd arg is null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8358 tr.insertBefore( cells[ column ], cells[ insertBefore ] || null );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8359 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8360 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8361 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8362 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8363 // Remove column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8364 $( _pluck( settings.aoData, 'anCells', column ) ).detach();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8365 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8366
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8367 // Common actions
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8368 col.bVisible = vis;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8369 _fnDrawHead( settings, settings.aoHeader );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8370 _fnDrawHead( settings, settings.aoFooter );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8371
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8372 if ( recalc === undefined || recalc ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8373 // Automatically adjust column sizing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8374 _fnAdjustColumnSizing( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8375
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8376 // Realign columns for scrolling
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8377 if ( settings.oScroll.sX || settings.oScroll.sY ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8378 _fnScrollDraw( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8379 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8380 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8381
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8382 _fnCallbackFire( settings, null, 'column-visibility', [settings, column, vis] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8383
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8384 _fnSaveState( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8385 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8386
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8387
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8388 _api_register( 'columns()', function ( selector, opts ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8389 // argument shifting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8390 if ( selector === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8391 selector = '';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8392 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8393 else if ( $.isPlainObject( selector ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8394 opts = selector;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8395 selector = '';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8396 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8397
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8398 opts = _selector_opts( opts );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8399
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8400 var inst = this.iterator( 'table', function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8401 return __column_selector( settings, selector, opts );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8402 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8403
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8404 // Want argument shifting here and in _row_selector?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8405 inst.selector.cols = selector;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8406 inst.selector.opts = opts;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8407
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8408 return inst;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8409 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8410
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8411 _api_registerPlural( 'columns().header()', 'column().header()', function ( selector, opts ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8412 return this.iterator( 'column', function ( settings, column ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8413 return settings.aoColumns[column].nTh;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8414 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8415 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8416
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8417 _api_registerPlural( 'columns().footer()', 'column().footer()', function ( selector, opts ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8418 return this.iterator( 'column', function ( settings, column ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8419 return settings.aoColumns[column].nTf;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8420 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8421 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8422
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8423 _api_registerPlural( 'columns().data()', 'column().data()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8424 return this.iterator( 'column-rows', __columnData, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8425 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8426
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8427 _api_registerPlural( 'columns().dataSrc()', 'column().dataSrc()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8428 return this.iterator( 'column', function ( settings, column ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8429 return settings.aoColumns[column].mData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8430 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8431 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8432
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8433 _api_registerPlural( 'columns().cache()', 'column().cache()', function ( type ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8434 return this.iterator( 'column-rows', function ( settings, column, i, j, rows ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8435 return _pluck_order( settings.aoData, rows,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8436 type === 'search' ? '_aFilterData' : '_aSortData', column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8437 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8438 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8439 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8440
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8441 _api_registerPlural( 'columns().nodes()', 'column().nodes()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8442 return this.iterator( 'column-rows', function ( settings, column, i, j, rows ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8443 return _pluck_order( settings.aoData, rows, 'anCells', column ) ;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8444 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8445 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8446
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8447 _api_registerPlural( 'columns().visible()', 'column().visible()', function ( vis, calc ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8448 return this.iterator( 'column', function ( settings, column ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8449 if ( vis === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8450 return settings.aoColumns[ column ].bVisible;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8451 } // else
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8452 __setColumnVis( settings, column, vis, calc );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8453 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8454 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8455
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8456 _api_registerPlural( 'columns().indexes()', 'column().index()', function ( type ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8457 return this.iterator( 'column', function ( settings, column ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8458 return type === 'visible' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8459 _fnColumnIndexToVisible( settings, column ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8460 column;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8461 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8462 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8463
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8464 _api_register( 'columns.adjust()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8465 return this.iterator( 'table', function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8466 _fnAdjustColumnSizing( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8467 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8468 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8469
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8470 _api_register( 'column.index()', function ( type, idx ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8471 if ( this.context.length !== 0 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8472 var ctx = this.context[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8473
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8474 if ( type === 'fromVisible' || type === 'toData' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8475 return _fnVisibleToColumnIndex( ctx, idx );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8476 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8477 else if ( type === 'fromData' || type === 'toVisible' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8478 return _fnColumnIndexToVisible( ctx, idx );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8479 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8480 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8481 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8482
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8483 _api_register( 'column()', function ( selector, opts ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8484 return _selector_first( this.columns( selector, opts ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8485 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8486
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8487
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8488
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8489
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8490 var __cell_selector = function ( settings, selector, opts )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8491 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8492 var data = settings.aoData;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8493 var rows = _selector_row_indexes( settings, opts );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8494 var cells = _removeEmpty( _pluck_order( data, rows, 'anCells' ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8495 var allCells = $( [].concat.apply([], cells) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8496 var row;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8497 var columns = settings.aoColumns.length;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8498 var a, i, ien, j, o, host;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8499
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8500 var run = function ( s ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8501 var fnSelector = typeof s === 'function';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8502
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8503 if ( s === null || s === undefined || fnSelector ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8504 // All cells and function selectors
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8505 a = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8506
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8507 for ( i=0, ien=rows.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8508 row = rows[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8509
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8510 for ( j=0 ; j<columns ; j++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8511 o = {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8512 row: row,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8513 column: j
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8514 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8515
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8516 if ( fnSelector ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8517 // Selector - function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8518 host = data[ row ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8519
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8520 if ( s( o, _fnGetCellData(settings, row, j), host.anCells ? host.anCells[j] : null ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8521 a.push( o );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8522 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8523 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8524 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8525 // Selector - all
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8526 a.push( o );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8527 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8528 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8529 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8530
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8531 return a;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8532 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8533
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8534 // Selector - index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8535 if ( $.isPlainObject( s ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8536 return [s];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8537 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8538
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8539 // Selector - jQuery filtered cells
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8540 return allCells
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8541 .filter( s )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8542 .map( function (i, el) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8543 if ( el.parentNode ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8544 row = el.parentNode._DT_RowIndex;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8545 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8546 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8547 // If no parent node, then the cell is hidden and we'll need
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8548 // to traverse the array to find it
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8549 for ( i=0, ien=data.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8550 if ( $.inArray( el, data[i].anCells ) !== -1 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8551 row = i;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8552 break;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8553 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8554 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8555 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8556
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8557 return {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8558 row: row,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8559 column: $.inArray( el, data[ row ].anCells )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8560 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8561 } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8562 .toArray();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8563 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8564
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8565 return _selector_run( 'cell', selector, run, settings, opts );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8566 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8567
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8568
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8569
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8570
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8571 _api_register( 'cells()', function ( rowSelector, columnSelector, opts ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8572 // Argument shifting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8573 if ( $.isPlainObject( rowSelector ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8574 // Indexes
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8575 if ( rowSelector.row === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8576 // Selector options in first parameter
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8577 opts = rowSelector;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8578 rowSelector = null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8579 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8580 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8581 // Cell index objects in first parameter
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8582 opts = columnSelector;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8583 columnSelector = null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8584 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8585 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8586 if ( $.isPlainObject( columnSelector ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8587 opts = columnSelector;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8588 columnSelector = null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8589 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8590
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8591 // Cell selector
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8592 if ( columnSelector === null || columnSelector === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8593 return this.iterator( 'table', function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8594 return __cell_selector( settings, rowSelector, _selector_opts( opts ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8595 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8596 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8597
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8598 // Row + column selector
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8599 var columns = this.columns( columnSelector, opts );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8600 var rows = this.rows( rowSelector, opts );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8601 var a, i, ien, j, jen;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8602
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8603 var cells = this.iterator( 'table', function ( settings, idx ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8604 a = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8605
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8606 for ( i=0, ien=rows[idx].length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8607 for ( j=0, jen=columns[idx].length ; j<jen ; j++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8608 a.push( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8609 row: rows[idx][i],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8610 column: columns[idx][j]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8611 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8612 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8613 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8614
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8615 return a;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8616 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8617
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8618 $.extend( cells.selector, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8619 cols: columnSelector,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8620 rows: rowSelector,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8621 opts: opts
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8622 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8623
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8624 return cells;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8625 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8626
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8627
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8628 _api_registerPlural( 'cells().nodes()', 'cell().node()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8629 return this.iterator( 'cell', function ( settings, row, column ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8630 var cells = settings.aoData[ row ].anCells;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8631 return cells ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8632 cells[ column ] :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8633 undefined;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8634 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8635 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8636
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8637
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8638 _api_register( 'cells().data()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8639 return this.iterator( 'cell', function ( settings, row, column ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8640 return _fnGetCellData( settings, row, column );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8641 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8642 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8643
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8644
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8645 _api_registerPlural( 'cells().cache()', 'cell().cache()', function ( type ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8646 type = type === 'search' ? '_aFilterData' : '_aSortData';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8647
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8648 return this.iterator( 'cell', function ( settings, row, column ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8649 return settings.aoData[ row ][ type ][ column ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8650 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8651 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8652
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8653
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8654 _api_registerPlural( 'cells().render()', 'cell().render()', function ( type ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8655 return this.iterator( 'cell', function ( settings, row, column ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8656 return _fnGetCellData( settings, row, column, type );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8657 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8658 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8659
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8660
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8661 _api_registerPlural( 'cells().indexes()', 'cell().index()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8662 return this.iterator( 'cell', function ( settings, row, column ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8663 return {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8664 row: row,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8665 column: column,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8666 columnVisible: _fnColumnIndexToVisible( settings, column )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8667 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8668 }, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8669 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8670
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8671
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8672 _api_registerPlural( 'cells().invalidate()', 'cell().invalidate()', function ( src ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8673 return this.iterator( 'cell', function ( settings, row, column ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8674 _fnInvalidate( settings, row, src, column );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8675 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8676 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8677
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8678
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8679
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8680 _api_register( 'cell()', function ( rowSelector, columnSelector, opts ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8681 return _selector_first( this.cells( rowSelector, columnSelector, opts ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8682 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8683
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8684
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8685 _api_register( 'cell().data()', function ( data ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8686 var ctx = this.context;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8687 var cell = this[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8688
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8689 if ( data === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8690 // Get
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8691 return ctx.length && cell.length ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8692 _fnGetCellData( ctx[0], cell[0].row, cell[0].column ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8693 undefined;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8694 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8695
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8696 // Set
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8697 _fnSetCellData( ctx[0], cell[0].row, cell[0].column, data );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8698 _fnInvalidate( ctx[0], cell[0].row, 'data', cell[0].column );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8699
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8700 return this;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8701 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8702
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8703
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8704
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8705 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8706 * Get current ordering (sorting) that has been applied to the table.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8707 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8708 * @returns {array} 2D array containing the sorting information for the first
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8709 * table in the current context. Each element in the parent array represents
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8710 * a column being sorted upon (i.e. multi-sorting with two columns would have
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8711 * 2 inner arrays). The inner arrays may have 2 or 3 elements. The first is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8712 * the column index that the sorting condition applies to, the second is the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8713 * direction of the sort (`desc` or `asc`) and, optionally, the third is the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8714 * index of the sorting order from the `column.sorting` initialisation array.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8715 *//**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8716 * Set the ordering for the table.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8717 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8718 * @param {integer} order Column index to sort upon.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8719 * @param {string} direction Direction of the sort to be applied (`asc` or `desc`)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8720 * @returns {DataTables.Api} this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8721 *//**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8722 * Set the ordering for the table.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8723 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8724 * @param {array} order 1D array of sorting information to be applied.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8725 * @param {array} [...] Optional additional sorting conditions
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8726 * @returns {DataTables.Api} this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8727 *//**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8728 * Set the ordering for the table.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8729 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8730 * @param {array} order 2D array of sorting information to be applied.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8731 * @returns {DataTables.Api} this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8732 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8733 _api_register( 'order()', function ( order, dir ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8734 var ctx = this.context;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8735
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8736 if ( order === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8737 // get
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8738 return ctx.length !== 0 ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8739 ctx[0].aaSorting :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8740 undefined;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8741 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8742
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8743 // set
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8744 if ( typeof order === 'number' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8745 // Simple column / direction passed in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8746 order = [ [ order, dir ] ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8747 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8748 else if ( ! $.isArray( order[0] ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8749 // Arguments passed in (list of 1D arrays)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8750 order = Array.prototype.slice.call( arguments );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8751 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8752 // otherwise a 2D array was passed in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8753
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8754 return this.iterator( 'table', function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8755 settings.aaSorting = order.slice();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8756 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8757 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8758
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8759
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8760 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8761 * Attach a sort listener to an element for a given column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8762 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8763 * @param {node|jQuery|string} node Identifier for the element(s) to attach the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8764 * listener to. This can take the form of a single DOM node, a jQuery
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8765 * collection of nodes or a jQuery selector which will identify the node(s).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8766 * @param {integer} column the column that a click on this node will sort on
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8767 * @param {function} [callback] callback function when sort is run
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8768 * @returns {DataTables.Api} this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8769 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8770 _api_register( 'order.listener()', function ( node, column, callback ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8771 return this.iterator( 'table', function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8772 _fnSortAttachListener( settings, node, column, callback );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8773 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8774 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8775
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8776
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8777 // Order by the selected column(s)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8778 _api_register( [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8779 'columns().order()',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8780 'column().order()'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8781 ], function ( dir ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8782 var that = this;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8783
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8784 return this.iterator( 'table', function ( settings, i ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8785 var sort = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8786
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8787 $.each( that[i], function (j, col) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8788 sort.push( [ col, dir ] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8789 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8790
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8791 settings.aaSorting = sort;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8792 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8793 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8794
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8795
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8796
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8797 _api_register( 'search()', function ( input, regex, smart, caseInsen ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8798 var ctx = this.context;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8799
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8800 if ( input === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8801 // get
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8802 return ctx.length !== 0 ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8803 ctx[0].oPreviousSearch.sSearch :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8804 undefined;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8805 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8806
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8807 // set
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8808 return this.iterator( 'table', function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8809 if ( ! settings.oFeatures.bFilter ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8810 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8811 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8812
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8813 _fnFilterComplete( settings, $.extend( {}, settings.oPreviousSearch, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8814 "sSearch": input+"",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8815 "bRegex": regex === null ? false : regex,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8816 "bSmart": smart === null ? true : smart,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8817 "bCaseInsensitive": caseInsen === null ? true : caseInsen
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8818 } ), 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8819 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8820 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8821
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8822
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8823 _api_registerPlural(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8824 'columns().search()',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8825 'column().search()',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8826 function ( input, regex, smart, caseInsen ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8827 return this.iterator( 'column', function ( settings, column ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8828 var preSearch = settings.aoPreSearchCols;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8829
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8830 if ( input === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8831 // get
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8832 return preSearch[ column ].sSearch;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8833 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8834
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8835 // set
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8836 if ( ! settings.oFeatures.bFilter ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8837 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8838 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8839
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8840 $.extend( preSearch[ column ], {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8841 "sSearch": input+"",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8842 "bRegex": regex === null ? false : regex,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8843 "bSmart": smart === null ? true : smart,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8844 "bCaseInsensitive": caseInsen === null ? true : caseInsen
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8845 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8846
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8847 _fnFilterComplete( settings, settings.oPreviousSearch, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8848 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8849 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8850 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8851
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8852 /*
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8853 * State API methods
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8854 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8855
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8856 _api_register( 'state()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8857 return this.context.length ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8858 this.context[0].oSavedState :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8859 null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8860 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8861
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8862
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8863 _api_register( 'state.clear()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8864 return this.iterator( 'table', function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8865 // Save an empty object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8866 settings.fnStateSaveCallback.call( settings.oInstance, settings, {} );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8867 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8868 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8869
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8870
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8871 _api_register( 'state.loaded()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8872 return this.context.length ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8873 this.context[0].oLoadedState :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8874 null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8875 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8876
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8877
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8878 _api_register( 'state.save()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8879 return this.iterator( 'table', function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8880 _fnSaveState( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8881 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8882 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8883
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8884
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8885
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8886 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8887 * Provide a common method for plug-ins to check the version of DataTables being
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8888 * used, in order to ensure compatibility.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8889 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8890 * @param {string} version Version string to check for, in the format "X.Y.Z".
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8891 * Note that the formats "X" and "X.Y" are also acceptable.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8892 * @returns {boolean} true if this version of DataTables is greater or equal to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8893 * the required version, or false if this version of DataTales is not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8894 * suitable
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8895 * @static
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8896 * @dtopt API-Static
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8897 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8898 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8899 * alert( $.fn.dataTable.versionCheck( '1.9.0' ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8900 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8901 DataTable.versionCheck = DataTable.fnVersionCheck = function( version )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8902 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8903 var aThis = DataTable.version.split('.');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8904 var aThat = version.split('.');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8905 var iThis, iThat;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8906
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8907 for ( var i=0, iLen=aThat.length ; i<iLen ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8908 iThis = parseInt( aThis[i], 10 ) || 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8909 iThat = parseInt( aThat[i], 10 ) || 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8910
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8911 // Parts are the same, keep comparing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8912 if (iThis === iThat) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8913 continue;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8914 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8915
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8916 // Parts are different, return immediately
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8917 return iThis > iThat;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8918 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8919
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8920 return true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8921 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8922
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8923
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8924 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8925 * Check if a `<table>` node is a DataTable table already or not.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8926 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8927 * @param {node|jquery|string} table Table node, jQuery object or jQuery
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8928 * selector for the table to test. Note that if more than more than one
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8929 * table is passed on, only the first will be checked
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8930 * @returns {boolean} true the table given is a DataTable, or false otherwise
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8931 * @static
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8932 * @dtopt API-Static
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8933 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8934 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8935 * if ( ! $.fn.DataTable.isDataTable( '#example' ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8936 * $('#example').dataTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8937 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8938 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8939 DataTable.isDataTable = DataTable.fnIsDataTable = function ( table )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8940 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8941 var t = $(table).get(0);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8942 var is = false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8943
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8944 $.each( DataTable.settings, function (i, o) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8945 var head = o.nScrollHead ? $('table', o.nScrollHead)[0] : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8946 var foot = o.nScrollFoot ? $('table', o.nScrollFoot)[0] : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8947
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8948 if ( o.nTable === t || head === t || foot === t ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8949 is = true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8950 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8951 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8952
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8953 return is;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8954 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8955
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8956
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8957 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8958 * Get all DataTable tables that have been initialised - optionally you can
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8959 * select to get only currently visible tables.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8960 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8961 * @param {boolean} [visible=false] Flag to indicate if you want all (default)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8962 * or visible tables only.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8963 * @returns {array} Array of `table` nodes (not DataTable instances) which are
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8964 * DataTables
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8965 * @static
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8966 * @dtopt API-Static
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8967 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8968 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8969 * $.each( $.fn.dataTable.tables(true), function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8970 * $(table).DataTable().columns.adjust();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8971 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8972 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8973 DataTable.tables = DataTable.fnTables = function ( visible )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8974 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8975 var api = false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8976
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8977 if ( $.isPlainObject( visible ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8978 api = visible.api;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8979 visible = visible.visible;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8980 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8981
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8982 var a = $.map( DataTable.settings, function (o) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8983 if ( !visible || (visible && $(o.nTable).is(':visible')) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8984 return o.nTable;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8985 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8986 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8987
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8988 return api ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8989 new _Api( a ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8990 a;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8991 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8992
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8993
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8994 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8995 * DataTables utility methods
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8996 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8997 * This namespace provides helper methods that DataTables uses internally to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8998 * create a DataTable, but which are not exclusively used only for DataTables.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
8999 * These methods can be used by extension authors to save the duplication of
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9000 * code.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9001 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9002 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9003 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9004 DataTable.util = {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9005 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9006 * Throttle the calls to a function. Arguments and context are maintained
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9007 * for the throttled function.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9008 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9009 * @param {function} fn Function to be called
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9010 * @param {integer} freq Call frequency in mS
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9011 * @return {function} Wrapped function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9012 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9013 throttle: _fnThrottle,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9014
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9015
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9016 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9017 * Escape a string such that it can be used in a regular expression
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9018 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9019 * @param {string} sVal string to escape
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9020 * @returns {string} escaped string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9021 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9022 escapeRegex: _fnEscapeRegex
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9023 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9024
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9025
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9026 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9027 * Convert from camel case parameters to Hungarian notation. This is made public
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9028 * for the extensions to provide the same ability as DataTables core to accept
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9029 * either the 1.9 style Hungarian notation, or the 1.10+ style camelCase
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9030 * parameters.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9031 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9032 * @param {object} src The model object which holds all parameters that can be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9033 * mapped.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9034 * @param {object} user The object to convert from camel case to Hungarian.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9035 * @param {boolean} force When set to `true`, properties which already have a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9036 * Hungarian value in the `user` object will be overwritten. Otherwise they
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9037 * won't be.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9038 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9039 DataTable.camelToHungarian = _fnCamelToHungarian;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9040
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9041
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9042
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9043 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9044 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9045 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9046 _api_register( '$()', function ( selector, opts ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9047 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9048 rows = this.rows( opts ).nodes(), // Get all rows
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9049 jqRows = $(rows);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9050
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9051 return $( [].concat(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9052 jqRows.filter( selector ).toArray(),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9053 jqRows.find( selector ).toArray()
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9054 ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9055 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9056
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9057
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9058 // jQuery functions to operate on the tables
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9059 $.each( [ 'on', 'one', 'off' ], function (i, key) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9060 _api_register( key+'()', function ( /* event, handler */ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9061 var args = Array.prototype.slice.call(arguments);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9062
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9063 // Add the `dt` namespace automatically if it isn't already present
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9064 if ( ! args[0].match(/\.dt\b/) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9065 args[0] += '.dt';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9066 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9067
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9068 var inst = $( this.tables().nodes() );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9069 inst[key].apply( inst, args );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9070 return this;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9071 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9072 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9073
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9074
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9075 _api_register( 'clear()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9076 return this.iterator( 'table', function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9077 _fnClearTable( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9078 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9079 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9080
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9081
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9082 _api_register( 'settings()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9083 return new _Api( this.context, this.context );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9084 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9085
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9086
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9087 _api_register( 'init()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9088 var ctx = this.context;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9089 return ctx.length ? ctx[0].oInit : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9090 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9091
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9092
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9093 _api_register( 'data()', function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9094 return this.iterator( 'table', function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9095 return _pluck( settings.aoData, '_aData' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9096 } ).flatten();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9097 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9098
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9099
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9100 _api_register( 'destroy()', function ( remove ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9101 remove = remove || false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9102
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9103 return this.iterator( 'table', function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9104 var orig = settings.nTableWrapper.parentNode;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9105 var classes = settings.oClasses;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9106 var table = settings.nTable;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9107 var tbody = settings.nTBody;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9108 var thead = settings.nTHead;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9109 var tfoot = settings.nTFoot;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9110 var jqTable = $(table);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9111 var jqTbody = $(tbody);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9112 var jqWrapper = $(settings.nTableWrapper);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9113 var rows = $.map( settings.aoData, function (r) { return r.nTr; } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9114 var i, ien;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9115
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9116 // Flag to note that the table is currently being destroyed - no action
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9117 // should be taken
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9118 settings.bDestroying = true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9119
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9120 // Fire off the destroy callbacks for plug-ins etc
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9121 _fnCallbackFire( settings, "aoDestroyCallback", "destroy", [settings] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9122
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9123 // If not being removed from the document, make all columns visible
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9124 if ( ! remove ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9125 new _Api( settings ).columns().visible( true );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9126 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9127
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9128 // Blitz all `DT` namespaced events (these are internal events, the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9129 // lowercase, `dt` events are user subscribed and they are responsible
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9130 // for removing them
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9131 jqWrapper.unbind('.DT').find(':not(tbody *)').unbind('.DT');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9132 $(window).unbind('.DT-'+settings.sInstance);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9133
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9134 // When scrolling we had to break the table up - restore it
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9135 if ( table != thead.parentNode ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9136 jqTable.children('thead').detach();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9137 jqTable.append( thead );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9138 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9139
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9140 if ( tfoot && table != tfoot.parentNode ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9141 jqTable.children('tfoot').detach();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9142 jqTable.append( tfoot );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9143 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9144
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9145 settings.aaSorting = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9146 settings.aaSortingFixed = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9147 _fnSortingClasses( settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9148
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9149 $( rows ).removeClass( settings.asStripeClasses.join(' ') );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9150
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9151 $('th, td', thead).removeClass( classes.sSortable+' '+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9152 classes.sSortableAsc+' '+classes.sSortableDesc+' '+classes.sSortableNone
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9153 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9154
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9155 if ( settings.bJUI ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9156 $('th span.'+classes.sSortIcon+ ', td span.'+classes.sSortIcon, thead).detach();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9157 $('th, td', thead).each( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9158 var wrapper = $('div.'+classes.sSortJUIWrapper, this);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9159 $(this).append( wrapper.contents() );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9160 wrapper.detach();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9161 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9162 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9163
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9164 // Add the TR elements back into the table in their original order
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9165 jqTbody.children().detach();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9166 jqTbody.append( rows );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9167
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9168 // Remove the DataTables generated nodes, events and classes
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9169 var removedMethod = remove ? 'remove' : 'detach';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9170 jqTable[ removedMethod ]();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9171 jqWrapper[ removedMethod ]();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9172
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9173 // If we need to reattach the table to the document
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9174 if ( ! remove && orig ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9175 // insertBefore acts like appendChild if !arg[1]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9176 orig.insertBefore( table, settings.nTableReinsertBefore );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9177
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9178 // Restore the width of the original table - was read from the style property,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9179 // so we can restore directly to that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9180 jqTable
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9181 .css( 'width', settings.sDestroyWidth )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9182 .removeClass( classes.sTable );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9183
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9184 // If the were originally stripe classes - then we add them back here.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9185 // Note this is not fool proof (for example if not all rows had stripe
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9186 // classes - but it's a good effort without getting carried away
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9187 ien = settings.asDestroyStripes.length;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9188
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9189 if ( ien ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9190 jqTbody.children().each( function (i) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9191 $(this).addClass( settings.asDestroyStripes[i % ien] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9192 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9193 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9194 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9195
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9196 /* Remove the settings object from the settings array */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9197 var idx = $.inArray( settings, DataTable.settings );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9198 if ( idx !== -1 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9199 DataTable.settings.splice( idx, 1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9200 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9201 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9202 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9203
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9204
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9205 // Add the `every()` method for rows, columns and cells in a compact form
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9206 $.each( [ 'column', 'row', 'cell' ], function ( i, type ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9207 _api_register( type+'s().every()', function ( fn ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9208 return this.iterator( type, function ( settings, arg1, arg2, arg3, arg4 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9209 // Rows and columns:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9210 // arg1 - index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9211 // arg2 - table counter
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9212 // arg3 - loop counter
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9213 // arg4 - undefined
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9214 // Cells:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9215 // arg1 - row index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9216 // arg2 - column index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9217 // arg3 - table counter
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9218 // arg4 - loop counter
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9219 fn.call(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9220 new _Api( settings )[ type ]( arg1, type==='cell' ? arg2 : undefined ),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9221 arg1, arg2, arg3, arg4
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9222 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9223 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9224 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9225 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9226
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9227
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9228 // i18n method for extensions to be able to use the language object from the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9229 // DataTable
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9230 _api_register( 'i18n()', function ( token, def, plural ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9231 var ctx = this.context[0];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9232 var resolved = _fnGetObjectDataFn( token )( ctx.oLanguage );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9233
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9234 if ( resolved === undefined ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9235 resolved = def;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9236 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9237
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9238 if ( plural !== undefined && $.isPlainObject( resolved ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9239 resolved = resolved[ plural ] !== undefined ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9240 resolved[ plural ] :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9241 resolved._;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9242 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9243
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9244 return resolved.replace( '%d', plural ); // nb: plural might be undefined,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9245 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9246
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9247 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9248 * Version string for plug-ins to check compatibility. Allowed format is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9249 * `a.b.c-d` where: a:int, b:int, c:int, d:string(dev|beta|alpha). `d` is used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9250 * only for non-release builds. See http://semver.org/ for more information.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9251 * @member
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9252 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9253 * @default Version number
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9254 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9255 DataTable.version = "1.10.9";
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9256
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9257 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9258 * Private data store, containing all of the settings objects that are
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9259 * created for the tables on a given page.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9260 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9261 * Note that the `DataTable.settings` object is aliased to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9262 * `jQuery.fn.dataTableExt` through which it may be accessed and
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9263 * manipulated, or `jQuery.fn.dataTable.settings`.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9264 * @member
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9265 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9266 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9267 * @private
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9268 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9269 DataTable.settings = [];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9270
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9271 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9272 * Object models container, for the various models that DataTables has
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9273 * available to it. These models define the objects that are used to hold
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9274 * the active state and configuration of the table.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9275 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9276 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9277 DataTable.models = {};
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9278
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9279
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9280
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9281 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9282 * Template object for the way in which DataTables holds information about
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9283 * search information for the global filter and individual column filters.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9284 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9285 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9286 DataTable.models.oSearch = {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9287 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9288 * Flag to indicate if the filtering should be case insensitive or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9289 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9290 * @default true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9291 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9292 "bCaseInsensitive": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9293
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9294 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9295 * Applied search term
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9296 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9297 * @default <i>Empty string</i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9298 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9299 "sSearch": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9300
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9301 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9302 * Flag to indicate if the search term should be interpreted as a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9303 * regular expression (true) or not (false) and therefore and special
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9304 * regex characters escaped.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9305 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9306 * @default false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9307 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9308 "bRegex": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9309
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9310 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9311 * Flag to indicate if DataTables is to use its smart filtering or not.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9312 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9313 * @default true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9314 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9315 "bSmart": true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9316 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9317
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9318
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9319
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9320
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9321 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9322 * Template object for the way in which DataTables holds information about
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9323 * each individual row. This is the object format used for the settings
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9324 * aoData array.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9325 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9326 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9327 DataTable.models.oRow = {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9328 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9329 * TR element for the row
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9330 * @type node
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9331 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9332 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9333 "nTr": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9334
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9335 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9336 * Array of TD elements for each row. This is null until the row has been
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9337 * created.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9338 * @type array nodes
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9339 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9340 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9341 "anCells": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9342
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9343 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9344 * Data object from the original data source for the row. This is either
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9345 * an array if using the traditional form of DataTables, or an object if
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9346 * using mData options. The exact type will depend on the passed in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9347 * data from the data source, or will be an array if using DOM a data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9348 * source.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9349 * @type array|object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9350 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9351 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9352 "_aData": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9353
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9354 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9355 * Sorting data cache - this array is ostensibly the same length as the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9356 * number of columns (although each index is generated only as it is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9357 * needed), and holds the data that is used for sorting each column in the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9358 * row. We do this cache generation at the start of the sort in order that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9359 * the formatting of the sort data need be done only once for each cell
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9360 * per sort. This array should not be read from or written to by anything
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9361 * other than the master sorting methods.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9362 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9363 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9364 * @private
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9365 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9366 "_aSortData": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9367
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9368 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9369 * Per cell filtering data cache. As per the sort data cache, used to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9370 * increase the performance of the filtering in DataTables
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9371 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9372 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9373 * @private
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9374 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9375 "_aFilterData": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9376
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9377 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9378 * Filtering data cache. This is the same as the cell filtering cache, but
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9379 * in this case a string rather than an array. This is easily computed with
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9380 * a join on `_aFilterData`, but is provided as a cache so the join isn't
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9381 * needed on every search (memory traded for performance)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9382 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9383 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9384 * @private
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9385 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9386 "_sFilterRow": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9387
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9388 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9389 * Cache of the class name that DataTables has applied to the row, so we
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9390 * can quickly look at this variable rather than needing to do a DOM check
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9391 * on className for the nTr property.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9392 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9393 * @default <i>Empty string</i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9394 * @private
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9395 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9396 "_sRowStripe": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9397
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9398 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9399 * Denote if the original data source was from the DOM, or the data source
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9400 * object. This is used for invalidating data, so DataTables can
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9401 * automatically read data from the original source, unless uninstructed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9402 * otherwise.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9403 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9404 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9405 * @private
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9406 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9407 "src": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9408
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9409 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9410 * Index in the aoData array. This saves an indexOf lookup when we have the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9411 * object, but want to know the index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9412 * @type integer
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9413 * @default -1
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9414 * @private
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9415 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9416 "idx": -1
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9417 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9418
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9419
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9420 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9421 * Template object for the column information object in DataTables. This object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9422 * is held in the settings aoColumns array and contains all the information that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9423 * DataTables needs about each individual column.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9424 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9425 * Note that this object is related to {@link DataTable.defaults.column}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9426 * but this one is the internal data store for DataTables's cache of columns.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9427 * It should NOT be manipulated outside of DataTables. Any configuration should
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9428 * be done through the initialisation options.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9429 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9430 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9431 DataTable.models.oColumn = {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9432 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9433 * Column index. This could be worked out on-the-fly with $.inArray, but it
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9434 * is faster to just hold it as a variable
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9435 * @type integer
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9436 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9437 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9438 "idx": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9439
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9440 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9441 * A list of the columns that sorting should occur on when this column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9442 * is sorted. That this property is an array allows multi-column sorting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9443 * to be defined for a column (for example first name / last name columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9444 * would benefit from this). The values are integers pointing to the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9445 * columns to be sorted on (typically it will be a single integer pointing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9446 * at itself, but that doesn't need to be the case).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9447 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9448 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9449 "aDataSort": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9450
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9451 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9452 * Define the sorting directions that are applied to the column, in sequence
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9453 * as the column is repeatedly sorted upon - i.e. the first value is used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9454 * as the sorting direction when the column if first sorted (clicked on).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9455 * Sort it again (click again) and it will move on to the next index.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9456 * Repeat until loop.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9457 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9458 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9459 "asSorting": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9460
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9461 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9462 * Flag to indicate if the column is searchable, and thus should be included
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9463 * in the filtering or not.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9464 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9465 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9466 "bSearchable": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9467
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9468 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9469 * Flag to indicate if the column is sortable or not.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9470 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9471 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9472 "bSortable": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9473
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9474 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9475 * Flag to indicate if the column is currently visible in the table or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9476 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9477 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9478 "bVisible": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9479
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9480 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9481 * Store for manual type assignment using the `column.type` option. This
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9482 * is held in store so we can manipulate the column's `sType` property.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9483 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9484 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9485 * @private
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9486 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9487 "_sManualType": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9488
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9489 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9490 * Flag to indicate if HTML5 data attributes should be used as the data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9491 * source for filtering or sorting. True is either are.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9492 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9493 * @default false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9494 * @private
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9495 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9496 "_bAttrSrc": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9497
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9498 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9499 * Developer definable function that is called whenever a cell is created (Ajax source,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9500 * etc) or processed for input (DOM source). This can be used as a compliment to mRender
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9501 * allowing you to modify the DOM element (add background colour for example) when the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9502 * element is available.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9503 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9504 * @param {element} nTd The TD node that has been created
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9505 * @param {*} sData The Data for the cell
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9506 * @param {array|object} oData The data for the whole row
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9507 * @param {int} iRow The row index for the aoData data store
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9508 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9509 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9510 "fnCreatedCell": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9511
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9512 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9513 * Function to get data from a cell in a column. You should <b>never</b>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9514 * access data directly through _aData internally in DataTables - always use
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9515 * the method attached to this property. It allows mData to function as
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9516 * required. This function is automatically assigned by the column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9517 * initialisation method
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9518 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9519 * @param {array|object} oData The data array/object for the array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9520 * (i.e. aoData[]._aData)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9521 * @param {string} sSpecific The specific data type you want to get -
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9522 * 'display', 'type' 'filter' 'sort'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9523 * @returns {*} The data for the cell from the given row's data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9524 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9525 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9526 "fnGetData": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9527
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9528 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9529 * Function to set data for a cell in the column. You should <b>never</b>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9530 * set the data directly to _aData internally in DataTables - always use
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9531 * this method. It allows mData to function as required. This function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9532 * is automatically assigned by the column initialisation method
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9533 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9534 * @param {array|object} oData The data array/object for the array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9535 * (i.e. aoData[]._aData)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9536 * @param {*} sValue Value to set
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9537 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9538 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9539 "fnSetData": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9540
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9541 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9542 * Property to read the value for the cells in the column from the data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9543 * source array / object. If null, then the default content is used, if a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9544 * function is given then the return from the function is used.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9545 * @type function|int|string|null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9546 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9547 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9548 "mData": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9549
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9550 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9551 * Partner property to mData which is used (only when defined) to get
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9552 * the data - i.e. it is basically the same as mData, but without the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9553 * 'set' option, and also the data fed to it is the result from mData.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9554 * This is the rendering method to match the data method of mData.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9555 * @type function|int|string|null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9556 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9557 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9558 "mRender": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9559
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9560 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9561 * Unique header TH/TD element for this column - this is what the sorting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9562 * listener is attached to (if sorting is enabled.)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9563 * @type node
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9564 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9565 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9566 "nTh": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9567
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9568 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9569 * Unique footer TH/TD element for this column (if there is one). Not used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9570 * in DataTables as such, but can be used for plug-ins to reference the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9571 * footer for each column.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9572 * @type node
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9573 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9574 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9575 "nTf": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9576
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9577 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9578 * The class to apply to all TD elements in the table's TBODY for the column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9579 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9580 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9581 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9582 "sClass": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9583
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9584 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9585 * When DataTables calculates the column widths to assign to each column,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9586 * it finds the longest string in each column and then constructs a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9587 * temporary table and reads the widths from that. The problem with this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9588 * is that "mmm" is much wider then "iiii", but the latter is a longer
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9589 * string - thus the calculation can go wrong (doing it properly and putting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9590 * it into an DOM object and measuring that is horribly(!) slow). Thus as
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9591 * a "work around" we provide this option. It will append its value to the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9592 * text that is found to be the longest string for the column - i.e. padding.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9593 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9594 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9595 "sContentPadding": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9596
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9597 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9598 * Allows a default value to be given for a column's data, and will be used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9599 * whenever a null data source is encountered (this can be because mData
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9600 * is set to null, or because the data source itself is null).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9601 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9602 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9603 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9604 "sDefaultContent": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9605
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9606 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9607 * Name for the column, allowing reference to the column by name as well as
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9608 * by index (needs a lookup to work by name).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9609 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9610 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9611 "sName": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9612
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9613 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9614 * Custom sorting data type - defines which of the available plug-ins in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9615 * afnSortData the custom sorting will use - if any is defined.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9616 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9617 * @default std
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9618 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9619 "sSortDataType": 'std',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9620
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9621 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9622 * Class to be applied to the header element when sorting on this column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9623 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9624 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9625 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9626 "sSortingClass": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9627
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9628 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9629 * Class to be applied to the header element when sorting on this column -
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9630 * when jQuery UI theming is used.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9631 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9632 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9633 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9634 "sSortingClassJUI": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9635
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9636 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9637 * Title of the column - what is seen in the TH element (nTh).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9638 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9639 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9640 "sTitle": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9641
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9642 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9643 * Column sorting and filtering type
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9644 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9645 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9646 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9647 "sType": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9648
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9649 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9650 * Width of the column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9651 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9652 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9653 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9654 "sWidth": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9655
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9656 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9657 * Width of the column when it was first "encountered"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9658 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9659 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9660 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9661 "sWidthOrig": null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9662 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9663
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9664
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9665 /*
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9666 * Developer note: The properties of the object below are given in Hungarian
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9667 * notation, that was used as the interface for DataTables prior to v1.10, however
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9668 * from v1.10 onwards the primary interface is camel case. In order to avoid
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9669 * breaking backwards compatibility utterly with this change, the Hungarian
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9670 * version is still, internally the primary interface, but is is not documented
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9671 * - hence the @name tags in each doc comment. This allows a Javascript function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9672 * to create a map from Hungarian notation to camel case (going the other direction
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9673 * would require each property to be listed, which would at around 3K to the size
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9674 * of DataTables, while this method is about a 0.5K hit.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9675 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9676 * Ultimately this does pave the way for Hungarian notation to be dropped
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9677 * completely, but that is a massive amount of work and will break current
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9678 * installs (therefore is on-hold until v2).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9679 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9680
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9681 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9682 * Initialisation options that can be given to DataTables at initialisation
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9683 * time.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9684 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9685 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9686 DataTable.defaults = {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9687 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9688 * An array of data to use for the table, passed in at initialisation which
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9689 * will be used in preference to any data which is already in the DOM. This is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9690 * particularly useful for constructing tables purely in Javascript, for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9691 * example with a custom Ajax call.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9692 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9693 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9694 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9695 * @dtopt Option
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9696 * @name DataTable.defaults.data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9697 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9698 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9699 * // Using a 2D array data source
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9700 * $(document).ready( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9701 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9702 * "data": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9703 * ['Trident', 'Internet Explorer 4.0', 'Win 95+', 4, 'X'],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9704 * ['Trident', 'Internet Explorer 5.0', 'Win 95+', 5, 'C'],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9705 * ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9706 * "columns": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9707 * { "title": "Engine" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9708 * { "title": "Browser" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9709 * { "title": "Platform" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9710 * { "title": "Version" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9711 * { "title": "Grade" }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9712 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9713 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9714 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9715 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9716 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9717 * // Using an array of objects as a data source (`data`)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9718 * $(document).ready( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9719 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9720 * "data": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9721 * {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9722 * "engine": "Trident",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9723 * "browser": "Internet Explorer 4.0",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9724 * "platform": "Win 95+",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9725 * "version": 4,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9726 * "grade": "X"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9727 * },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9728 * {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9729 * "engine": "Trident",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9730 * "browser": "Internet Explorer 5.0",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9731 * "platform": "Win 95+",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9732 * "version": 5,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9733 * "grade": "C"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9734 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9735 * ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9736 * "columns": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9737 * { "title": "Engine", "data": "engine" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9738 * { "title": "Browser", "data": "browser" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9739 * { "title": "Platform", "data": "platform" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9740 * { "title": "Version", "data": "version" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9741 * { "title": "Grade", "data": "grade" }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9742 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9743 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9744 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9745 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9746 "aaData": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9747
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9748
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9749 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9750 * If ordering is enabled, then DataTables will perform a first pass sort on
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9751 * initialisation. You can define which column(s) the sort is performed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9752 * upon, and the sorting direction, with this variable. The `sorting` array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9753 * should contain an array for each column to be sorted initially containing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9754 * the column's index and a direction string ('asc' or 'desc').
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9755 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9756 * @default [[0,'asc']]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9757 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9758 * @dtopt Option
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9759 * @name DataTable.defaults.order
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9760 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9761 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9762 * // Sort by 3rd column first, and then 4th column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9763 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9764 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9765 * "order": [[2,'asc'], [3,'desc']]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9766 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9767 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9768 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9769 * // No initial sorting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9770 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9771 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9772 * "order": []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9773 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9774 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9775 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9776 "aaSorting": [[0,'asc']],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9777
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9778
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9779 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9780 * This parameter is basically identical to the `sorting` parameter, but
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9781 * cannot be overridden by user interaction with the table. What this means
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9782 * is that you could have a column (visible or hidden) which the sorting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9783 * will always be forced on first - any sorting after that (from the user)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9784 * will then be performed as required. This can be useful for grouping rows
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9785 * together.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9786 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9787 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9788 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9789 * @dtopt Option
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9790 * @name DataTable.defaults.orderFixed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9791 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9792 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9793 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9794 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9795 * "orderFixed": [[0,'asc']]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9796 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9797 * } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9798 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9799 "aaSortingFixed": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9800
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9801
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9802 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9803 * DataTables can be instructed to load data to display in the table from a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9804 * Ajax source. This option defines how that Ajax call is made and where to.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9805 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9806 * The `ajax` property has three different modes of operation, depending on
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9807 * how it is defined. These are:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9808 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9809 * * `string` - Set the URL from where the data should be loaded from.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9810 * * `object` - Define properties for `jQuery.ajax`.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9811 * * `function` - Custom data get function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9812 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9813 * `string`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9814 * --------
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9815 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9816 * As a string, the `ajax` property simply defines the URL from which
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9817 * DataTables will load data.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9818 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9819 * `object`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9820 * --------
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9821 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9822 * As an object, the parameters in the object are passed to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9823 * [jQuery.ajax](http://api.jquery.com/jQuery.ajax/) allowing fine control
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9824 * of the Ajax request. DataTables has a number of default parameters which
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9825 * you can override using this option. Please refer to the jQuery
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9826 * documentation for a full description of the options available, although
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9827 * the following parameters provide additional options in DataTables or
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9828 * require special consideration:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9829 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9830 * * `data` - As with jQuery, `data` can be provided as an object, but it
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9831 * can also be used as a function to manipulate the data DataTables sends
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9832 * to the server. The function takes a single parameter, an object of
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9833 * parameters with the values that DataTables has readied for sending. An
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9834 * object may be returned which will be merged into the DataTables
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9835 * defaults, or you can add the items to the object that was passed in and
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9836 * not return anything from the function. This supersedes `fnServerParams`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9837 * from DataTables 1.9-.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9838 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9839 * * `dataSrc` - By default DataTables will look for the property `data` (or
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9840 * `aaData` for compatibility with DataTables 1.9-) when obtaining data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9841 * from an Ajax source or for server-side processing - this parameter
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9842 * allows that property to be changed. You can use Javascript dotted
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9843 * object notation to get a data source for multiple levels of nesting, or
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9844 * it my be used as a function. As a function it takes a single parameter,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9845 * the JSON returned from the server, which can be manipulated as
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9846 * required, with the returned value being that used by DataTables as the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9847 * data source for the table. This supersedes `sAjaxDataProp` from
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9848 * DataTables 1.9-.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9849 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9850 * * `success` - Should not be overridden it is used internally in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9851 * DataTables. To manipulate / transform the data returned by the server
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9852 * use `ajax.dataSrc`, or use `ajax` as a function (see below).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9853 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9854 * `function`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9855 * ----------
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9856 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9857 * As a function, making the Ajax call is left up to yourself allowing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9858 * complete control of the Ajax request. Indeed, if desired, a method other
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9859 * than Ajax could be used to obtain the required data, such as Web storage
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9860 * or an AIR database.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9861 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9862 * The function is given four parameters and no return is required. The
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9863 * parameters are:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9864 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9865 * 1. _object_ - Data to send to the server
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9866 * 2. _function_ - Callback function that must be executed when the required
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9867 * data has been obtained. That data should be passed into the callback
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9868 * as the only parameter
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9869 * 3. _object_ - DataTables settings object for the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9870 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9871 * Note that this supersedes `fnServerData` from DataTables 1.9-.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9872 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9873 * @type string|object|function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9874 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9875 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9876 * @dtopt Option
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9877 * @name DataTable.defaults.ajax
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9878 * @since 1.10.0
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9879 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9880 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9881 * // Get JSON data from a file via Ajax.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9882 * // Note DataTables expects data in the form `{ data: [ ...data... ] }` by default).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9883 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9884 * "ajax": "data.json"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9885 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9886 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9887 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9888 * // Get JSON data from a file via Ajax, using `dataSrc` to change
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9889 * // `data` to `tableData` (i.e. `{ tableData: [ ...data... ] }`)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9890 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9891 * "ajax": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9892 * "url": "data.json",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9893 * "dataSrc": "tableData"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9894 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9895 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9896 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9897 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9898 * // Get JSON data from a file via Ajax, using `dataSrc` to read data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9899 * // from a plain array rather than an array in an object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9900 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9901 * "ajax": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9902 * "url": "data.json",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9903 * "dataSrc": ""
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9904 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9905 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9906 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9907 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9908 * // Manipulate the data returned from the server - add a link to data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9909 * // (note this can, should, be done using `render` for the column - this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9910 * // is just a simple example of how the data can be manipulated).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9911 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9912 * "ajax": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9913 * "url": "data.json",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9914 * "dataSrc": function ( json ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9915 * for ( var i=0, ien=json.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9916 * json[i][0] = '<a href="/message/'+json[i][0]+'>View message</a>';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9917 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9918 * return json;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9919 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9920 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9921 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9922 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9923 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9924 * // Add data to the request
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9925 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9926 * "ajax": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9927 * "url": "data.json",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9928 * "data": function ( d ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9929 * return {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9930 * "extra_search": $('#extra').val()
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9931 * };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9932 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9933 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9934 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9935 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9936 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9937 * // Send request as POST
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9938 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9939 * "ajax": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9940 * "url": "data.json",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9941 * "type": "POST"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9942 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9943 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9944 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9945 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9946 * // Get the data from localStorage (could interface with a form for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9947 * // adding, editing and removing rows).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9948 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9949 * "ajax": function (data, callback, settings) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9950 * callback(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9951 * JSON.parse( localStorage.getItem('dataTablesData') )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9952 * );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9953 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9954 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9955 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9956 "ajax": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9957
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9958
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9959 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9960 * This parameter allows you to readily specify the entries in the length drop
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9961 * down menu that DataTables shows when pagination is enabled. It can be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9962 * either a 1D array of options which will be used for both the displayed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9963 * option and the value, or a 2D array which will use the array in the first
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9964 * position as the value, and the array in the second position as the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9965 * displayed options (useful for language strings such as 'All').
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9966 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9967 * Note that the `pageLength` property will be automatically set to the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9968 * first value given in this array, unless `pageLength` is also provided.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9969 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9970 * @default [ 10, 25, 50, 100 ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9971 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9972 * @dtopt Option
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9973 * @name DataTable.defaults.lengthMenu
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9974 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9975 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9976 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9977 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9978 * "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9979 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9980 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9981 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9982 "aLengthMenu": [ 10, 25, 50, 100 ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9983
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9984
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9985 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9986 * The `columns` option in the initialisation parameter allows you to define
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9987 * details about the way individual columns behave. For a full list of
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9988 * column options that can be set, please see
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9989 * {@link DataTable.defaults.column}. Note that if you use `columns` to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9990 * define your columns, you must have an entry in the array for every single
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9991 * column that you have in your table (these can be null if you don't which
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9992 * to specify any options).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9993 * @member
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9994 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9995 * @name DataTable.defaults.column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9996 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9997 "aoColumns": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9998
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
9999 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10000 * Very similar to `columns`, `columnDefs` allows you to target a specific
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10001 * column, multiple columns, or all columns, using the `targets` property of
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10002 * each object in the array. This allows great flexibility when creating
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10003 * tables, as the `columnDefs` arrays can be of any length, targeting the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10004 * columns you specifically want. `columnDefs` may use any of the column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10005 * options available: {@link DataTable.defaults.column}, but it _must_
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10006 * have `targets` defined in each object in the array. Values in the `targets`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10007 * array may be:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10008 * <ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10009 * <li>a string - class name will be matched on the TH for the column</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10010 * <li>0 or a positive integer - column index counting from the left</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10011 * <li>a negative integer - column index counting from the right</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10012 * <li>the string "_all" - all columns (i.e. assign a default)</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10013 * </ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10014 * @member
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10015 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10016 * @name DataTable.defaults.columnDefs
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10017 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10018 "aoColumnDefs": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10019
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10020
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10021 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10022 * Basically the same as `search`, this parameter defines the individual column
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10023 * filtering state at initialisation time. The array must be of the same size
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10024 * as the number of columns, and each element be an object with the parameters
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10025 * `search` and `escapeRegex` (the latter is optional). 'null' is also
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10026 * accepted and the default will be used.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10027 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10028 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10029 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10030 * @dtopt Option
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10031 * @name DataTable.defaults.searchCols
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10032 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10033 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10034 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10035 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10036 * "searchCols": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10037 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10038 * { "search": "My filter" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10039 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10040 * { "search": "^[0-9]", "escapeRegex": false }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10041 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10042 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10043 * } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10044 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10045 "aoSearchCols": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10046
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10047
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10048 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10049 * An array of CSS classes that should be applied to displayed rows. This
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10050 * array may be of any length, and DataTables will apply each class
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10051 * sequentially, looping when required.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10052 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10053 * @default null <i>Will take the values determined by the `oClasses.stripe*`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10054 * options</i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10055 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10056 * @dtopt Option
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10057 * @name DataTable.defaults.stripeClasses
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10058 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10059 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10060 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10061 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10062 * "stripeClasses": [ 'strip1', 'strip2', 'strip3' ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10063 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10064 * } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10065 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10066 "asStripeClasses": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10067
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10068
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10069 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10070 * Enable or disable automatic column width calculation. This can be disabled
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10071 * as an optimisation (it takes some time to calculate the widths) if the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10072 * tables widths are passed in using `columns`.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10073 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10074 * @default true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10075 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10076 * @dtopt Features
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10077 * @name DataTable.defaults.autoWidth
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10078 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10079 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10080 * $(document).ready( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10081 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10082 * "autoWidth": false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10083 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10084 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10085 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10086 "bAutoWidth": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10087
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10088
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10089 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10090 * Deferred rendering can provide DataTables with a huge speed boost when you
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10091 * are using an Ajax or JS data source for the table. This option, when set to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10092 * true, will cause DataTables to defer the creation of the table elements for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10093 * each row until they are needed for a draw - saving a significant amount of
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10094 * time.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10095 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10096 * @default false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10097 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10098 * @dtopt Features
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10099 * @name DataTable.defaults.deferRender
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10100 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10101 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10102 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10103 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10104 * "ajax": "sources/arrays.txt",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10105 * "deferRender": true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10106 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10107 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10108 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10109 "bDeferRender": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10110
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10111
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10112 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10113 * Replace a DataTable which matches the given selector and replace it with
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10114 * one which has the properties of the new initialisation object passed. If no
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10115 * table matches the selector, then the new DataTable will be constructed as
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10116 * per normal.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10117 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10118 * @default false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10119 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10120 * @dtopt Options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10121 * @name DataTable.defaults.destroy
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10122 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10123 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10124 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10125 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10126 * "srollY": "200px",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10127 * "paginate": false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10128 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10129 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10130 * // Some time later....
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10131 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10132 * "filter": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10133 * "destroy": true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10134 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10135 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10136 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10137 "bDestroy": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10138
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10139
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10140 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10141 * Enable or disable filtering of data. Filtering in DataTables is "smart" in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10142 * that it allows the end user to input multiple words (space separated) and
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10143 * will match a row containing those words, even if not in the order that was
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10144 * specified (this allow matching across multiple columns). Note that if you
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10145 * wish to use filtering in DataTables this must remain 'true' - to remove the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10146 * default filtering input box and retain filtering abilities, please use
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10147 * {@link DataTable.defaults.dom}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10148 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10149 * @default true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10150 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10151 * @dtopt Features
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10152 * @name DataTable.defaults.searching
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10153 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10154 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10155 * $(document).ready( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10156 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10157 * "searching": false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10158 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10159 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10160 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10161 "bFilter": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10162
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10163
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10164 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10165 * Enable or disable the table information display. This shows information
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10166 * about the data that is currently visible on the page, including information
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10167 * about filtered data if that action is being performed.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10168 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10169 * @default true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10170 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10171 * @dtopt Features
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10172 * @name DataTable.defaults.info
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10173 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10174 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10175 * $(document).ready( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10176 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10177 * "info": false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10178 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10179 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10180 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10181 "bInfo": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10182
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10183
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10184 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10185 * Enable jQuery UI ThemeRoller support (required as ThemeRoller requires some
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10186 * slightly different and additional mark-up from what DataTables has
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10187 * traditionally used).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10188 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10189 * @default false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10190 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10191 * @dtopt Features
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10192 * @name DataTable.defaults.jQueryUI
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10193 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10194 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10195 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10196 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10197 * "jQueryUI": true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10198 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10199 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10200 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10201 "bJQueryUI": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10202
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10203
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10204 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10205 * Allows the end user to select the size of a formatted page from a select
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10206 * menu (sizes are 10, 25, 50 and 100). Requires pagination (`paginate`).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10207 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10208 * @default true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10209 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10210 * @dtopt Features
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10211 * @name DataTable.defaults.lengthChange
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10212 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10213 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10214 * $(document).ready( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10215 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10216 * "lengthChange": false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10217 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10218 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10219 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10220 "bLengthChange": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10221
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10222
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10223 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10224 * Enable or disable pagination.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10225 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10226 * @default true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10227 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10228 * @dtopt Features
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10229 * @name DataTable.defaults.paging
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10230 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10231 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10232 * $(document).ready( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10233 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10234 * "paging": false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10235 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10236 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10237 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10238 "bPaginate": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10239
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10240
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10241 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10242 * Enable or disable the display of a 'processing' indicator when the table is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10243 * being processed (e.g. a sort). This is particularly useful for tables with
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10244 * large amounts of data where it can take a noticeable amount of time to sort
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10245 * the entries.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10246 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10247 * @default false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10248 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10249 * @dtopt Features
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10250 * @name DataTable.defaults.processing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10251 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10252 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10253 * $(document).ready( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10254 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10255 * "processing": true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10256 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10257 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10258 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10259 "bProcessing": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10260
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10261
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10262 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10263 * Retrieve the DataTables object for the given selector. Note that if the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10264 * table has already been initialised, this parameter will cause DataTables
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10265 * to simply return the object that has already been set up - it will not take
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10266 * account of any changes you might have made to the initialisation object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10267 * passed to DataTables (setting this parameter to true is an acknowledgement
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10268 * that you understand this). `destroy` can be used to reinitialise a table if
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10269 * you need.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10270 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10271 * @default false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10272 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10273 * @dtopt Options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10274 * @name DataTable.defaults.retrieve
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10275 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10276 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10277 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10278 * initTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10279 * tableActions();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10280 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10281 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10282 * function initTable ()
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10283 * {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10284 * return $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10285 * "scrollY": "200px",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10286 * "paginate": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10287 * "retrieve": true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10288 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10289 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10290 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10291 * function tableActions ()
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10292 * {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10293 * var table = initTable();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10294 * // perform API operations with oTable
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10295 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10296 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10297 "bRetrieve": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10298
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10299
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10300 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10301 * When vertical (y) scrolling is enabled, DataTables will force the height of
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10302 * the table's viewport to the given height at all times (useful for layout).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10303 * However, this can look odd when filtering data down to a small data set,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10304 * and the footer is left "floating" further down. This parameter (when
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10305 * enabled) will cause DataTables to collapse the table's viewport down when
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10306 * the result set will fit within the given Y height.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10307 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10308 * @default false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10309 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10310 * @dtopt Options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10311 * @name DataTable.defaults.scrollCollapse
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10312 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10313 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10314 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10315 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10316 * "scrollY": "200",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10317 * "scrollCollapse": true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10318 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10319 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10320 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10321 "bScrollCollapse": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10322
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10323
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10324 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10325 * Configure DataTables to use server-side processing. Note that the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10326 * `ajax` parameter must also be given in order to give DataTables a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10327 * source to obtain the required data for each draw.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10328 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10329 * @default false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10330 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10331 * @dtopt Features
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10332 * @dtopt Server-side
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10333 * @name DataTable.defaults.serverSide
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10334 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10335 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10336 * $(document).ready( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10337 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10338 * "serverSide": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10339 * "ajax": "xhr.php"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10340 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10341 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10342 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10343 "bServerSide": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10344
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10345
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10346 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10347 * Enable or disable sorting of columns. Sorting of individual columns can be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10348 * disabled by the `sortable` option for each column.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10349 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10350 * @default true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10351 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10352 * @dtopt Features
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10353 * @name DataTable.defaults.ordering
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10354 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10355 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10356 * $(document).ready( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10357 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10358 * "ordering": false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10359 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10360 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10361 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10362 "bSort": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10363
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10364
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10365 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10366 * Enable or display DataTables' ability to sort multiple columns at the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10367 * same time (activated by shift-click by the user).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10368 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10369 * @default true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10370 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10371 * @dtopt Options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10372 * @name DataTable.defaults.orderMulti
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10373 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10374 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10375 * // Disable multiple column sorting ability
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10376 * $(document).ready( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10377 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10378 * "orderMulti": false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10379 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10380 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10381 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10382 "bSortMulti": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10383
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10384
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10385 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10386 * Allows control over whether DataTables should use the top (true) unique
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10387 * cell that is found for a single column, or the bottom (false - default).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10388 * This is useful when using complex headers.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10389 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10390 * @default false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10391 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10392 * @dtopt Options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10393 * @name DataTable.defaults.orderCellsTop
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10394 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10395 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10396 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10397 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10398 * "orderCellsTop": true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10399 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10400 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10401 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10402 "bSortCellsTop": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10403
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10404
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10405 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10406 * Enable or disable the addition of the classes `sorting\_1`, `sorting\_2` and
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10407 * `sorting\_3` to the columns which are currently being sorted on. This is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10408 * presented as a feature switch as it can increase processing time (while
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10409 * classes are removed and added) so for large data sets you might want to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10410 * turn this off.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10411 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10412 * @default true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10413 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10414 * @dtopt Features
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10415 * @name DataTable.defaults.orderClasses
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10416 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10417 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10418 * $(document).ready( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10419 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10420 * "orderClasses": false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10421 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10422 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10423 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10424 "bSortClasses": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10425
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10426
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10427 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10428 * Enable or disable state saving. When enabled HTML5 `localStorage` will be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10429 * used to save table display information such as pagination information,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10430 * display length, filtering and sorting. As such when the end user reloads
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10431 * the page the display display will match what thy had previously set up.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10432 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10433 * Due to the use of `localStorage` the default state saving is not supported
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10434 * in IE6 or 7. If state saving is required in those browsers, use
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10435 * `stateSaveCallback` to provide a storage solution such as cookies.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10436 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10437 * @default false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10438 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10439 * @dtopt Features
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10440 * @name DataTable.defaults.stateSave
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10441 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10442 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10443 * $(document).ready( function () {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10444 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10445 * "stateSave": true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10446 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10447 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10448 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10449 "bStateSave": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10450
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10451
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10452 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10453 * This function is called when a TR element is created (and all TD child
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10454 * elements have been inserted), or registered if using a DOM source, allowing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10455 * manipulation of the TR element (adding classes etc).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10456 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10457 * @param {node} row "TR" element for the current row
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10458 * @param {array} data Raw data array for this row
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10459 * @param {int} dataIndex The index of this row in the internal aoData array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10460 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10461 * @dtopt Callbacks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10462 * @name DataTable.defaults.createdRow
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10463 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10464 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10465 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10466 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10467 * "createdRow": function( row, data, dataIndex ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10468 * // Bold the grade for all 'A' grade browsers
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10469 * if ( data[4] == "A" )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10470 * {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10471 * $('td:eq(4)', row).html( '<b>A</b>' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10472 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10473 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10474 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10475 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10476 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10477 "fnCreatedRow": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10478
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10479
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10480 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10481 * This function is called on every 'draw' event, and allows you to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10482 * dynamically modify any aspect you want about the created DOM.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10483 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10484 * @param {object} settings DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10485 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10486 * @dtopt Callbacks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10487 * @name DataTable.defaults.drawCallback
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10488 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10489 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10490 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10491 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10492 * "drawCallback": function( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10493 * alert( 'DataTables has redrawn the table' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10494 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10495 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10496 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10497 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10498 "fnDrawCallback": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10499
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10500
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10501 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10502 * Identical to fnHeaderCallback() but for the table footer this function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10503 * allows you to modify the table footer on every 'draw' event.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10504 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10505 * @param {node} foot "TR" element for the footer
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10506 * @param {array} data Full table data (as derived from the original HTML)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10507 * @param {int} start Index for the current display starting point in the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10508 * display array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10509 * @param {int} end Index for the current display ending point in the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10510 * display array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10511 * @param {array int} display Index array to translate the visual position
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10512 * to the full data array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10513 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10514 * @dtopt Callbacks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10515 * @name DataTable.defaults.footerCallback
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10516 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10517 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10518 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10519 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10520 * "footerCallback": function( tfoot, data, start, end, display ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10521 * tfoot.getElementsByTagName('th')[0].innerHTML = "Starting index is "+start;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10522 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10523 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10524 * } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10525 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10526 "fnFooterCallback": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10527
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10528
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10529 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10530 * When rendering large numbers in the information element for the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10531 * (i.e. "Showing 1 to 10 of 57 entries") DataTables will render large numbers
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10532 * to have a comma separator for the 'thousands' units (e.g. 1 million is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10533 * rendered as "1,000,000") to help readability for the end user. This
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10534 * function will override the default method DataTables uses.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10535 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10536 * @member
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10537 * @param {int} toFormat number to be formatted
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10538 * @returns {string} formatted string for DataTables to show the number
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10539 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10540 * @dtopt Callbacks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10541 * @name DataTable.defaults.formatNumber
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10542 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10543 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10544 * // Format a number using a single quote for the separator (note that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10545 * // this can also be done with the language.thousands option)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10546 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10547 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10548 * "formatNumber": function ( toFormat ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10549 * return toFormat.toString().replace(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10550 * /\B(?=(\d{3})+(?!\d))/g, "'"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10551 * );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10552 * };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10553 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10554 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10555 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10556 "fnFormatNumber": function ( toFormat ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10557 return toFormat.toString().replace(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10558 /\B(?=(\d{3})+(?!\d))/g,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10559 this.oLanguage.sThousands
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10560 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10561 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10562
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10563
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10564 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10565 * This function is called on every 'draw' event, and allows you to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10566 * dynamically modify the header row. This can be used to calculate and
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10567 * display useful information about the table.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10568 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10569 * @param {node} head "TR" element for the header
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10570 * @param {array} data Full table data (as derived from the original HTML)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10571 * @param {int} start Index for the current display starting point in the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10572 * display array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10573 * @param {int} end Index for the current display ending point in the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10574 * display array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10575 * @param {array int} display Index array to translate the visual position
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10576 * to the full data array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10577 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10578 * @dtopt Callbacks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10579 * @name DataTable.defaults.headerCallback
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10580 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10581 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10582 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10583 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10584 * "fheaderCallback": function( head, data, start, end, display ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10585 * head.getElementsByTagName('th')[0].innerHTML = "Displaying "+(end-start)+" records";
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10586 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10587 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10588 * } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10589 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10590 "fnHeaderCallback": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10591
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10592
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10593 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10594 * The information element can be used to convey information about the current
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10595 * state of the table. Although the internationalisation options presented by
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10596 * DataTables are quite capable of dealing with most customisations, there may
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10597 * be times where you wish to customise the string further. This callback
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10598 * allows you to do exactly that.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10599 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10600 * @param {object} oSettings DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10601 * @param {int} start Starting position in data for the draw
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10602 * @param {int} end End position in data for the draw
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10603 * @param {int} max Total number of rows in the table (regardless of
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10604 * filtering)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10605 * @param {int} total Total number of rows in the data set, after filtering
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10606 * @param {string} pre The string that DataTables has formatted using it's
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10607 * own rules
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10608 * @returns {string} The string to be displayed in the information element.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10609 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10610 * @dtopt Callbacks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10611 * @name DataTable.defaults.infoCallback
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10612 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10613 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10614 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10615 * "infoCallback": function( settings, start, end, max, total, pre ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10616 * return start +" to "+ end;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10617 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10618 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10619 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10620 "fnInfoCallback": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10621
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10622
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10623 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10624 * Called when the table has been initialised. Normally DataTables will
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10625 * initialise sequentially and there will be no need for this function,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10626 * however, this does not hold true when using external language information
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10627 * since that is obtained using an async XHR call.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10628 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10629 * @param {object} settings DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10630 * @param {object} json The JSON object request from the server - only
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10631 * present if client-side Ajax sourced data is used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10632 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10633 * @dtopt Callbacks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10634 * @name DataTable.defaults.initComplete
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10635 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10636 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10637 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10638 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10639 * "initComplete": function(settings, json) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10640 * alert( 'DataTables has finished its initialisation.' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10641 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10642 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10643 * } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10644 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10645 "fnInitComplete": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10646
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10647
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10648 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10649 * Called at the very start of each table draw and can be used to cancel the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10650 * draw by returning false, any other return (including undefined) results in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10651 * the full draw occurring).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10652 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10653 * @param {object} settings DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10654 * @returns {boolean} False will cancel the draw, anything else (including no
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10655 * return) will allow it to complete.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10656 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10657 * @dtopt Callbacks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10658 * @name DataTable.defaults.preDrawCallback
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10659 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10660 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10661 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10662 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10663 * "preDrawCallback": function( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10664 * if ( $('#test').val() == 1 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10665 * return false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10666 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10667 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10668 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10669 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10670 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10671 "fnPreDrawCallback": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10672
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10673
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10674 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10675 * This function allows you to 'post process' each row after it have been
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10676 * generated for each table draw, but before it is rendered on screen. This
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10677 * function might be used for setting the row class name etc.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10678 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10679 * @param {node} row "TR" element for the current row
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10680 * @param {array} data Raw data array for this row
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10681 * @param {int} displayIndex The display index for the current table draw
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10682 * @param {int} displayIndexFull The index of the data in the full list of
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10683 * rows (after filtering)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10684 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10685 * @dtopt Callbacks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10686 * @name DataTable.defaults.rowCallback
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10687 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10688 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10689 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10690 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10691 * "rowCallback": function( row, data, displayIndex, displayIndexFull ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10692 * // Bold the grade for all 'A' grade browsers
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10693 * if ( data[4] == "A" ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10694 * $('td:eq(4)', row).html( '<b>A</b>' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10695 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10696 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10697 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10698 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10699 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10700 "fnRowCallback": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10701
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10702
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10703 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10704 * __Deprecated__ The functionality provided by this parameter has now been
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10705 * superseded by that provided through `ajax`, which should be used instead.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10706 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10707 * This parameter allows you to override the default function which obtains
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10708 * the data from the server so something more suitable for your application.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10709 * For example you could use POST data, or pull information from a Gears or
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10710 * AIR database.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10711 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10712 * @member
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10713 * @param {string} source HTTP source to obtain the data from (`ajax`)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10714 * @param {array} data A key/value pair object containing the data to send
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10715 * to the server
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10716 * @param {function} callback to be called on completion of the data get
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10717 * process that will draw the data on the page.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10718 * @param {object} settings DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10719 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10720 * @dtopt Callbacks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10721 * @dtopt Server-side
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10722 * @name DataTable.defaults.serverData
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10723 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10724 * @deprecated 1.10. Please use `ajax` for this functionality now.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10725 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10726 "fnServerData": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10727
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10728
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10729 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10730 * __Deprecated__ The functionality provided by this parameter has now been
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10731 * superseded by that provided through `ajax`, which should be used instead.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10732 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10733 * It is often useful to send extra data to the server when making an Ajax
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10734 * request - for example custom filtering information, and this callback
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10735 * function makes it trivial to send extra information to the server. The
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10736 * passed in parameter is the data set that has been constructed by
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10737 * DataTables, and you can add to this or modify it as you require.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10738 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10739 * @param {array} data Data array (array of objects which are name/value
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10740 * pairs) that has been constructed by DataTables and will be sent to the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10741 * server. In the case of Ajax sourced data with server-side processing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10742 * this will be an empty array, for server-side processing there will be a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10743 * significant number of parameters!
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10744 * @returns {undefined} Ensure that you modify the data array passed in,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10745 * as this is passed by reference.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10746 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10747 * @dtopt Callbacks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10748 * @dtopt Server-side
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10749 * @name DataTable.defaults.serverParams
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10750 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10751 * @deprecated 1.10. Please use `ajax` for this functionality now.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10752 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10753 "fnServerParams": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10754
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10755
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10756 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10757 * Load the table state. With this function you can define from where, and how, the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10758 * state of a table is loaded. By default DataTables will load from `localStorage`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10759 * but you might wish to use a server-side database or cookies.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10760 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10761 * @member
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10762 * @param {object} settings DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10763 * @return {object} The DataTables state object to be loaded
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10764 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10765 * @dtopt Callbacks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10766 * @name DataTable.defaults.stateLoadCallback
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10767 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10768 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10769 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10770 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10771 * "stateSave": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10772 * "stateLoadCallback": function (settings) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10773 * var o;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10774 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10775 * // Send an Ajax request to the server to get the data. Note that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10776 * // this is a synchronous request.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10777 * $.ajax( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10778 * "url": "/state_load",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10779 * "async": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10780 * "dataType": "json",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10781 * "success": function (json) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10782 * o = json;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10783 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10784 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10785 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10786 * return o;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10787 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10788 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10789 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10790 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10791 "fnStateLoadCallback": function ( settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10792 try {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10793 return JSON.parse(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10794 (settings.iStateDuration === -1 ? sessionStorage : localStorage).getItem(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10795 'DataTables_'+settings.sInstance+'_'+location.pathname
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10796 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10797 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10798 } catch (e) {}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10799 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10800
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10801
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10802 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10803 * Callback which allows modification of the saved state prior to loading that state.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10804 * This callback is called when the table is loading state from the stored data, but
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10805 * prior to the settings object being modified by the saved state. Note that for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10806 * plug-in authors, you should use the `stateLoadParams` event to load parameters for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10807 * a plug-in.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10808 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10809 * @param {object} settings DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10810 * @param {object} data The state object that is to be loaded
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10811 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10812 * @dtopt Callbacks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10813 * @name DataTable.defaults.stateLoadParams
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10814 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10815 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10816 * // Remove a saved filter, so filtering is never loaded
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10817 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10818 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10819 * "stateSave": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10820 * "stateLoadParams": function (settings, data) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10821 * data.oSearch.sSearch = "";
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10822 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10823 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10824 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10825 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10826 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10827 * // Disallow state loading by returning false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10828 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10829 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10830 * "stateSave": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10831 * "stateLoadParams": function (settings, data) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10832 * return false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10833 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10834 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10835 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10836 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10837 "fnStateLoadParams": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10838
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10839
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10840 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10841 * Callback that is called when the state has been loaded from the state saving method
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10842 * and the DataTables settings object has been modified as a result of the loaded state.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10843 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10844 * @param {object} settings DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10845 * @param {object} data The state object that was loaded
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10846 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10847 * @dtopt Callbacks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10848 * @name DataTable.defaults.stateLoaded
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10849 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10850 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10851 * // Show an alert with the filtering value that was saved
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10852 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10853 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10854 * "stateSave": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10855 * "stateLoaded": function (settings, data) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10856 * alert( 'Saved filter was: '+data.oSearch.sSearch );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10857 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10858 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10859 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10860 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10861 "fnStateLoaded": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10862
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10863
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10864 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10865 * Save the table state. This function allows you to define where and how the state
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10866 * information for the table is stored By default DataTables will use `localStorage`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10867 * but you might wish to use a server-side database or cookies.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10868 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10869 * @member
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10870 * @param {object} settings DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10871 * @param {object} data The state object to be saved
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10872 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10873 * @dtopt Callbacks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10874 * @name DataTable.defaults.stateSaveCallback
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10875 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10876 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10877 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10878 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10879 * "stateSave": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10880 * "stateSaveCallback": function (settings, data) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10881 * // Send an Ajax request to the server with the state object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10882 * $.ajax( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10883 * "url": "/state_save",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10884 * "data": data,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10885 * "dataType": "json",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10886 * "method": "POST"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10887 * "success": function () {}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10888 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10889 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10890 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10891 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10892 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10893 "fnStateSaveCallback": function ( settings, data ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10894 try {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10895 (settings.iStateDuration === -1 ? sessionStorage : localStorage).setItem(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10896 'DataTables_'+settings.sInstance+'_'+location.pathname,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10897 JSON.stringify( data )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10898 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10899 } catch (e) {}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10900 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10901
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10902
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10903 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10904 * Callback which allows modification of the state to be saved. Called when the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10905 * has changed state a new state save is required. This method allows modification of
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10906 * the state saving object prior to actually doing the save, including addition or
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10907 * other state properties or modification. Note that for plug-in authors, you should
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10908 * use the `stateSaveParams` event to save parameters for a plug-in.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10909 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10910 * @param {object} settings DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10911 * @param {object} data The state object to be saved
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10912 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10913 * @dtopt Callbacks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10914 * @name DataTable.defaults.stateSaveParams
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10915 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10916 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10917 * // Remove a saved filter, so filtering is never saved
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10918 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10919 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10920 * "stateSave": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10921 * "stateSaveParams": function (settings, data) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10922 * data.oSearch.sSearch = "";
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10923 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10924 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10925 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10926 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10927 "fnStateSaveParams": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10928
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10929
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10930 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10931 * Duration for which the saved state information is considered valid. After this period
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10932 * has elapsed the state will be returned to the default.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10933 * Value is given in seconds.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10934 * @type int
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10935 * @default 7200 <i>(2 hours)</i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10936 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10937 * @dtopt Options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10938 * @name DataTable.defaults.stateDuration
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10939 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10940 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10941 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10942 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10943 * "stateDuration": 60*60*24; // 1 day
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10944 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10945 * } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10946 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10947 "iStateDuration": 7200,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10948
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10949
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10950 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10951 * When enabled DataTables will not make a request to the server for the first
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10952 * page draw - rather it will use the data already on the page (no sorting etc
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10953 * will be applied to it), thus saving on an XHR at load time. `deferLoading`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10954 * is used to indicate that deferred loading is required, but it is also used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10955 * to tell DataTables how many records there are in the full table (allowing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10956 * the information element and pagination to be displayed correctly). In the case
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10957 * where a filtering is applied to the table on initial load, this can be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10958 * indicated by giving the parameter as an array, where the first element is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10959 * the number of records available after filtering and the second element is the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10960 * number of records without filtering (allowing the table information element
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10961 * to be shown correctly).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10962 * @type int | array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10963 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10964 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10965 * @dtopt Options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10966 * @name DataTable.defaults.deferLoading
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10967 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10968 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10969 * // 57 records available in the table, no filtering applied
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10970 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10971 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10972 * "serverSide": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10973 * "ajax": "scripts/server_processing.php",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10974 * "deferLoading": 57
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10975 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10976 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10977 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10978 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10979 * // 57 records after filtering, 100 without filtering (an initial filter applied)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10980 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10981 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10982 * "serverSide": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10983 * "ajax": "scripts/server_processing.php",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10984 * "deferLoading": [ 57, 100 ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10985 * "search": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10986 * "search": "my_filter"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10987 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10988 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10989 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10990 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10991 "iDeferLoading": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10992
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10993
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10994 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10995 * Number of rows to display on a single page when using pagination. If
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10996 * feature enabled (`lengthChange`) then the end user will be able to override
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10997 * this to a custom setting using a pop-up menu.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10998 * @type int
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
10999 * @default 10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11000 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11001 * @dtopt Options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11002 * @name DataTable.defaults.pageLength
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11003 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11004 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11005 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11006 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11007 * "pageLength": 50
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11008 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11009 * } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11010 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11011 "iDisplayLength": 10,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11012
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11013
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11014 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11015 * Define the starting point for data display when using DataTables with
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11016 * pagination. Note that this parameter is the number of records, rather than
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11017 * the page number, so if you have 10 records per page and want to start on
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11018 * the third page, it should be "20".
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11019 * @type int
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11020 * @default 0
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11021 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11022 * @dtopt Options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11023 * @name DataTable.defaults.displayStart
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11024 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11025 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11026 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11027 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11028 * "displayStart": 20
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11029 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11030 * } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11031 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11032 "iDisplayStart": 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11033
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11034
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11035 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11036 * By default DataTables allows keyboard navigation of the table (sorting, paging,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11037 * and filtering) by adding a `tabindex` attribute to the required elements. This
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11038 * allows you to tab through the controls and press the enter key to activate them.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11039 * The tabindex is default 0, meaning that the tab follows the flow of the document.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11040 * You can overrule this using this parameter if you wish. Use a value of -1 to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11041 * disable built-in keyboard navigation.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11042 * @type int
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11043 * @default 0
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11044 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11045 * @dtopt Options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11046 * @name DataTable.defaults.tabIndex
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11047 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11048 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11049 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11050 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11051 * "tabIndex": 1
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11052 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11053 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11054 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11055 "iTabIndex": 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11056
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11057
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11058 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11059 * Classes that DataTables assigns to the various components and features
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11060 * that it adds to the HTML table. This allows classes to be configured
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11061 * during initialisation in addition to through the static
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11062 * {@link DataTable.ext.oStdClasses} object).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11063 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11064 * @name DataTable.defaults.classes
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11065 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11066 "oClasses": {},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11067
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11068
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11069 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11070 * All strings that DataTables uses in the user interface that it creates
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11071 * are defined in this object, allowing you to modified them individually or
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11072 * completely replace them all as required.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11073 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11074 * @name DataTable.defaults.language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11075 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11076 "oLanguage": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11077 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11078 * Strings that are used for WAI-ARIA labels and controls only (these are not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11079 * actually visible on the page, but will be read by screenreaders, and thus
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11080 * must be internationalised as well).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11081 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11082 * @name DataTable.defaults.language.aria
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11083 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11084 "oAria": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11085 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11086 * ARIA label that is added to the table headers when the column may be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11087 * sorted ascending by activing the column (click or return when focused).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11088 * Note that the column header is prefixed to this string.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11089 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11090 * @default : activate to sort column ascending
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11091 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11092 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11093 * @name DataTable.defaults.language.aria.sortAscending
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11094 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11095 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11096 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11097 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11098 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11099 * "aria": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11100 * "sortAscending": " - click/return to sort ascending"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11101 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11102 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11103 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11104 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11105 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11106 "sSortAscending": ": activate to sort column ascending",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11107
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11108 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11109 * ARIA label that is added to the table headers when the column may be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11110 * sorted descending by activing the column (click or return when focused).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11111 * Note that the column header is prefixed to this string.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11112 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11113 * @default : activate to sort column ascending
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11114 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11115 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11116 * @name DataTable.defaults.language.aria.sortDescending
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11117 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11118 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11119 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11120 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11121 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11122 * "aria": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11123 * "sortDescending": " - click/return to sort descending"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11124 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11125 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11126 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11127 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11128 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11129 "sSortDescending": ": activate to sort column descending"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11130 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11131
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11132 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11133 * Pagination string used by DataTables for the built-in pagination
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11134 * control types.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11135 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11136 * @name DataTable.defaults.language.paginate
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11137 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11138 "oPaginate": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11139 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11140 * Text to use when using the 'full_numbers' type of pagination for the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11141 * button to take the user to the first page.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11142 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11143 * @default First
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11144 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11145 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11146 * @name DataTable.defaults.language.paginate.first
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11147 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11148 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11149 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11150 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11151 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11152 * "paginate": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11153 * "first": "First page"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11154 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11155 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11156 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11157 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11158 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11159 "sFirst": "First",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11160
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11161
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11162 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11163 * Text to use when using the 'full_numbers' type of pagination for the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11164 * button to take the user to the last page.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11165 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11166 * @default Last
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11167 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11168 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11169 * @name DataTable.defaults.language.paginate.last
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11170 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11171 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11172 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11173 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11174 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11175 * "paginate": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11176 * "last": "Last page"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11177 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11178 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11179 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11180 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11181 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11182 "sLast": "Last",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11183
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11184
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11185 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11186 * Text to use for the 'next' pagination button (to take the user to the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11187 * next page).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11188 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11189 * @default Next
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11190 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11191 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11192 * @name DataTable.defaults.language.paginate.next
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11193 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11194 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11195 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11196 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11197 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11198 * "paginate": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11199 * "next": "Next page"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11200 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11201 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11202 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11203 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11204 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11205 "sNext": "Next",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11206
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11207
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11208 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11209 * Text to use for the 'previous' pagination button (to take the user to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11210 * the previous page).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11211 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11212 * @default Previous
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11213 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11214 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11215 * @name DataTable.defaults.language.paginate.previous
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11216 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11217 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11218 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11219 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11220 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11221 * "paginate": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11222 * "previous": "Previous page"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11223 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11224 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11225 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11226 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11227 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11228 "sPrevious": "Previous"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11229 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11230
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11231 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11232 * This string is shown in preference to `zeroRecords` when the table is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11233 * empty of data (regardless of filtering). Note that this is an optional
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11234 * parameter - if it is not given, the value of `zeroRecords` will be used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11235 * instead (either the default or given value).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11236 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11237 * @default No data available in table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11238 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11239 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11240 * @name DataTable.defaults.language.emptyTable
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11241 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11242 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11243 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11244 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11245 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11246 * "emptyTable": "No data available in table"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11247 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11248 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11249 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11250 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11251 "sEmptyTable": "No data available in table",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11252
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11253
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11254 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11255 * This string gives information to the end user about the information
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11256 * that is current on display on the page. The following tokens can be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11257 * used in the string and will be dynamically replaced as the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11258 * display updates. This tokens can be placed anywhere in the string, or
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11259 * removed as needed by the language requires:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11260 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11261 * * `\_START\_` - Display index of the first record on the current page
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11262 * * `\_END\_` - Display index of the last record on the current page
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11263 * * `\_TOTAL\_` - Number of records in the table after filtering
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11264 * * `\_MAX\_` - Number of records in the table without filtering
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11265 * * `\_PAGE\_` - Current page number
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11266 * * `\_PAGES\_` - Total number of pages of data in the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11267 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11268 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11269 * @default Showing _START_ to _END_ of _TOTAL_ entries
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11270 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11271 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11272 * @name DataTable.defaults.language.info
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11273 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11274 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11275 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11276 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11277 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11278 * "info": "Showing page _PAGE_ of _PAGES_"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11279 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11280 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11281 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11282 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11283 "sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11284
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11285
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11286 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11287 * Display information string for when the table is empty. Typically the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11288 * format of this string should match `info`.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11289 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11290 * @default Showing 0 to 0 of 0 entries
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11291 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11292 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11293 * @name DataTable.defaults.language.infoEmpty
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11294 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11295 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11296 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11297 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11298 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11299 * "infoEmpty": "No entries to show"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11300 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11301 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11302 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11303 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11304 "sInfoEmpty": "Showing 0 to 0 of 0 entries",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11305
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11306
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11307 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11308 * When a user filters the information in a table, this string is appended
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11309 * to the information (`info`) to give an idea of how strong the filtering
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11310 * is. The variable _MAX_ is dynamically updated.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11311 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11312 * @default (filtered from _MAX_ total entries)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11313 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11314 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11315 * @name DataTable.defaults.language.infoFiltered
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11316 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11317 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11318 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11319 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11320 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11321 * "infoFiltered": " - filtering from _MAX_ records"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11322 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11323 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11324 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11325 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11326 "sInfoFiltered": "(filtered from _MAX_ total entries)",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11327
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11328
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11329 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11330 * If can be useful to append extra information to the info string at times,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11331 * and this variable does exactly that. This information will be appended to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11332 * the `info` (`infoEmpty` and `infoFiltered` in whatever combination they are
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11333 * being used) at all times.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11334 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11335 * @default <i>Empty string</i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11336 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11337 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11338 * @name DataTable.defaults.language.infoPostFix
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11339 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11340 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11341 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11342 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11343 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11344 * "infoPostFix": "All records shown are derived from real information."
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11345 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11346 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11347 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11348 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11349 "sInfoPostFix": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11350
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11351
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11352 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11353 * This decimal place operator is a little different from the other
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11354 * language options since DataTables doesn't output floating point
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11355 * numbers, so it won't ever use this for display of a number. Rather,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11356 * what this parameter does is modify the sort methods of the table so
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11357 * that numbers which are in a format which has a character other than
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11358 * a period (`.`) as a decimal place will be sorted numerically.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11359 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11360 * Note that numbers with different decimal places cannot be shown in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11361 * the same table and still be sortable, the table must be consistent.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11362 * However, multiple different tables on the page can use different
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11363 * decimal place characters.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11364 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11365 * @default
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11366 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11367 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11368 * @name DataTable.defaults.language.decimal
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11369 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11370 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11371 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11372 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11373 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11374 * "decimal": ","
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11375 * "thousands": "."
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11376 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11377 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11378 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11379 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11380 "sDecimal": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11381
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11382
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11383 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11384 * DataTables has a build in number formatter (`formatNumber`) which is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11385 * used to format large numbers that are used in the table information.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11386 * By default a comma is used, but this can be trivially changed to any
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11387 * character you wish with this parameter.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11388 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11389 * @default ,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11390 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11391 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11392 * @name DataTable.defaults.language.thousands
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11393 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11394 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11395 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11396 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11397 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11398 * "thousands": "'"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11399 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11400 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11401 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11402 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11403 "sThousands": ",",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11404
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11405
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11406 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11407 * Detail the action that will be taken when the drop down menu for the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11408 * pagination length option is changed. The '_MENU_' variable is replaced
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11409 * with a default select list of 10, 25, 50 and 100, and can be replaced
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11410 * with a custom select box if required.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11411 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11412 * @default Show _MENU_ entries
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11413 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11414 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11415 * @name DataTable.defaults.language.lengthMenu
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11416 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11417 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11418 * // Language change only
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11419 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11420 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11421 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11422 * "lengthMenu": "Display _MENU_ records"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11423 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11424 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11425 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11426 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11427 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11428 * // Language and options change
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11429 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11430 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11431 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11432 * "lengthMenu": 'Display <select>'+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11433 * '<option value="10">10</option>'+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11434 * '<option value="20">20</option>'+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11435 * '<option value="30">30</option>'+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11436 * '<option value="40">40</option>'+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11437 * '<option value="50">50</option>'+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11438 * '<option value="-1">All</option>'+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11439 * '</select> records'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11440 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11441 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11442 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11443 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11444 "sLengthMenu": "Show _MENU_ entries",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11445
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11446
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11447 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11448 * When using Ajax sourced data and during the first draw when DataTables is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11449 * gathering the data, this message is shown in an empty row in the table to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11450 * indicate to the end user the the data is being loaded. Note that this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11451 * parameter is not used when loading data by server-side processing, just
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11452 * Ajax sourced data with client-side processing.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11453 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11454 * @default Loading...
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11455 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11456 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11457 * @name DataTable.defaults.language.loadingRecords
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11458 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11459 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11460 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11461 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11462 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11463 * "loadingRecords": "Please wait - loading..."
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11464 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11465 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11466 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11467 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11468 "sLoadingRecords": "Loading...",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11469
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11470
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11471 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11472 * Text which is displayed when the table is processing a user action
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11473 * (usually a sort command or similar).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11474 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11475 * @default Processing...
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11476 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11477 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11478 * @name DataTable.defaults.language.processing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11479 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11480 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11481 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11482 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11483 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11484 * "processing": "DataTables is currently busy"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11485 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11486 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11487 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11488 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11489 "sProcessing": "Processing...",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11490
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11491
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11492 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11493 * Details the actions that will be taken when the user types into the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11494 * filtering input text box. The variable "_INPUT_", if used in the string,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11495 * is replaced with the HTML text box for the filtering input allowing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11496 * control over where it appears in the string. If "_INPUT_" is not given
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11497 * then the input box is appended to the string automatically.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11498 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11499 * @default Search:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11500 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11501 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11502 * @name DataTable.defaults.language.search
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11503 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11504 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11505 * // Input text box will be appended at the end automatically
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11506 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11507 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11508 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11509 * "search": "Filter records:"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11510 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11511 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11512 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11513 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11514 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11515 * // Specify where the filter should appear
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11516 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11517 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11518 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11519 * "search": "Apply filter _INPUT_ to table"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11520 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11521 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11522 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11523 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11524 "sSearch": "Search:",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11525
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11526
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11527 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11528 * Assign a `placeholder` attribute to the search `input` element
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11529 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11530 * @default
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11531 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11532 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11533 * @name DataTable.defaults.language.searchPlaceholder
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11534 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11535 "sSearchPlaceholder": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11536
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11537
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11538 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11539 * All of the language information can be stored in a file on the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11540 * server-side, which DataTables will look up if this parameter is passed.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11541 * It must store the URL of the language file, which is in a JSON format,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11542 * and the object has the same properties as the oLanguage object in the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11543 * initialiser object (i.e. the above parameters). Please refer to one of
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11544 * the example language files to see how this works in action.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11545 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11546 * @default <i>Empty string - i.e. disabled</i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11547 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11548 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11549 * @name DataTable.defaults.language.url
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11550 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11551 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11552 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11553 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11554 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11555 * "url": "http://www.sprymedia.co.uk/dataTables/lang.txt"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11556 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11557 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11558 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11559 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11560 "sUrl": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11561
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11562
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11563 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11564 * Text shown inside the table records when the is no information to be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11565 * displayed after filtering. `emptyTable` is shown when there is simply no
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11566 * information in the table at all (regardless of filtering).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11567 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11568 * @default No matching records found
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11569 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11570 * @dtopt Language
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11571 * @name DataTable.defaults.language.zeroRecords
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11572 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11573 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11574 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11575 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11576 * "language": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11577 * "zeroRecords": "No records to display"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11578 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11579 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11580 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11581 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11582 "sZeroRecords": "No matching records found"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11583 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11584
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11585
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11586 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11587 * This parameter allows you to have define the global filtering state at
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11588 * initialisation time. As an object the `search` parameter must be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11589 * defined, but all other parameters are optional. When `regex` is true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11590 * the search string will be treated as a regular expression, when false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11591 * (default) it will be treated as a straight string. When `smart`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11592 * DataTables will use it's smart filtering methods (to word match at
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11593 * any point in the data), when false this will not be done.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11594 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11595 * @extends DataTable.models.oSearch
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11596 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11597 * @dtopt Options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11598 * @name DataTable.defaults.search
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11599 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11600 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11601 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11602 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11603 * "search": {"search": "Initial search"}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11604 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11605 * } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11606 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11607 "oSearch": $.extend( {}, DataTable.models.oSearch ),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11608
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11609
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11610 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11611 * __Deprecated__ The functionality provided by this parameter has now been
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11612 * superseded by that provided through `ajax`, which should be used instead.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11613 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11614 * By default DataTables will look for the property `data` (or `aaData` for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11615 * compatibility with DataTables 1.9-) when obtaining data from an Ajax
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11616 * source or for server-side processing - this parameter allows that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11617 * property to be changed. You can use Javascript dotted object notation to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11618 * get a data source for multiple levels of nesting.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11619 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11620 * @default data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11621 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11622 * @dtopt Options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11623 * @dtopt Server-side
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11624 * @name DataTable.defaults.ajaxDataProp
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11625 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11626 * @deprecated 1.10. Please use `ajax` for this functionality now.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11627 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11628 "sAjaxDataProp": "data",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11629
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11630
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11631 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11632 * __Deprecated__ The functionality provided by this parameter has now been
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11633 * superseded by that provided through `ajax`, which should be used instead.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11634 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11635 * You can instruct DataTables to load data from an external
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11636 * source using this parameter (use aData if you want to pass data in you
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11637 * already have). Simply provide a url a JSON object can be obtained from.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11638 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11639 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11640 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11641 * @dtopt Options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11642 * @dtopt Server-side
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11643 * @name DataTable.defaults.ajaxSource
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11644 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11645 * @deprecated 1.10. Please use `ajax` for this functionality now.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11646 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11647 "sAjaxSource": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11648
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11649
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11650 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11651 * This initialisation variable allows you to specify exactly where in the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11652 * DOM you want DataTables to inject the various controls it adds to the page
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11653 * (for example you might want the pagination controls at the top of the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11654 * table). DIV elements (with or without a custom class) can also be added to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11655 * aid styling. The follow syntax is used:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11656 * <ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11657 * <li>The following options are allowed:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11658 * <ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11659 * <li>'l' - Length changing</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11660 * <li>'f' - Filtering input</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11661 * <li>'t' - The table!</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11662 * <li>'i' - Information</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11663 * <li>'p' - Pagination</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11664 * <li>'r' - pRocessing</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11665 * </ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11666 * </li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11667 * <li>The following constants are allowed:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11668 * <ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11669 * <li>'H' - jQueryUI theme "header" classes ('fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix')</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11670 * <li>'F' - jQueryUI theme "footer" classes ('fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix')</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11671 * </ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11672 * </li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11673 * <li>The following syntax is expected:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11674 * <ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11675 * <li>'&lt;' and '&gt;' - div elements</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11676 * <li>'&lt;"class" and '&gt;' - div with a class</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11677 * <li>'&lt;"#id" and '&gt;' - div with an ID</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11678 * </ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11679 * </li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11680 * <li>Examples:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11681 * <ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11682 * <li>'&lt;"wrapper"flipt&gt;'</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11683 * <li>'&lt;lf&lt;t&gt;ip&gt;'</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11684 * </ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11685 * </li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11686 * </ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11687 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11688 * @default lfrtip <i>(when `jQueryUI` is false)</i> <b>or</b>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11689 * <"H"lfr>t<"F"ip> <i>(when `jQueryUI` is true)</i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11690 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11691 * @dtopt Options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11692 * @name DataTable.defaults.dom
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11693 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11694 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11695 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11696 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11697 * "dom": '&lt;"top"i&gt;rt&lt;"bottom"flp&gt;&lt;"clear"&gt;'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11698 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11699 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11700 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11701 "sDom": "lfrtip",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11702
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11703
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11704 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11705 * Search delay option. This will throttle full table searches that use the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11706 * DataTables provided search input element (it does not effect calls to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11707 * `dt-api search()`, providing a delay before the search is made.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11708 * @type integer
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11709 * @default 0
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11710 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11711 * @dtopt Options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11712 * @name DataTable.defaults.searchDelay
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11713 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11714 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11715 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11716 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11717 * "searchDelay": 200
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11718 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11719 * } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11720 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11721 "searchDelay": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11722
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11723
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11724 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11725 * DataTables features four different built-in options for the buttons to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11726 * display for pagination control:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11727 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11728 * * `simple` - 'Previous' and 'Next' buttons only
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11729 * * 'simple_numbers` - 'Previous' and 'Next' buttons, plus page numbers
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11730 * * `full` - 'First', 'Previous', 'Next' and 'Last' buttons
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11731 * * `full_numbers` - 'First', 'Previous', 'Next' and 'Last' buttons, plus
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11732 * page numbers
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11733 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11734 * Further methods can be added using {@link DataTable.ext.oPagination}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11735 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11736 * @default simple_numbers
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11737 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11738 * @dtopt Options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11739 * @name DataTable.defaults.pagingType
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11740 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11741 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11742 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11743 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11744 * "pagingType": "full_numbers"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11745 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11746 * } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11747 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11748 "sPaginationType": "simple_numbers",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11749
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11750
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11751 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11752 * Enable horizontal scrolling. When a table is too wide to fit into a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11753 * certain layout, or you have a large number of columns in the table, you
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11754 * can enable x-scrolling to show the table in a viewport, which can be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11755 * scrolled. This property can be `true` which will allow the table to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11756 * scroll horizontally when needed, or any CSS unit, or a number (in which
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11757 * case it will be treated as a pixel measurement). Setting as simply `true`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11758 * is recommended.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11759 * @type boolean|string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11760 * @default <i>blank string - i.e. disabled</i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11761 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11762 * @dtopt Features
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11763 * @name DataTable.defaults.scrollX
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11764 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11765 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11766 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11767 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11768 * "scrollX": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11769 * "scrollCollapse": true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11770 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11771 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11772 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11773 "sScrollX": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11774
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11775
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11776 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11777 * This property can be used to force a DataTable to use more width than it
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11778 * might otherwise do when x-scrolling is enabled. For example if you have a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11779 * table which requires to be well spaced, this parameter is useful for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11780 * "over-sizing" the table, and thus forcing scrolling. This property can by
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11781 * any CSS unit, or a number (in which case it will be treated as a pixel
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11782 * measurement).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11783 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11784 * @default <i>blank string - i.e. disabled</i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11785 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11786 * @dtopt Options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11787 * @name DataTable.defaults.scrollXInner
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11788 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11789 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11790 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11791 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11792 * "scrollX": "100%",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11793 * "scrollXInner": "110%"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11794 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11795 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11796 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11797 "sScrollXInner": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11798
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11799
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11800 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11801 * Enable vertical scrolling. Vertical scrolling will constrain the DataTable
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11802 * to the given height, and enable scrolling for any data which overflows the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11803 * current viewport. This can be used as an alternative to paging to display
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11804 * a lot of data in a small area (although paging and scrolling can both be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11805 * enabled at the same time). This property can be any CSS unit, or a number
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11806 * (in which case it will be treated as a pixel measurement).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11807 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11808 * @default <i>blank string - i.e. disabled</i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11809 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11810 * @dtopt Features
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11811 * @name DataTable.defaults.scrollY
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11812 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11813 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11814 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11815 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11816 * "scrollY": "200px",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11817 * "paginate": false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11818 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11819 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11820 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11821 "sScrollY": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11822
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11823
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11824 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11825 * __Deprecated__ The functionality provided by this parameter has now been
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11826 * superseded by that provided through `ajax`, which should be used instead.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11827 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11828 * Set the HTTP method that is used to make the Ajax call for server-side
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11829 * processing or Ajax sourced data.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11830 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11831 * @default GET
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11832 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11833 * @dtopt Options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11834 * @dtopt Server-side
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11835 * @name DataTable.defaults.serverMethod
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11836 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11837 * @deprecated 1.10. Please use `ajax` for this functionality now.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11838 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11839 "sServerMethod": "GET",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11840
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11841
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11842 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11843 * DataTables makes use of renderers when displaying HTML elements for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11844 * a table. These renderers can be added or modified by plug-ins to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11845 * generate suitable mark-up for a site. For example the Bootstrap
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11846 * integration plug-in for DataTables uses a paging button renderer to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11847 * display pagination buttons in the mark-up required by Bootstrap.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11848 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11849 * For further information about the renderers available see
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11850 * DataTable.ext.renderer
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11851 * @type string|object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11852 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11853 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11854 * @name DataTable.defaults.renderer
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11855 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11856 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11857 "renderer": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11858
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11859
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11860 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11861 * Set the data property name that DataTables should use to get a row's id
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11862 * to set as the `id` property in the node.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11863 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11864 * @default DT_RowId
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11865 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11866 * @name DataTable.defaults.rowId
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11867 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11868 "rowId": "DT_RowId"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11869 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11870
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11871 _fnHungarianMap( DataTable.defaults );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11872
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11873
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11874
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11875 /*
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11876 * Developer note - See note in model.defaults.js about the use of Hungarian
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11877 * notation and camel case.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11878 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11879
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11880 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11881 * Column options that can be given to DataTables at initialisation time.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11882 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11883 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11884 DataTable.defaults.column = {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11885 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11886 * Define which column(s) an order will occur on for this column. This
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11887 * allows a column's ordering to take multiple columns into account when
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11888 * doing a sort or use the data from a different column. For example first
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11889 * name / last name columns make sense to do a multi-column sort over the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11890 * two columns.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11891 * @type array|int
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11892 * @default null <i>Takes the value of the column index automatically</i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11893 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11894 * @name DataTable.defaults.column.orderData
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11895 * @dtopt Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11896 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11897 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11898 * // Using `columnDefs`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11899 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11900 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11901 * "columnDefs": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11902 * { "orderData": [ 0, 1 ], "targets": [ 0 ] },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11903 * { "orderData": [ 1, 0 ], "targets": [ 1 ] },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11904 * { "orderData": 2, "targets": [ 2 ] }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11905 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11906 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11907 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11908 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11909 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11910 * // Using `columns`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11911 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11912 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11913 * "columns": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11914 * { "orderData": [ 0, 1 ] },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11915 * { "orderData": [ 1, 0 ] },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11916 * { "orderData": 2 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11917 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11918 * null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11919 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11920 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11921 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11922 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11923 "aDataSort": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11924 "iDataSort": -1,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11925
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11926
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11927 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11928 * You can control the default ordering direction, and even alter the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11929 * behaviour of the sort handler (i.e. only allow ascending ordering etc)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11930 * using this parameter.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11931 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11932 * @default [ 'asc', 'desc' ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11933 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11934 * @name DataTable.defaults.column.orderSequence
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11935 * @dtopt Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11936 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11937 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11938 * // Using `columnDefs`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11939 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11940 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11941 * "columnDefs": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11942 * { "orderSequence": [ "asc" ], "targets": [ 1 ] },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11943 * { "orderSequence": [ "desc", "asc", "asc" ], "targets": [ 2 ] },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11944 * { "orderSequence": [ "desc" ], "targets": [ 3 ] }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11945 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11946 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11947 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11948 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11949 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11950 * // Using `columns`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11951 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11952 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11953 * "columns": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11954 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11955 * { "orderSequence": [ "asc" ] },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11956 * { "orderSequence": [ "desc", "asc", "asc" ] },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11957 * { "orderSequence": [ "desc" ] },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11958 * null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11959 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11960 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11961 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11962 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11963 "asSorting": [ 'asc', 'desc' ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11964
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11965
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11966 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11967 * Enable or disable filtering on the data in this column.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11968 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11969 * @default true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11970 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11971 * @name DataTable.defaults.column.searchable
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11972 * @dtopt Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11973 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11974 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11975 * // Using `columnDefs`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11976 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11977 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11978 * "columnDefs": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11979 * { "searchable": false, "targets": [ 0 ] }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11980 * ] } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11981 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11982 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11983 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11984 * // Using `columns`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11985 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11986 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11987 * "columns": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11988 * { "searchable": false },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11989 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11990 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11991 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11992 * null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11993 * ] } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11994 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11995 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11996 "bSearchable": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11997
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11998
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
11999 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12000 * Enable or disable ordering on this column.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12001 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12002 * @default true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12003 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12004 * @name DataTable.defaults.column.orderable
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12005 * @dtopt Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12006 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12007 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12008 * // Using `columnDefs`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12009 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12010 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12011 * "columnDefs": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12012 * { "orderable": false, "targets": [ 0 ] }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12013 * ] } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12014 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12015 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12016 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12017 * // Using `columns`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12018 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12019 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12020 * "columns": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12021 * { "orderable": false },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12022 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12023 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12024 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12025 * null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12026 * ] } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12027 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12028 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12029 "bSortable": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12030
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12031
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12032 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12033 * Enable or disable the display of this column.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12034 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12035 * @default true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12036 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12037 * @name DataTable.defaults.column.visible
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12038 * @dtopt Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12039 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12040 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12041 * // Using `columnDefs`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12042 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12043 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12044 * "columnDefs": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12045 * { "visible": false, "targets": [ 0 ] }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12046 * ] } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12047 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12048 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12049 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12050 * // Using `columns`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12051 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12052 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12053 * "columns": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12054 * { "visible": false },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12055 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12056 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12057 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12058 * null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12059 * ] } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12060 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12061 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12062 "bVisible": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12063
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12064
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12065 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12066 * Developer definable function that is called whenever a cell is created (Ajax source,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12067 * etc) or processed for input (DOM source). This can be used as a compliment to mRender
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12068 * allowing you to modify the DOM element (add background colour for example) when the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12069 * element is available.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12070 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12071 * @param {element} td The TD node that has been created
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12072 * @param {*} cellData The Data for the cell
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12073 * @param {array|object} rowData The data for the whole row
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12074 * @param {int} row The row index for the aoData data store
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12075 * @param {int} col The column index for aoColumns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12076 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12077 * @name DataTable.defaults.column.createdCell
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12078 * @dtopt Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12079 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12080 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12081 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12082 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12083 * "columnDefs": [ {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12084 * "targets": [3],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12085 * "createdCell": function (td, cellData, rowData, row, col) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12086 * if ( cellData == "1.7" ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12087 * $(td).css('color', 'blue')
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12088 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12089 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12090 * } ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12091 * });
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12092 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12093 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12094 "fnCreatedCell": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12095
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12096
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12097 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12098 * This parameter has been replaced by `data` in DataTables to ensure naming
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12099 * consistency. `dataProp` can still be used, as there is backwards
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12100 * compatibility in DataTables for this option, but it is strongly
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12101 * recommended that you use `data` in preference to `dataProp`.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12102 * @name DataTable.defaults.column.dataProp
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12103 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12104
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12105
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12106 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12107 * This property can be used to read data from any data source property,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12108 * including deeply nested objects / properties. `data` can be given in a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12109 * number of different ways which effect its behaviour:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12110 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12111 * * `integer` - treated as an array index for the data source. This is the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12112 * default that DataTables uses (incrementally increased for each column).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12113 * * `string` - read an object property from the data source. There are
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12114 * three 'special' options that can be used in the string to alter how
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12115 * DataTables reads the data from the source object:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12116 * * `.` - Dotted Javascript notation. Just as you use a `.` in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12117 * Javascript to read from nested objects, so to can the options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12118 * specified in `data`. For example: `browser.version` or
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12119 * `browser.name`. If your object parameter name contains a period, use
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12120 * `\\` to escape it - i.e. `first\\.name`.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12121 * * `[]` - Array notation. DataTables can automatically combine data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12122 * from and array source, joining the data with the characters provided
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12123 * between the two brackets. For example: `name[, ]` would provide a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12124 * comma-space separated list from the source array. If no characters
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12125 * are provided between the brackets, the original array source is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12126 * returned.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12127 * * `()` - Function notation. Adding `()` to the end of a parameter will
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12128 * execute a function of the name given. For example: `browser()` for a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12129 * simple function on the data source, `browser.version()` for a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12130 * function in a nested property or even `browser().version` to get an
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12131 * object property if the function called returns an object. Note that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12132 * function notation is recommended for use in `render` rather than
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12133 * `data` as it is much simpler to use as a renderer.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12134 * * `null` - use the original data source for the row rather than plucking
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12135 * data directly from it. This action has effects on two other
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12136 * initialisation options:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12137 * * `defaultContent` - When null is given as the `data` option and
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12138 * `defaultContent` is specified for the column, the value defined by
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12139 * `defaultContent` will be used for the cell.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12140 * * `render` - When null is used for the `data` option and the `render`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12141 * option is specified for the column, the whole data source for the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12142 * row is used for the renderer.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12143 * * `function` - the function given will be executed whenever DataTables
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12144 * needs to set or get the data for a cell in the column. The function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12145 * takes three parameters:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12146 * * Parameters:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12147 * * `{array|object}` The data source for the row
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12148 * * `{string}` The type call data requested - this will be 'set' when
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12149 * setting data or 'filter', 'display', 'type', 'sort' or undefined
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12150 * when gathering data. Note that when `undefined` is given for the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12151 * type DataTables expects to get the raw data for the object back<
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12152 * * `{*}` Data to set when the second parameter is 'set'.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12153 * * Return:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12154 * * The return value from the function is not required when 'set' is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12155 * the type of call, but otherwise the return is what will be used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12156 * for the data requested.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12157 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12158 * Note that `data` is a getter and setter option. If you just require
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12159 * formatting of data for output, you will likely want to use `render` which
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12160 * is simply a getter and thus simpler to use.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12161 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12162 * Note that prior to DataTables 1.9.2 `data` was called `mDataProp`. The
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12163 * name change reflects the flexibility of this property and is consistent
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12164 * with the naming of mRender. If 'mDataProp' is given, then it will still
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12165 * be used by DataTables, as it automatically maps the old name to the new
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12166 * if required.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12167 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12168 * @type string|int|function|null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12169 * @default null <i>Use automatically calculated column index</i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12170 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12171 * @name DataTable.defaults.column.data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12172 * @dtopt Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12173 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12174 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12175 * // Read table data from objects
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12176 * // JSON structure for each row:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12177 * // {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12178 * // "engine": {value},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12179 * // "browser": {value},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12180 * // "platform": {value},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12181 * // "version": {value},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12182 * // "grade": {value}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12183 * // }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12184 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12185 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12186 * "ajaxSource": "sources/objects.txt",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12187 * "columns": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12188 * { "data": "engine" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12189 * { "data": "browser" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12190 * { "data": "platform" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12191 * { "data": "version" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12192 * { "data": "grade" }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12193 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12194 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12195 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12196 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12197 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12198 * // Read information from deeply nested objects
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12199 * // JSON structure for each row:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12200 * // {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12201 * // "engine": {value},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12202 * // "browser": {value},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12203 * // "platform": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12204 * // "inner": {value}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12205 * // },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12206 * // "details": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12207 * // {value}, {value}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12208 * // ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12209 * // }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12210 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12211 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12212 * "ajaxSource": "sources/deep.txt",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12213 * "columns": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12214 * { "data": "engine" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12215 * { "data": "browser" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12216 * { "data": "platform.inner" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12217 * { "data": "platform.details.0" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12218 * { "data": "platform.details.1" }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12219 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12220 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12221 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12222 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12223 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12224 * // Using `data` as a function to provide different information for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12225 * // sorting, filtering and display. In this case, currency (price)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12226 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12227 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12228 * "columnDefs": [ {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12229 * "targets": [ 0 ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12230 * "data": function ( source, type, val ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12231 * if (type === 'set') {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12232 * source.price = val;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12233 * // Store the computed dislay and filter values for efficiency
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12234 * source.price_display = val=="" ? "" : "$"+numberFormat(val);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12235 * source.price_filter = val=="" ? "" : "$"+numberFormat(val)+" "+val;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12236 * return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12237 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12238 * else if (type === 'display') {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12239 * return source.price_display;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12240 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12241 * else if (type === 'filter') {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12242 * return source.price_filter;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12243 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12244 * // 'sort', 'type' and undefined all just use the integer
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12245 * return source.price;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12246 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12247 * } ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12248 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12249 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12250 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12251 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12252 * // Using default content
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12253 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12254 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12255 * "columnDefs": [ {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12256 * "targets": [ 0 ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12257 * "data": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12258 * "defaultContent": "Click to edit"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12259 * } ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12260 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12261 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12262 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12263 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12264 * // Using array notation - outputting a list from an array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12265 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12266 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12267 * "columnDefs": [ {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12268 * "targets": [ 0 ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12269 * "data": "name[, ]"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12270 * } ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12271 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12272 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12273 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12274 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12275 "mData": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12276
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12277
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12278 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12279 * This property is the rendering partner to `data` and it is suggested that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12280 * when you want to manipulate data for display (including filtering,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12281 * sorting etc) without altering the underlying data for the table, use this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12282 * property. `render` can be considered to be the the read only companion to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12283 * `data` which is read / write (then as such more complex). Like `data`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12284 * this option can be given in a number of different ways to effect its
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12285 * behaviour:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12286 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12287 * * `integer` - treated as an array index for the data source. This is the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12288 * default that DataTables uses (incrementally increased for each column).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12289 * * `string` - read an object property from the data source. There are
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12290 * three 'special' options that can be used in the string to alter how
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12291 * DataTables reads the data from the source object:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12292 * * `.` - Dotted Javascript notation. Just as you use a `.` in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12293 * Javascript to read from nested objects, so to can the options
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12294 * specified in `data`. For example: `browser.version` or
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12295 * `browser.name`. If your object parameter name contains a period, use
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12296 * `\\` to escape it - i.e. `first\\.name`.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12297 * * `[]` - Array notation. DataTables can automatically combine data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12298 * from and array source, joining the data with the characters provided
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12299 * between the two brackets. For example: `name[, ]` would provide a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12300 * comma-space separated list from the source array. If no characters
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12301 * are provided between the brackets, the original array source is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12302 * returned.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12303 * * `()` - Function notation. Adding `()` to the end of a parameter will
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12304 * execute a function of the name given. For example: `browser()` for a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12305 * simple function on the data source, `browser.version()` for a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12306 * function in a nested property or even `browser().version` to get an
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12307 * object property if the function called returns an object.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12308 * * `object` - use different data for the different data types requested by
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12309 * DataTables ('filter', 'display', 'type' or 'sort'). The property names
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12310 * of the object is the data type the property refers to and the value can
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12311 * defined using an integer, string or function using the same rules as
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12312 * `render` normally does. Note that an `_` option _must_ be specified.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12313 * This is the default value to use if you haven't specified a value for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12314 * the data type requested by DataTables.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12315 * * `function` - the function given will be executed whenever DataTables
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12316 * needs to set or get the data for a cell in the column. The function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12317 * takes three parameters:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12318 * * Parameters:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12319 * * {array|object} The data source for the row (based on `data`)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12320 * * {string} The type call data requested - this will be 'filter',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12321 * 'display', 'type' or 'sort'.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12322 * * {array|object} The full data source for the row (not based on
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12323 * `data`)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12324 * * Return:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12325 * * The return value from the function is what will be used for the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12326 * data requested.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12327 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12328 * @type string|int|function|object|null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12329 * @default null Use the data source value.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12330 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12331 * @name DataTable.defaults.column.render
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12332 * @dtopt Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12333 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12334 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12335 * // Create a comma separated list from an array of objects
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12336 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12337 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12338 * "ajaxSource": "sources/deep.txt",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12339 * "columns": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12340 * { "data": "engine" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12341 * { "data": "browser" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12342 * {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12343 * "data": "platform",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12344 * "render": "[, ].name"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12345 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12346 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12347 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12348 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12349 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12350 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12351 * // Execute a function to obtain data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12352 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12353 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12354 * "columnDefs": [ {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12355 * "targets": [ 0 ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12356 * "data": null, // Use the full data source object for the renderer's source
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12357 * "render": "browserName()"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12358 * } ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12359 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12360 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12361 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12362 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12363 * // As an object, extracting different data for the different types
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12364 * // This would be used with a data source such as:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12365 * // { "phone": 5552368, "phone_filter": "5552368 555-2368", "phone_display": "555-2368" }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12366 * // Here the `phone` integer is used for sorting and type detection, while `phone_filter`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12367 * // (which has both forms) is used for filtering for if a user inputs either format, while
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12368 * // the formatted phone number is the one that is shown in the table.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12369 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12370 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12371 * "columnDefs": [ {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12372 * "targets": [ 0 ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12373 * "data": null, // Use the full data source object for the renderer's source
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12374 * "render": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12375 * "_": "phone",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12376 * "filter": "phone_filter",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12377 * "display": "phone_display"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12378 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12379 * } ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12380 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12381 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12382 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12383 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12384 * // Use as a function to create a link from the data source
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12385 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12386 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12387 * "columnDefs": [ {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12388 * "targets": [ 0 ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12389 * "data": "download_link",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12390 * "render": function ( data, type, full ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12391 * return '<a href="'+data+'">Download</a>';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12392 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12393 * } ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12394 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12395 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12396 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12397 "mRender": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12398
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12399
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12400 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12401 * Change the cell type created for the column - either TD cells or TH cells. This
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12402 * can be useful as TH cells have semantic meaning in the table body, allowing them
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12403 * to act as a header for a row (you may wish to add scope='row' to the TH elements).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12404 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12405 * @default td
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12406 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12407 * @name DataTable.defaults.column.cellType
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12408 * @dtopt Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12409 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12410 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12411 * // Make the first column use TH cells
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12412 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12413 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12414 * "columnDefs": [ {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12415 * "targets": [ 0 ],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12416 * "cellType": "th"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12417 * } ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12418 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12419 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12420 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12421 "sCellType": "td",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12422
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12423
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12424 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12425 * Class to give to each cell in this column.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12426 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12427 * @default <i>Empty string</i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12428 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12429 * @name DataTable.defaults.column.class
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12430 * @dtopt Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12431 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12432 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12433 * // Using `columnDefs`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12434 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12435 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12436 * "columnDefs": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12437 * { "class": "my_class", "targets": [ 0 ] }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12438 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12439 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12440 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12441 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12442 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12443 * // Using `columns`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12444 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12445 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12446 * "columns": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12447 * { "class": "my_class" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12448 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12449 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12450 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12451 * null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12452 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12453 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12454 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12455 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12456 "sClass": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12457
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12458 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12459 * When DataTables calculates the column widths to assign to each column,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12460 * it finds the longest string in each column and then constructs a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12461 * temporary table and reads the widths from that. The problem with this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12462 * is that "mmm" is much wider then "iiii", but the latter is a longer
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12463 * string - thus the calculation can go wrong (doing it properly and putting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12464 * it into an DOM object and measuring that is horribly(!) slow). Thus as
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12465 * a "work around" we provide this option. It will append its value to the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12466 * text that is found to be the longest string for the column - i.e. padding.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12467 * Generally you shouldn't need this!
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12468 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12469 * @default <i>Empty string<i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12470 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12471 * @name DataTable.defaults.column.contentPadding
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12472 * @dtopt Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12473 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12474 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12475 * // Using `columns`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12476 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12477 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12478 * "columns": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12479 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12480 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12481 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12482 * {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12483 * "contentPadding": "mmm"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12484 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12485 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12486 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12487 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12488 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12489 "sContentPadding": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12490
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12491
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12492 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12493 * Allows a default value to be given for a column's data, and will be used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12494 * whenever a null data source is encountered (this can be because `data`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12495 * is set to null, or because the data source itself is null).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12496 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12497 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12498 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12499 * @name DataTable.defaults.column.defaultContent
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12500 * @dtopt Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12501 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12502 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12503 * // Using `columnDefs`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12504 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12505 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12506 * "columnDefs": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12507 * {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12508 * "data": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12509 * "defaultContent": "Edit",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12510 * "targets": [ -1 ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12511 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12512 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12513 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12514 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12515 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12516 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12517 * // Using `columns`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12518 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12519 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12520 * "columns": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12521 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12522 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12523 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12524 * {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12525 * "data": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12526 * "defaultContent": "Edit"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12527 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12528 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12529 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12530 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12531 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12532 "sDefaultContent": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12533
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12534
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12535 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12536 * This parameter is only used in DataTables' server-side processing. It can
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12537 * be exceptionally useful to know what columns are being displayed on the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12538 * client side, and to map these to database fields. When defined, the names
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12539 * also allow DataTables to reorder information from the server if it comes
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12540 * back in an unexpected order (i.e. if you switch your columns around on the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12541 * client-side, your server-side code does not also need updating).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12542 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12543 * @default <i>Empty string</i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12544 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12545 * @name DataTable.defaults.column.name
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12546 * @dtopt Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12547 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12548 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12549 * // Using `columnDefs`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12550 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12551 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12552 * "columnDefs": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12553 * { "name": "engine", "targets": [ 0 ] },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12554 * { "name": "browser", "targets": [ 1 ] },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12555 * { "name": "platform", "targets": [ 2 ] },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12556 * { "name": "version", "targets": [ 3 ] },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12557 * { "name": "grade", "targets": [ 4 ] }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12558 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12559 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12560 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12561 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12562 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12563 * // Using `columns`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12564 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12565 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12566 * "columns": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12567 * { "name": "engine" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12568 * { "name": "browser" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12569 * { "name": "platform" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12570 * { "name": "version" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12571 * { "name": "grade" }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12572 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12573 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12574 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12575 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12576 "sName": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12577
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12578
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12579 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12580 * Defines a data source type for the ordering which can be used to read
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12581 * real-time information from the table (updating the internally cached
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12582 * version) prior to ordering. This allows ordering to occur on user
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12583 * editable elements such as form inputs.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12584 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12585 * @default std
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12586 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12587 * @name DataTable.defaults.column.orderDataType
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12588 * @dtopt Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12589 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12590 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12591 * // Using `columnDefs`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12592 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12593 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12594 * "columnDefs": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12595 * { "orderDataType": "dom-text", "targets": [ 2, 3 ] },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12596 * { "type": "numeric", "targets": [ 3 ] },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12597 * { "orderDataType": "dom-select", "targets": [ 4 ] },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12598 * { "orderDataType": "dom-checkbox", "targets": [ 5 ] }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12599 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12600 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12601 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12602 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12603 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12604 * // Using `columns`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12605 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12606 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12607 * "columns": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12608 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12609 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12610 * { "orderDataType": "dom-text" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12611 * { "orderDataType": "dom-text", "type": "numeric" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12612 * { "orderDataType": "dom-select" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12613 * { "orderDataType": "dom-checkbox" }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12614 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12615 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12616 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12617 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12618 "sSortDataType": "std",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12619
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12620
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12621 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12622 * The title of this column.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12623 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12624 * @default null <i>Derived from the 'TH' value for this column in the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12625 * original HTML table.</i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12626 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12627 * @name DataTable.defaults.column.title
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12628 * @dtopt Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12629 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12630 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12631 * // Using `columnDefs`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12632 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12633 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12634 * "columnDefs": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12635 * { "title": "My column title", "targets": [ 0 ] }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12636 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12637 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12638 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12639 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12640 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12641 * // Using `columns`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12642 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12643 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12644 * "columns": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12645 * { "title": "My column title" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12646 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12647 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12648 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12649 * null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12650 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12651 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12652 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12653 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12654 "sTitle": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12655
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12656
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12657 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12658 * The type allows you to specify how the data for this column will be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12659 * ordered. Four types (string, numeric, date and html (which will strip
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12660 * HTML tags before ordering)) are currently available. Note that only date
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12661 * formats understood by Javascript's Date() object will be accepted as type
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12662 * date. For example: "Mar 26, 2008 5:03 PM". May take the values: 'string',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12663 * 'numeric', 'date' or 'html' (by default). Further types can be adding
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12664 * through plug-ins.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12665 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12666 * @default null <i>Auto-detected from raw data</i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12667 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12668 * @name DataTable.defaults.column.type
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12669 * @dtopt Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12670 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12671 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12672 * // Using `columnDefs`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12673 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12674 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12675 * "columnDefs": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12676 * { "type": "html", "targets": [ 0 ] }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12677 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12678 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12679 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12680 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12681 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12682 * // Using `columns`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12683 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12684 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12685 * "columns": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12686 * { "type": "html" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12687 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12688 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12689 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12690 * null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12691 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12692 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12693 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12694 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12695 "sType": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12696
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12697
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12698 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12699 * Defining the width of the column, this parameter may take any CSS value
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12700 * (3em, 20px etc). DataTables applies 'smart' widths to columns which have not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12701 * been given a specific width through this interface ensuring that the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12702 * remains readable.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12703 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12704 * @default null <i>Automatic</i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12705 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12706 * @name DataTable.defaults.column.width
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12707 * @dtopt Columns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12708 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12709 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12710 * // Using `columnDefs`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12711 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12712 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12713 * "columnDefs": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12714 * { "width": "20%", "targets": [ 0 ] }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12715 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12716 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12717 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12718 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12719 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12720 * // Using `columns`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12721 * $(document).ready( function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12722 * $('#example').dataTable( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12723 * "columns": [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12724 * { "width": "20%" },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12725 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12726 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12727 * null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12728 * null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12729 * ]
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12730 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12731 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12732 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12733 "sWidth": null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12734 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12735
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12736 _fnHungarianMap( DataTable.defaults.column );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12737
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12738
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12739
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12740 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12741 * DataTables settings object - this holds all the information needed for a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12742 * given table, including configuration, data and current application of the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12743 * table options. DataTables does not have a single instance for each DataTable
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12744 * with the settings attached to that instance, but rather instances of the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12745 * DataTable "class" are created on-the-fly as needed (typically by a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12746 * $().dataTable() call) and the settings object is then applied to that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12747 * instance.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12748 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12749 * Note that this object is related to {@link DataTable.defaults} but this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12750 * one is the internal data store for DataTables's cache of columns. It should
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12751 * NOT be manipulated outside of DataTables. Any configuration should be done
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12752 * through the initialisation options.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12753 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12754 * @todo Really should attach the settings object to individual instances so we
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12755 * don't need to create new instances on each $().dataTable() call (if the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12756 * table already exists). It would also save passing oSettings around and
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12757 * into every single function. However, this is a very significant
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12758 * architecture change for DataTables and will almost certainly break
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12759 * backwards compatibility with older installations. This is something that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12760 * will be done in 2.0.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12761 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12762 DataTable.models.oSettings = {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12763 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12764 * Primary features of DataTables and their enablement state.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12765 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12766 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12767 "oFeatures": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12768
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12769 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12770 * Flag to say if DataTables should automatically try to calculate the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12771 * optimum table and columns widths (true) or not (false).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12772 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12773 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12774 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12775 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12776 "bAutoWidth": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12777
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12778 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12779 * Delay the creation of TR and TD elements until they are actually
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12780 * needed by a driven page draw. This can give a significant speed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12781 * increase for Ajax source and Javascript source data, but makes no
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12782 * difference at all fro DOM and server-side processing tables.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12783 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12784 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12785 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12786 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12787 "bDeferRender": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12788
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12789 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12790 * Enable filtering on the table or not. Note that if this is disabled
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12791 * then there is no filtering at all on the table, including fnFilter.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12792 * To just remove the filtering input use sDom and remove the 'f' option.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12793 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12794 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12795 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12796 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12797 "bFilter": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12798
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12799 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12800 * Table information element (the 'Showing x of y records' div) enable
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12801 * flag.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12802 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12803 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12804 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12805 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12806 "bInfo": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12807
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12808 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12809 * Present a user control allowing the end user to change the page size
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12810 * when pagination is enabled.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12811 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12812 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12813 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12814 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12815 "bLengthChange": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12816
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12817 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12818 * Pagination enabled or not. Note that if this is disabled then length
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12819 * changing must also be disabled.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12820 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12821 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12822 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12823 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12824 "bPaginate": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12825
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12826 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12827 * Processing indicator enable flag whenever DataTables is enacting a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12828 * user request - typically an Ajax request for server-side processing.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12829 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12830 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12831 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12832 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12833 "bProcessing": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12834
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12835 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12836 * Server-side processing enabled flag - when enabled DataTables will
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12837 * get all data from the server for every draw - there is no filtering,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12838 * sorting or paging done on the client-side.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12839 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12840 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12841 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12842 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12843 "bServerSide": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12844
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12845 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12846 * Sorting enablement flag.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12847 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12848 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12849 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12850 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12851 "bSort": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12852
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12853 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12854 * Multi-column sorting
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12855 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12856 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12857 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12858 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12859 "bSortMulti": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12860
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12861 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12862 * Apply a class to the columns which are being sorted to provide a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12863 * visual highlight or not. This can slow things down when enabled since
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12864 * there is a lot of DOM interaction.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12865 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12866 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12867 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12868 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12869 "bSortClasses": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12870
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12871 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12872 * State saving enablement flag.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12873 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12874 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12875 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12876 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12877 "bStateSave": null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12878 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12879
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12880
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12881 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12882 * Scrolling settings for a table.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12883 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12884 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12885 "oScroll": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12886 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12887 * When the table is shorter in height than sScrollY, collapse the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12888 * table container down to the height of the table (when true).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12889 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12890 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12891 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12892 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12893 "bCollapse": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12894
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12895 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12896 * Width of the scrollbar for the web-browser's platform. Calculated
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12897 * during table initialisation.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12898 * @type int
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12899 * @default 0
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12900 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12901 "iBarWidth": 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12902
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12903 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12904 * Viewport width for horizontal scrolling. Horizontal scrolling is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12905 * disabled if an empty string.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12906 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12907 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12908 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12909 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12910 "sX": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12911
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12912 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12913 * Width to expand the table to when using x-scrolling. Typically you
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12914 * should not need to use this.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12915 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12916 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12917 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12918 * @deprecated
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12919 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12920 "sXInner": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12921
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12922 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12923 * Viewport height for vertical scrolling. Vertical scrolling is disabled
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12924 * if an empty string.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12925 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12926 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12927 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12928 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12929 "sY": null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12930 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12931
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12932 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12933 * Language information for the table.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12934 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12935 * @extends DataTable.defaults.oLanguage
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12936 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12937 "oLanguage": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12938 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12939 * Information callback function. See
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12940 * {@link DataTable.defaults.fnInfoCallback}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12941 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12942 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12943 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12944 "fnInfoCallback": null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12945 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12946
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12947 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12948 * Browser support parameters
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12949 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12950 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12951 "oBrowser": {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12952 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12953 * Indicate if the browser incorrectly calculates width:100% inside a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12954 * scrolling element (IE6/7)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12955 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12956 * @default false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12957 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12958 "bScrollOversize": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12959
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12960 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12961 * Determine if the vertical scrollbar is on the right or left of the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12962 * scrolling container - needed for rtl language layout, although not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12963 * all browsers move the scrollbar (Safari).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12964 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12965 * @default false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12966 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12967 "bScrollbarLeft": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12968
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12969 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12970 * Flag for if `getBoundingClientRect` is fully supported or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12971 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12972 * @default false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12973 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12974 "bBounding": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12975
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12976 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12977 * Browser scrollbar width
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12978 * @type integer
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12979 * @default 0
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12980 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12981 "barWidth": 0
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12982 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12983
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12984
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12985 "ajax": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12986
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12987
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12988 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12989 * Array referencing the nodes which are used for the features. The
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12990 * parameters of this object match what is allowed by sDom - i.e.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12991 * <ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12992 * <li>'l' - Length changing</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12993 * <li>'f' - Filtering input</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12994 * <li>'t' - The table!</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12995 * <li>'i' - Information</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12996 * <li>'p' - Pagination</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12997 * <li>'r' - pRocessing</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12998 * </ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
12999 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13000 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13001 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13002 "aanFeatures": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13003
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13004 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13005 * Store data information - see {@link DataTable.models.oRow} for detailed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13006 * information.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13007 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13008 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13009 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13010 "aoData": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13011
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13012 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13013 * Array of indexes which are in the current display (after filtering etc)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13014 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13015 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13016 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13017 "aiDisplay": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13018
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13019 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13020 * Array of indexes for display - no filtering
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13021 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13022 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13023 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13024 "aiDisplayMaster": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13025
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13026 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13027 * Map of row ids to data indexes
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13028 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13029 * @default {}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13030 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13031 "aIds": {},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13032
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13033 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13034 * Store information about each column that is in use
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13035 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13036 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13037 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13038 "aoColumns": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13039
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13040 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13041 * Store information about the table's header
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13042 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13043 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13044 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13045 "aoHeader": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13046
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13047 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13048 * Store information about the table's footer
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13049 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13050 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13051 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13052 "aoFooter": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13053
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13054 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13055 * Store the applied global search information in case we want to force a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13056 * research or compare the old search to a new one.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13057 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13058 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13059 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13060 * @extends DataTable.models.oSearch
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13061 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13062 "oPreviousSearch": {},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13063
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13064 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13065 * Store the applied search for each column - see
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13066 * {@link DataTable.models.oSearch} for the format that is used for the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13067 * filtering information for each column.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13068 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13069 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13070 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13071 "aoPreSearchCols": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13072
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13073 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13074 * Sorting that is applied to the table. Note that the inner arrays are
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13075 * used in the following manner:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13076 * <ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13077 * <li>Index 0 - column number</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13078 * <li>Index 1 - current sorting direction</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13079 * </ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13080 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13081 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13082 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13083 * @todo These inner arrays should really be objects
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13084 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13085 "aaSorting": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13086
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13087 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13088 * Sorting that is always applied to the table (i.e. prefixed in front of
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13089 * aaSorting).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13090 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13091 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13092 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13093 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13094 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13095 "aaSortingFixed": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13096
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13097 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13098 * Classes to use for the striping of a table.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13099 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13100 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13101 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13102 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13103 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13104 "asStripeClasses": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13105
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13106 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13107 * If restoring a table - we should restore its striping classes as well
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13108 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13109 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13110 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13111 "asDestroyStripes": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13112
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13113 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13114 * If restoring a table - we should restore its width
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13115 * @type int
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13116 * @default 0
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13117 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13118 "sDestroyWidth": 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13119
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13120 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13121 * Callback functions array for every time a row is inserted (i.e. on a draw).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13122 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13123 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13124 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13125 "aoRowCallback": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13126
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13127 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13128 * Callback functions for the header on each draw.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13129 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13130 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13131 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13132 "aoHeaderCallback": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13133
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13134 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13135 * Callback function for the footer on each draw.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13136 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13137 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13138 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13139 "aoFooterCallback": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13140
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13141 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13142 * Array of callback functions for draw callback functions
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13143 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13144 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13145 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13146 "aoDrawCallback": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13147
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13148 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13149 * Array of callback functions for row created function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13150 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13151 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13152 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13153 "aoRowCreatedCallback": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13154
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13155 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13156 * Callback functions for just before the table is redrawn. A return of
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13157 * false will be used to cancel the draw.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13158 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13159 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13160 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13161 "aoPreDrawCallback": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13162
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13163 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13164 * Callback functions for when the table has been initialised.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13165 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13166 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13167 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13168 "aoInitComplete": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13169
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13170
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13171 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13172 * Callbacks for modifying the settings to be stored for state saving, prior to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13173 * saving state.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13174 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13175 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13176 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13177 "aoStateSaveParams": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13178
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13179 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13180 * Callbacks for modifying the settings that have been stored for state saving
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13181 * prior to using the stored values to restore the state.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13182 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13183 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13184 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13185 "aoStateLoadParams": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13186
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13187 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13188 * Callbacks for operating on the settings object once the saved state has been
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13189 * loaded
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13190 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13191 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13192 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13193 "aoStateLoaded": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13194
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13195 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13196 * Cache the table ID for quick access
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13197 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13198 * @default <i>Empty string</i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13199 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13200 "sTableId": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13201
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13202 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13203 * The TABLE node for the main table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13204 * @type node
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13205 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13206 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13207 "nTable": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13208
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13209 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13210 * Permanent ref to the thead element
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13211 * @type node
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13212 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13213 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13214 "nTHead": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13215
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13216 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13217 * Permanent ref to the tfoot element - if it exists
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13218 * @type node
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13219 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13220 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13221 "nTFoot": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13222
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13223 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13224 * Permanent ref to the tbody element
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13225 * @type node
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13226 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13227 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13228 "nTBody": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13229
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13230 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13231 * Cache the wrapper node (contains all DataTables controlled elements)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13232 * @type node
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13233 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13234 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13235 "nTableWrapper": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13236
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13237 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13238 * Indicate if when using server-side processing the loading of data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13239 * should be deferred until the second draw.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13240 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13241 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13242 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13243 * @default false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13244 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13245 "bDeferLoading": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13246
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13247 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13248 * Indicate if all required information has been read in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13249 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13250 * @default false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13251 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13252 "bInitialised": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13253
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13254 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13255 * Information about open rows. Each object in the array has the parameters
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13256 * 'nTr' and 'nParent'
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13257 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13258 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13259 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13260 "aoOpenRows": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13261
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13262 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13263 * Dictate the positioning of DataTables' control elements - see
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13264 * {@link DataTable.model.oInit.sDom}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13265 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13266 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13267 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13268 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13269 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13270 "sDom": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13271
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13272 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13273 * Search delay (in mS)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13274 * @type integer
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13275 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13276 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13277 "searchDelay": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13278
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13279 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13280 * Which type of pagination should be used.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13281 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13282 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13283 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13284 * @default two_button
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13285 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13286 "sPaginationType": "two_button",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13287
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13288 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13289 * The state duration (for `stateSave`) in seconds.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13290 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13291 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13292 * @type int
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13293 * @default 0
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13294 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13295 "iStateDuration": 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13296
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13297 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13298 * Array of callback functions for state saving. Each array element is an
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13299 * object with the following parameters:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13300 * <ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13301 * <li>function:fn - function to call. Takes two parameters, oSettings
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13302 * and the JSON string to save that has been thus far created. Returns
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13303 * a JSON string to be inserted into a json object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13304 * (i.e. '"param": [ 0, 1, 2]')</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13305 * <li>string:sName - name of callback</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13306 * </ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13307 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13308 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13309 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13310 "aoStateSave": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13311
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13312 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13313 * Array of callback functions for state loading. Each array element is an
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13314 * object with the following parameters:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13315 * <ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13316 * <li>function:fn - function to call. Takes two parameters, oSettings
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13317 * and the object stored. May return false to cancel state loading</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13318 * <li>string:sName - name of callback</li>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13319 * </ul>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13320 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13321 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13322 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13323 "aoStateLoad": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13324
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13325 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13326 * State that was saved. Useful for back reference
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13327 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13328 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13329 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13330 "oSavedState": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13331
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13332 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13333 * State that was loaded. Useful for back reference
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13334 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13335 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13336 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13337 "oLoadedState": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13338
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13339 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13340 * Source url for AJAX data for the table.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13341 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13342 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13343 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13344 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13345 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13346 "sAjaxSource": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13347
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13348 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13349 * Property from a given object from which to read the table data from. This
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13350 * can be an empty string (when not server-side processing), in which case
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13351 * it is assumed an an array is given directly.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13352 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13353 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13354 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13355 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13356 "sAjaxDataProp": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13357
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13358 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13359 * Note if draw should be blocked while getting data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13360 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13361 * @default true
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13362 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13363 "bAjaxDataGet": true,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13364
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13365 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13366 * The last jQuery XHR object that was used for server-side data gathering.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13367 * This can be used for working with the XHR information in one of the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13368 * callbacks
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13369 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13370 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13371 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13372 "jqXHR": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13373
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13374 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13375 * JSON returned from the server in the last Ajax request
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13376 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13377 * @default undefined
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13378 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13379 "json": undefined,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13380
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13381 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13382 * Data submitted as part of the last Ajax request
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13383 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13384 * @default undefined
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13385 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13386 "oAjaxData": undefined,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13387
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13388 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13389 * Function to get the server-side data.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13390 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13391 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13392 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13393 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13394 "fnServerData": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13395
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13396 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13397 * Functions which are called prior to sending an Ajax request so extra
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13398 * parameters can easily be sent to the server
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13399 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13400 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13401 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13402 "aoServerParams": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13403
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13404 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13405 * Send the XHR HTTP method - GET or POST (could be PUT or DELETE if
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13406 * required).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13407 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13408 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13409 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13410 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13411 "sServerMethod": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13412
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13413 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13414 * Format numbers for display.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13415 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13416 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13417 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13418 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13419 "fnFormatNumber": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13420
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13421 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13422 * List of options that can be used for the user selectable length menu.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13423 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13424 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13425 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13426 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13427 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13428 "aLengthMenu": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13429
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13430 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13431 * Counter for the draws that the table does. Also used as a tracker for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13432 * server-side processing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13433 * @type int
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13434 * @default 0
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13435 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13436 "iDraw": 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13437
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13438 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13439 * Indicate if a redraw is being done - useful for Ajax
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13440 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13441 * @default false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13442 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13443 "bDrawing": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13444
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13445 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13446 * Draw index (iDraw) of the last error when parsing the returned data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13447 * @type int
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13448 * @default -1
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13449 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13450 "iDrawError": -1,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13451
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13452 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13453 * Paging display length
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13454 * @type int
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13455 * @default 10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13456 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13457 "_iDisplayLength": 10,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13458
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13459 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13460 * Paging start point - aiDisplay index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13461 * @type int
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13462 * @default 0
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13463 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13464 "_iDisplayStart": 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13465
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13466 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13467 * Server-side processing - number of records in the result set
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13468 * (i.e. before filtering), Use fnRecordsTotal rather than
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13469 * this property to get the value of the number of records, regardless of
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13470 * the server-side processing setting.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13471 * @type int
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13472 * @default 0
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13473 * @private
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13474 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13475 "_iRecordsTotal": 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13476
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13477 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13478 * Server-side processing - number of records in the current display set
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13479 * (i.e. after filtering). Use fnRecordsDisplay rather than
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13480 * this property to get the value of the number of records, regardless of
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13481 * the server-side processing setting.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13482 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13483 * @default 0
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13484 * @private
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13485 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13486 "_iRecordsDisplay": 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13487
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13488 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13489 * Flag to indicate if jQuery UI marking and classes should be used.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13490 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13491 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13492 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13493 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13494 "bJUI": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13495
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13496 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13497 * The classes to use for the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13498 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13499 * @default {}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13500 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13501 "oClasses": {},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13502
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13503 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13504 * Flag attached to the settings object so you can check in the draw
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13505 * callback if filtering has been done in the draw. Deprecated in favour of
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13506 * events.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13507 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13508 * @default false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13509 * @deprecated
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13510 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13511 "bFiltered": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13512
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13513 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13514 * Flag attached to the settings object so you can check in the draw
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13515 * callback if sorting has been done in the draw. Deprecated in favour of
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13516 * events.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13517 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13518 * @default false
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13519 * @deprecated
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13520 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13521 "bSorted": false,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13522
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13523 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13524 * Indicate that if multiple rows are in the header and there is more than
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13525 * one unique cell per column, if the top one (true) or bottom one (false)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13526 * should be used for sorting / title by DataTables.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13527 * Note that this parameter will be set by the initialisation routine. To
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13528 * set a default use {@link DataTable.defaults}.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13529 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13530 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13531 "bSortCellsTop": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13532
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13533 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13534 * Initialisation object that is used for the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13535 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13536 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13537 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13538 "oInit": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13539
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13540 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13541 * Destroy callback functions - for plug-ins to attach themselves to the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13542 * destroy so they can clean up markup and events.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13543 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13544 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13545 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13546 "aoDestroyCallback": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13547
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13548
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13549 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13550 * Get the number of records in the current record set, before filtering
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13551 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13552 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13553 "fnRecordsTotal": function ()
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13554 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13555 return _fnDataSource( this ) == 'ssp' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13556 this._iRecordsTotal * 1 :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13557 this.aiDisplayMaster.length;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13558 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13559
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13560 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13561 * Get the number of records in the current record set, after filtering
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13562 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13563 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13564 "fnRecordsDisplay": function ()
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13565 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13566 return _fnDataSource( this ) == 'ssp' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13567 this._iRecordsDisplay * 1 :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13568 this.aiDisplay.length;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13569 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13570
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13571 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13572 * Get the display end point - aiDisplay index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13573 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13574 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13575 "fnDisplayEnd": function ()
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13576 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13577 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13578 len = this._iDisplayLength,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13579 start = this._iDisplayStart,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13580 calc = start + len,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13581 records = this.aiDisplay.length,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13582 features = this.oFeatures,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13583 paginate = features.bPaginate;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13584
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13585 if ( features.bServerSide ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13586 return paginate === false || len === -1 ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13587 start + records :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13588 Math.min( start+len, this._iRecordsDisplay );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13589 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13590 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13591 return ! paginate || calc>records || len===-1 ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13592 records :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13593 calc;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13594 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13595 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13596
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13597 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13598 * The DataTables object for this table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13599 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13600 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13601 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13602 "oInstance": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13603
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13604 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13605 * Unique identifier for each instance of the DataTables object. If there
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13606 * is an ID on the table node, then it takes that value, otherwise an
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13607 * incrementing internal counter is used.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13608 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13609 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13610 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13611 "sInstance": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13612
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13613 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13614 * tabindex attribute value that is added to DataTables control elements, allowing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13615 * keyboard navigation of the table and its controls.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13616 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13617 "iTabIndex": 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13618
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13619 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13620 * DIV container for the footer scrolling table if scrolling
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13621 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13622 "nScrollHead": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13623
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13624 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13625 * DIV container for the footer scrolling table if scrolling
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13626 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13627 "nScrollFoot": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13628
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13629 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13630 * Last applied sort
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13631 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13632 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13633 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13634 "aLastSort": [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13635
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13636 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13637 * Stored plug-in instances
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13638 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13639 * @default {}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13640 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13641 "oPlugins": {},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13642
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13643 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13644 * Function used to get a row's id from the row's data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13645 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13646 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13647 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13648 "rowIdFn": null,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13649
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13650 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13651 * Data location where to store a row's id
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13652 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13653 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13654 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13655 "rowId": null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13656 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13657
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13658 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13659 * Extension object for DataTables that is used to provide all extension
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13660 * options.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13661 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13662 * Note that the `DataTable.ext` object is available through
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13663 * `jQuery.fn.dataTable.ext` where it may be accessed and manipulated. It is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13664 * also aliased to `jQuery.fn.dataTableExt` for historic reasons.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13665 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13666 * @extends DataTable.models.ext
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13667 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13668
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13669
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13670 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13671 * DataTables extensions
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13672 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13673 * This namespace acts as a collection area for plug-ins that can be used to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13674 * extend DataTables capabilities. Indeed many of the build in methods
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13675 * use this method to provide their own capabilities (sorting methods for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13676 * example).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13677 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13678 * Note that this namespace is aliased to `jQuery.fn.dataTableExt` for legacy
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13679 * reasons
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13680 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13681 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13682 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13683 DataTable.ext = _ext = {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13684 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13685 * Buttons. For use with the Buttons extension for DataTables. This is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13686 * defined here so other extensions can define buttons regardless of load
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13687 * order. It is _not_ used by DataTables core.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13688 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13689 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13690 * @default {}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13691 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13692 buttons: {},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13693
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13694
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13695 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13696 * Element class names
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13697 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13698 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13699 * @default {}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13700 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13701 classes: {},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13702
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13703
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13704 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13705 * Error reporting.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13706 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13707 * How should DataTables report an error. Can take the value 'alert',
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13708 * 'throw', 'none' or a function.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13709 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13710 * @type string|function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13711 * @default alert
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13712 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13713 errMode: "alert",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13714
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13715
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13716 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13717 * Feature plug-ins.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13718 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13719 * This is an array of objects which describe the feature plug-ins that are
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13720 * available to DataTables. These feature plug-ins are then available for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13721 * use through the `dom` initialisation option.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13722 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13723 * Each feature plug-in is described by an object which must have the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13724 * following properties:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13725 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13726 * * `fnInit` - function that is used to initialise the plug-in,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13727 * * `cFeature` - a character so the feature can be enabled by the `dom`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13728 * instillation option. This is case sensitive.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13729 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13730 * The `fnInit` function has the following input parameters:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13731 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13732 * 1. `{object}` DataTables settings object: see
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13733 * {@link DataTable.models.oSettings}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13734 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13735 * And the following return is expected:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13736 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13737 * * {node|null} The element which contains your feature. Note that the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13738 * return may also be void if your plug-in does not require to inject any
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13739 * DOM elements into DataTables control (`dom`) - for example this might
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13740 * be useful when developing a plug-in which allows table control via
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13741 * keyboard entry
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13742 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13743 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13744 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13745 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13746 * $.fn.dataTable.ext.features.push( {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13747 * "fnInit": function( oSettings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13748 * return new TableTools( { "oDTSettings": oSettings } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13749 * },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13750 * "cFeature": "T"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13751 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13752 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13753 feature: [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13754
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13755
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13756 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13757 * Row searching.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13758 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13759 * This method of searching is complimentary to the default type based
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13760 * searching, and a lot more comprehensive as it allows you complete control
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13761 * over the searching logic. Each element in this array is a function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13762 * (parameters described below) that is called for every row in the table,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13763 * and your logic decides if it should be included in the searching data set
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13764 * or not.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13765 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13766 * Searching functions have the following input parameters:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13767 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13768 * 1. `{object}` DataTables settings object: see
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13769 * {@link DataTable.models.oSettings}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13770 * 2. `{array|object}` Data for the row to be processed (same as the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13771 * original format that was passed in as the data source, or an array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13772 * from a DOM data source
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13773 * 3. `{int}` Row index ({@link DataTable.models.oSettings.aoData}), which
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13774 * can be useful to retrieve the `TR` element if you need DOM interaction.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13775 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13776 * And the following return is expected:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13777 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13778 * * {boolean} Include the row in the searched result set (true) or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13779 * (false)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13780 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13781 * Note that as with the main search ability in DataTables, technically this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13782 * is "filtering", since it is subtractive. However, for consistency in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13783 * naming we call it searching here.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13784 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13785 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13786 * @default []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13787 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13788 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13789 * // The following example shows custom search being applied to the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13790 * // fourth column (i.e. the data[3] index) based on two input values
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13791 * // from the end-user, matching the data in a certain range.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13792 * $.fn.dataTable.ext.search.push(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13793 * function( settings, data, dataIndex ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13794 * var min = document.getElementById('min').value * 1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13795 * var max = document.getElementById('max').value * 1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13796 * var version = data[3] == "-" ? 0 : data[3]*1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13797 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13798 * if ( min == "" && max == "" ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13799 * return true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13800 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13801 * else if ( min == "" && version < max ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13802 * return true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13803 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13804 * else if ( min < version && "" == max ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13805 * return true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13806 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13807 * else if ( min < version && version < max ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13808 * return true;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13809 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13810 * return false;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13811 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13812 * );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13813 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13814 search: [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13815
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13816
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13817 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13818 * Selector extensions
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13819 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13820 * The `selector` option can be used to extend the options available for the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13821 * selector modifier options (`selector-modifier` object data type) that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13822 * each of the three built in selector types offer (row, column and cell +
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13823 * their plural counterparts). For example the Select extension uses this
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13824 * mechanism to provide an option to select only rows, columns and cells
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13825 * that have been marked as selected by the end user (`{selected: true}`),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13826 * which can be used in conjunction with the existing built in selector
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13827 * options.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13828 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13829 * Each property is an array to which functions can be pushed. The functions
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13830 * take three attributes:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13831 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13832 * * Settings object for the host table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13833 * * Options object (`selector-modifier` object type)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13834 * * Array of selected item indexes
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13835 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13836 * The return is an array of the resulting item indexes after the custom
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13837 * selector has been applied.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13838 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13839 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13840 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13841 selector: {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13842 cell: [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13843 column: [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13844 row: []
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13845 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13846
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13847
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13848 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13849 * Internal functions, exposed for used in plug-ins.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13850 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13851 * Please note that you should not need to use the internal methods for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13852 * anything other than a plug-in (and even then, try to avoid if possible).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13853 * The internal function may change between releases.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13854 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13855 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13856 * @default {}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13857 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13858 internal: {},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13859
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13860
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13861 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13862 * Legacy configuration options. Enable and disable legacy options that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13863 * are available in DataTables.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13864 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13865 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13866 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13867 legacy: {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13868 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13869 * Enable / disable DataTables 1.9 compatible server-side processing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13870 * requests
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13871 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13872 * @type boolean
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13873 * @default null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13874 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13875 ajax: null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13876 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13877
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13878
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13879 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13880 * Pagination plug-in methods.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13881 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13882 * Each entry in this object is a function and defines which buttons should
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13883 * be shown by the pagination rendering method that is used for the table:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13884 * {@link DataTable.ext.renderer.pageButton}. The renderer addresses how the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13885 * buttons are displayed in the document, while the functions here tell it
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13886 * what buttons to display. This is done by returning an array of button
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13887 * descriptions (what each button will do).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13888 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13889 * Pagination types (the four built in options and any additional plug-in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13890 * options defined here) can be used through the `paginationType`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13891 * initialisation parameter.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13892 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13893 * The functions defined take two parameters:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13894 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13895 * 1. `{int} page` The current page index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13896 * 2. `{int} pages` The number of pages in the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13897 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13898 * Each function is expected to return an array where each element of the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13899 * array can be one of:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13900 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13901 * * `first` - Jump to first page when activated
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13902 * * `last` - Jump to last page when activated
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13903 * * `previous` - Show previous page when activated
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13904 * * `next` - Show next page when activated
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13905 * * `{int}` - Show page of the index given
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13906 * * `{array}` - A nested array containing the above elements to add a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13907 * containing 'DIV' element (might be useful for styling).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13908 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13909 * Note that DataTables v1.9- used this object slightly differently whereby
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13910 * an object with two functions would be defined for each plug-in. That
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13911 * ability is still supported by DataTables 1.10+ to provide backwards
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13912 * compatibility, but this option of use is now decremented and no longer
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13913 * documented in DataTables 1.10+.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13914 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13915 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13916 * @default {}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13917 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13918 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13919 * // Show previous, next and current page buttons only
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13920 * $.fn.dataTableExt.oPagination.current = function ( page, pages ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13921 * return [ 'previous', page, 'next' ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13922 * };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13923 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13924 pager: {},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13925
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13926
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13927 renderer: {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13928 pageButton: {},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13929 header: {}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13930 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13931
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13932
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13933 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13934 * Ordering plug-ins - custom data source
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13935 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13936 * The extension options for ordering of data available here is complimentary
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13937 * to the default type based ordering that DataTables typically uses. It
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13938 * allows much greater control over the the data that is being used to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13939 * order a column, but is necessarily therefore more complex.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13940 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13941 * This type of ordering is useful if you want to do ordering based on data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13942 * live from the DOM (for example the contents of an 'input' element) rather
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13943 * than just the static string that DataTables knows of.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13944 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13945 * The way these plug-ins work is that you create an array of the values you
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13946 * wish to be ordering for the column in question and then return that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13947 * array. The data in the array much be in the index order of the rows in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13948 * the table (not the currently ordering order!). Which order data gathering
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13949 * function is run here depends on the `dt-init columns.orderDataType`
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13950 * parameter that is used for the column (if any).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13951 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13952 * The functions defined take two parameters:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13953 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13954 * 1. `{object}` DataTables settings object: see
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13955 * {@link DataTable.models.oSettings}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13956 * 2. `{int}` Target column index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13957 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13958 * Each function is expected to return an array:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13959 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13960 * * `{array}` Data for the column to be ordering upon
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13961 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13962 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13963 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13964 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13965 * // Ordering using `input` node values
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13966 * $.fn.dataTable.ext.order['dom-text'] = function ( settings, col )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13967 * {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13968 * return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13969 * return $('input', td).val();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13970 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13971 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13972 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13973 order: {},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13974
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13975
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13976 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13977 * Type based plug-ins.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13978 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13979 * Each column in DataTables has a type assigned to it, either by automatic
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13980 * detection or by direct assignment using the `type` option for the column.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13981 * The type of a column will effect how it is ordering and search (plug-ins
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13982 * can also make use of the column type if required).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13983 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13984 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13985 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13986 type: {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13987 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13988 * Type detection functions.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13989 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13990 * The functions defined in this object are used to automatically detect
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13991 * a column's type, making initialisation of DataTables super easy, even
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13992 * when complex data is in the table.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13993 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13994 * The functions defined take two parameters:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13995 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13996 * 1. `{*}` Data from the column cell to be analysed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13997 * 2. `{settings}` DataTables settings object. This can be used to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13998 * perform context specific type detection - for example detection
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
13999 * based on language settings such as using a comma for a decimal
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14000 * place. Generally speaking the options from the settings will not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14001 * be required
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14002 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14003 * Each function is expected to return:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14004 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14005 * * `{string|null}` Data type detected, or null if unknown (and thus
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14006 * pass it on to the other type detection functions.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14007 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14008 * @type array
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14009 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14010 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14011 * // Currency type detection plug-in:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14012 * $.fn.dataTable.ext.type.detect.push(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14013 * function ( data, settings ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14014 * // Check the numeric part
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14015 * if ( ! $.isNumeric( data.substring(1) ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14016 * return null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14017 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14018 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14019 * // Check prefixed by currency
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14020 * if ( data.charAt(0) == '$' || data.charAt(0) == '&pound;' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14021 * return 'currency';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14022 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14023 * return null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14024 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14025 * );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14026 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14027 detect: [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14028
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14029
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14030 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14031 * Type based search formatting.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14032 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14033 * The type based searching functions can be used to pre-format the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14034 * data to be search on. For example, it can be used to strip HTML
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14035 * tags or to de-format telephone numbers for numeric only searching.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14036 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14037 * Note that is a search is not defined for a column of a given type,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14038 * no search formatting will be performed.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14039 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14040 * Pre-processing of searching data plug-ins - When you assign the sType
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14041 * for a column (or have it automatically detected for you by DataTables
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14042 * or a type detection plug-in), you will typically be using this for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14043 * custom sorting, but it can also be used to provide custom searching
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14044 * by allowing you to pre-processing the data and returning the data in
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14045 * the format that should be searched upon. This is done by adding
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14046 * functions this object with a parameter name which matches the sType
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14047 * for that target column. This is the corollary of <i>afnSortData</i>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14048 * for searching data.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14049 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14050 * The functions defined take a single parameter:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14051 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14052 * 1. `{*}` Data from the column cell to be prepared for searching
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14053 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14054 * Each function is expected to return:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14055 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14056 * * `{string|null}` Formatted string that will be used for the searching.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14057 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14058 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14059 * @default {}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14060 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14061 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14062 * $.fn.dataTable.ext.type.search['title-numeric'] = function ( d ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14063 * return d.replace(/\n/g," ").replace( /<.*?>/g, "" );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14064 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14065 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14066 search: {},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14067
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14068
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14069 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14070 * Type based ordering.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14071 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14072 * The column type tells DataTables what ordering to apply to the table
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14073 * when a column is sorted upon. The order for each type that is defined,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14074 * is defined by the functions available in this object.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14075 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14076 * Each ordering option can be described by three properties added to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14077 * this object:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14078 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14079 * * `{type}-pre` - Pre-formatting function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14080 * * `{type}-asc` - Ascending order function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14081 * * `{type}-desc` - Descending order function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14082 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14083 * All three can be used together, only `{type}-pre` or only
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14084 * `{type}-asc` and `{type}-desc` together. It is generally recommended
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14085 * that only `{type}-pre` is used, as this provides the optimal
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14086 * implementation in terms of speed, although the others are provided
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14087 * for compatibility with existing Javascript sort functions.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14088 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14089 * `{type}-pre`: Functions defined take a single parameter:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14090 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14091 * 1. `{*}` Data from the column cell to be prepared for ordering
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14092 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14093 * And return:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14094 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14095 * * `{*}` Data to be sorted upon
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14096 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14097 * `{type}-asc` and `{type}-desc`: Functions are typical Javascript sort
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14098 * functions, taking two parameters:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14099 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14100 * 1. `{*}` Data to compare to the second parameter
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14101 * 2. `{*}` Data to compare to the first parameter
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14102 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14103 * And returning:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14104 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14105 * * `{*}` Ordering match: <0 if first parameter should be sorted lower
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14106 * than the second parameter, ===0 if the two parameters are equal and
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14107 * >0 if the first parameter should be sorted height than the second
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14108 * parameter.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14109 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14110 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14111 * @default {}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14112 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14113 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14114 * // Numeric ordering of formatted numbers with a pre-formatter
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14115 * $.extend( $.fn.dataTable.ext.type.order, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14116 * "string-pre": function(x) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14117 * a = (a === "-" || a === "") ? 0 : a.replace( /[^\d\-\.]/g, "" );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14118 * return parseFloat( a );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14119 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14120 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14121 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14122 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14123 * // Case-sensitive string ordering, with no pre-formatting method
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14124 * $.extend( $.fn.dataTable.ext.order, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14125 * "string-case-asc": function(x,y) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14126 * return ((x < y) ? -1 : ((x > y) ? 1 : 0));
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14127 * },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14128 * "string-case-desc": function(x,y) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14129 * return ((x < y) ? 1 : ((x > y) ? -1 : 0));
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14130 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14131 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14132 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14133 order: {}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14134 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14135
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14136 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14137 * Unique DataTables instance counter
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14138 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14139 * @type int
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14140 * @private
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14141 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14142 _unique: 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14143
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14144
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14145 //
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14146 // Depreciated
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14147 // The following properties are retained for backwards compatiblity only.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14148 // The should not be used in new projects and will be removed in a future
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14149 // version
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14150 //
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14151
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14152 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14153 * Version check function.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14154 * @type function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14155 * @depreciated Since 1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14156 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14157 fnVersionCheck: DataTable.fnVersionCheck,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14158
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14159
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14160 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14161 * Index for what 'this' index API functions should use
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14162 * @type int
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14163 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14164 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14165 iApiIndex: 0,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14166
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14167
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14168 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14169 * jQuery UI class container
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14170 * @type object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14171 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14172 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14173 oJUIClasses: {},
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14174
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14175
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14176 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14177 * Software version
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14178 * @type string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14179 * @deprecated Since v1.10
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14180 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14181 sVersion: DataTable.version
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14182 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14183
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14184
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14185 //
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14186 // Backwards compatibility. Alias to pre 1.10 Hungarian notation counter parts
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14187 //
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14188 $.extend( _ext, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14189 afnFiltering: _ext.search,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14190 aTypes: _ext.type.detect,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14191 ofnSearch: _ext.type.search,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14192 oSort: _ext.type.order,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14193 afnSortData: _ext.order,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14194 aoFeatures: _ext.feature,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14195 oApi: _ext.internal,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14196 oStdClasses: _ext.classes,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14197 oPagination: _ext.pager
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14198 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14199
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14200
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14201 $.extend( DataTable.ext.classes, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14202 "sTable": "dataTable",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14203 "sNoFooter": "no-footer",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14204
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14205 /* Paging buttons */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14206 "sPageButton": "paginate_button",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14207 "sPageButtonActive": "current",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14208 "sPageButtonDisabled": "disabled",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14209
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14210 /* Striping classes */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14211 "sStripeOdd": "odd",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14212 "sStripeEven": "even",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14213
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14214 /* Empty row */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14215 "sRowEmpty": "dataTables_empty",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14216
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14217 /* Features */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14218 "sWrapper": "dataTables_wrapper",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14219 "sFilter": "dataTables_filter",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14220 "sInfo": "dataTables_info",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14221 "sPaging": "dataTables_paginate paging_", /* Note that the type is postfixed */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14222 "sLength": "dataTables_length",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14223 "sProcessing": "dataTables_processing",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14224
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14225 /* Sorting */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14226 "sSortAsc": "sorting_asc",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14227 "sSortDesc": "sorting_desc",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14228 "sSortable": "sorting", /* Sortable in both directions */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14229 "sSortableAsc": "sorting_asc_disabled",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14230 "sSortableDesc": "sorting_desc_disabled",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14231 "sSortableNone": "sorting_disabled",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14232 "sSortColumn": "sorting_", /* Note that an int is postfixed for the sorting order */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14233
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14234 /* Filtering */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14235 "sFilterInput": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14236
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14237 /* Page length */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14238 "sLengthSelect": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14239
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14240 /* Scrolling */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14241 "sScrollWrapper": "dataTables_scroll",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14242 "sScrollHead": "dataTables_scrollHead",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14243 "sScrollHeadInner": "dataTables_scrollHeadInner",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14244 "sScrollBody": "dataTables_scrollBody",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14245 "sScrollFoot": "dataTables_scrollFoot",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14246 "sScrollFootInner": "dataTables_scrollFootInner",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14247
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14248 /* Misc */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14249 "sHeaderTH": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14250 "sFooterTH": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14251
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14252 // Deprecated
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14253 "sSortJUIAsc": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14254 "sSortJUIDesc": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14255 "sSortJUI": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14256 "sSortJUIAscAllowed": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14257 "sSortJUIDescAllowed": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14258 "sSortJUIWrapper": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14259 "sSortIcon": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14260 "sJUIHeader": "",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14261 "sJUIFooter": ""
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14262 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14263
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14264
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14265 (function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14266
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14267 // Reused strings for better compression. Closure compiler appears to have a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14268 // weird edge case where it is trying to expand strings rather than use the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14269 // variable version. This results in about 200 bytes being added, for very
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14270 // little preference benefit since it this run on script load only.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14271 var _empty = '';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14272 _empty = '';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14273
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14274 var _stateDefault = _empty + 'ui-state-default';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14275 var _sortIcon = _empty + 'css_right ui-icon ui-icon-';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14276 var _headerFooter = _empty + 'fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14277
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14278 $.extend( DataTable.ext.oJUIClasses, DataTable.ext.classes, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14279 /* Full numbers paging buttons */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14280 "sPageButton": "fg-button ui-button "+_stateDefault,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14281 "sPageButtonActive": "ui-state-disabled",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14282 "sPageButtonDisabled": "ui-state-disabled",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14283
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14284 /* Features */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14285 "sPaging": "dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi "+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14286 "ui-buttonset-multi paging_", /* Note that the type is postfixed */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14287
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14288 /* Sorting */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14289 "sSortAsc": _stateDefault+" sorting_asc",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14290 "sSortDesc": _stateDefault+" sorting_desc",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14291 "sSortable": _stateDefault+" sorting",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14292 "sSortableAsc": _stateDefault+" sorting_asc_disabled",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14293 "sSortableDesc": _stateDefault+" sorting_desc_disabled",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14294 "sSortableNone": _stateDefault+" sorting_disabled",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14295 "sSortJUIAsc": _sortIcon+"triangle-1-n",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14296 "sSortJUIDesc": _sortIcon+"triangle-1-s",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14297 "sSortJUI": _sortIcon+"carat-2-n-s",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14298 "sSortJUIAscAllowed": _sortIcon+"carat-1-n",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14299 "sSortJUIDescAllowed": _sortIcon+"carat-1-s",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14300 "sSortJUIWrapper": "DataTables_sort_wrapper",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14301 "sSortIcon": "DataTables_sort_icon",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14302
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14303 /* Scrolling */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14304 "sScrollHead": "dataTables_scrollHead "+_stateDefault,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14305 "sScrollFoot": "dataTables_scrollFoot "+_stateDefault,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14306
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14307 /* Misc */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14308 "sHeaderTH": _stateDefault,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14309 "sFooterTH": _stateDefault,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14310 "sJUIHeader": _headerFooter+" ui-corner-tl ui-corner-tr",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14311 "sJUIFooter": _headerFooter+" ui-corner-bl ui-corner-br"
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14312 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14313
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14314 }());
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14315
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14316
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14317
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14318 var extPagination = DataTable.ext.pager;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14319
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14320 function _numbers ( page, pages ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14321 var
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14322 numbers = [],
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14323 buttons = extPagination.numbers_length,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14324 half = Math.floor( buttons / 2 ),
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14325 i = 1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14326
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14327 if ( pages <= buttons ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14328 numbers = _range( 0, pages );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14329 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14330 else if ( page <= half ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14331 numbers = _range( 0, buttons-2 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14332 numbers.push( 'ellipsis' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14333 numbers.push( pages-1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14334 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14335 else if ( page >= pages - 1 - half ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14336 numbers = _range( pages-(buttons-2), pages );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14337 numbers.splice( 0, 0, 'ellipsis' ); // no unshift in ie6
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14338 numbers.splice( 0, 0, 0 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14339 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14340 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14341 numbers = _range( page-half+2, page+half-1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14342 numbers.push( 'ellipsis' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14343 numbers.push( pages-1 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14344 numbers.splice( 0, 0, 'ellipsis' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14345 numbers.splice( 0, 0, 0 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14346 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14347
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14348 numbers.DT_el = 'span';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14349 return numbers;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14350 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14351
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14352
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14353 $.extend( extPagination, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14354 simple: function ( page, pages ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14355 return [ 'previous', 'next' ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14356 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14357
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14358 full: function ( page, pages ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14359 return [ 'first', 'previous', 'next', 'last' ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14360 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14361
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14362 numbers: function ( page, pages ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14363 return [ _numbers(page, pages) ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14364 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14365
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14366 simple_numbers: function ( page, pages ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14367 return [ 'previous', _numbers(page, pages), 'next' ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14368 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14369
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14370 full_numbers: function ( page, pages ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14371 return [ 'first', 'previous', _numbers(page, pages), 'next', 'last' ];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14372 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14373
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14374 // For testing and plug-ins to use
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14375 _numbers: _numbers,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14376
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14377 // Number of number buttons (including ellipsis) to show. _Must be odd!_
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14378 numbers_length: 7
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14379 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14380
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14381
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14382 $.extend( true, DataTable.ext.renderer, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14383 pageButton: {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14384 _: function ( settings, host, idx, buttons, page, pages ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14385 var classes = settings.oClasses;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14386 var lang = settings.oLanguage.oPaginate;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14387 var btnDisplay, btnClass, counter=0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14388
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14389 var attach = function( container, buttons ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14390 var i, ien, node, button;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14391 var clickHandler = function ( e ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14392 _fnPageChange( settings, e.data.action, true );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14393 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14394
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14395 for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14396 button = buttons[i];
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14397
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14398 if ( $.isArray( button ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14399 var inner = $( '<'+(button.DT_el || 'div')+'/>' )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14400 .appendTo( container );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14401 attach( inner, button );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14402 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14403 else {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14404 btnDisplay = null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14405 btnClass = '';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14406
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14407 switch ( button ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14408 case 'ellipsis':
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14409 container.append('<span class="ellipsis">&#x2026;</span>');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14410 break;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14411
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14412 case 'first':
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14413 btnDisplay = lang.sFirst;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14414 btnClass = button + (page > 0 ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14415 '' : ' '+classes.sPageButtonDisabled);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14416 break;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14417
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14418 case 'previous':
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14419 btnDisplay = lang.sPrevious;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14420 btnClass = button + (page > 0 ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14421 '' : ' '+classes.sPageButtonDisabled);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14422 break;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14423
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14424 case 'next':
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14425 btnDisplay = lang.sNext;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14426 btnClass = button + (page < pages-1 ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14427 '' : ' '+classes.sPageButtonDisabled);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14428 break;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14429
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14430 case 'last':
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14431 btnDisplay = lang.sLast;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14432 btnClass = button + (page < pages-1 ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14433 '' : ' '+classes.sPageButtonDisabled);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14434 break;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14435
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14436 default:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14437 btnDisplay = button + 1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14438 btnClass = page === button ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14439 classes.sPageButtonActive : '';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14440 break;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14441 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14442
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14443 if ( btnDisplay !== null ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14444 node = $('<a>', {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14445 'class': classes.sPageButton+' '+btnClass,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14446 'aria-controls': settings.sTableId,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14447 'data-dt-idx': counter,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14448 'tabindex': settings.iTabIndex,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14449 'id': idx === 0 && typeof button === 'string' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14450 settings.sTableId +'_'+ button :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14451 null
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14452 } )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14453 .html( btnDisplay )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14454 .appendTo( container );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14455
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14456 _fnBindAction(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14457 node, {action: button}, clickHandler
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14458 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14459
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14460 counter++;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14461 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14462 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14463 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14464 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14465
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14466 // IE9 throws an 'unknown error' if document.activeElement is used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14467 // inside an iframe or frame. Try / catch the error. Not good for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14468 // accessibility, but neither are frames.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14469 var activeEl;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14470
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14471 try {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14472 // Because this approach is destroying and recreating the paging
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14473 // elements, focus is lost on the select button which is bad for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14474 // accessibility. So we want to restore focus once the draw has
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14475 // completed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14476 activeEl = $(host).find(document.activeElement).data('dt-idx');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14477 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14478 catch (e) {}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14479
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14480 attach( $(host).empty(), buttons );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14481
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14482 if ( activeEl ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14483 $(host).find( '[data-dt-idx='+activeEl+']' ).focus();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14484 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14485 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14486 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14487 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14488
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14489
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14490
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14491 // Built in type detection. See model.ext.aTypes for information about
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14492 // what is required from this methods.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14493 $.extend( DataTable.ext.type.detect, [
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14494 // Plain numbers - first since V8 detects some plain numbers as dates
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14495 // e.g. Date.parse('55') (but not all, e.g. Date.parse('22')...).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14496 function ( d, settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14497 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14498 var decimal = settings.oLanguage.sDecimal;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14499 return _isNumber( d, decimal ) ? 'num'+decimal : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14500 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14501
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14502 // Dates (only those recognised by the browser's Date.parse)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14503 function ( d, settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14504 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14505 // V8 will remove any unknown characters at the start and end of the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14506 // expression, leading to false matches such as `$245.12` or `10%` being
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14507 // a valid date. See forum thread 18941 for detail.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14508 if ( d && !(d instanceof Date) && ( ! _re_date_start.test(d) || ! _re_date_end.test(d) ) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14509 return null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14510 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14511 var parsed = Date.parse(d);
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14512 return (parsed !== null && !isNaN(parsed)) || _empty(d) ? 'date' : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14513 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14514
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14515 // Formatted numbers
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14516 function ( d, settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14517 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14518 var decimal = settings.oLanguage.sDecimal;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14519 return _isNumber( d, decimal, true ) ? 'num-fmt'+decimal : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14520 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14521
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14522 // HTML numeric
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14523 function ( d, settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14524 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14525 var decimal = settings.oLanguage.sDecimal;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14526 return _htmlNumeric( d, decimal ) ? 'html-num'+decimal : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14527 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14528
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14529 // HTML numeric, formatted
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14530 function ( d, settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14531 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14532 var decimal = settings.oLanguage.sDecimal;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14533 return _htmlNumeric( d, decimal, true ) ? 'html-num-fmt'+decimal : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14534 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14535
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14536 // HTML (this is strict checking - there must be html)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14537 function ( d, settings )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14538 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14539 return _empty( d ) || (typeof d === 'string' && d.indexOf('<') !== -1) ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14540 'html' : null;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14541 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14542 ] );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14543
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14544
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14545
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14546 // Filter formatting functions. See model.ext.ofnSearch for information about
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14547 // what is required from these methods.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14548 //
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14549 // Note that additional search methods are added for the html numbers and
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14550 // html formatted numbers by `_addNumericSort()` when we know what the decimal
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14551 // place is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14552
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14553
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14554 $.extend( DataTable.ext.type.search, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14555 html: function ( data ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14556 return _empty(data) ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14557 data :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14558 typeof data === 'string' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14559 data
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14560 .replace( _re_new_lines, " " )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14561 .replace( _re_html, "" ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14562 '';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14563 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14564
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14565 string: function ( data ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14566 return _empty(data) ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14567 data :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14568 typeof data === 'string' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14569 data.replace( _re_new_lines, " " ) :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14570 data;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14571 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14572 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14573
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14574
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14575
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14576 var __numericReplace = function ( d, decimalPlace, re1, re2 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14577 if ( d !== 0 && (!d || d === '-') ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14578 return -Infinity;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14579 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14580
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14581 // If a decimal place other than `.` is used, it needs to be given to the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14582 // function so we can detect it and replace with a `.` which is the only
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14583 // decimal place Javascript recognises - it is not locale aware.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14584 if ( decimalPlace ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14585 d = _numToDecimal( d, decimalPlace );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14586 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14587
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14588 if ( d.replace ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14589 if ( re1 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14590 d = d.replace( re1, '' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14591 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14592
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14593 if ( re2 ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14594 d = d.replace( re2, '' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14595 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14596 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14597
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14598 return d * 1;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14599 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14600
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14601
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14602 // Add the numeric 'deformatting' functions for sorting and search. This is done
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14603 // in a function to provide an easy ability for the language options to add
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14604 // additional methods if a non-period decimal place is used.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14605 function _addNumericSort ( decimalPlace ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14606 $.each(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14607 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14608 // Plain numbers
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14609 "num": function ( d ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14610 return __numericReplace( d, decimalPlace );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14611 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14612
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14613 // Formatted numbers
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14614 "num-fmt": function ( d ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14615 return __numericReplace( d, decimalPlace, _re_formatted_numeric );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14616 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14617
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14618 // HTML numeric
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14619 "html-num": function ( d ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14620 return __numericReplace( d, decimalPlace, _re_html );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14621 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14622
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14623 // HTML numeric, formatted
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14624 "html-num-fmt": function ( d ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14625 return __numericReplace( d, decimalPlace, _re_html, _re_formatted_numeric );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14626 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14627 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14628 function ( key, fn ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14629 // Add the ordering method
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14630 _ext.type.order[ key+decimalPlace+'-pre' ] = fn;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14631
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14632 // For HTML types add a search formatter that will strip the HTML
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14633 if ( key.match(/^html\-/) ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14634 _ext.type.search[ key+decimalPlace ] = _ext.type.search.html;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14635 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14636 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14637 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14638 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14639
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14640
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14641 // Default sort methods
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14642 $.extend( _ext.type.order, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14643 // Dates
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14644 "date-pre": function ( d ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14645 return Date.parse( d ) || 0;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14646 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14647
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14648 // html
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14649 "html-pre": function ( a ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14650 return _empty(a) ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14651 '' :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14652 a.replace ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14653 a.replace( /<.*?>/g, "" ).toLowerCase() :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14654 a+'';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14655 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14656
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14657 // string
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14658 "string-pre": function ( a ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14659 // This is a little complex, but faster than always calling toString,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14660 // http://jsperf.com/tostring-v-check
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14661 return _empty(a) ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14662 '' :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14663 typeof a === 'string' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14664 a.toLowerCase() :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14665 ! a.toString ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14666 '' :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14667 a.toString();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14668 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14669
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14670 // string-asc and -desc are retained only for compatibility with the old
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14671 // sort methods
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14672 "string-asc": function ( x, y ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14673 return ((x < y) ? -1 : ((x > y) ? 1 : 0));
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14674 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14675
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14676 "string-desc": function ( x, y ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14677 return ((x < y) ? 1 : ((x > y) ? -1 : 0));
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14678 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14679 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14680
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14681
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14682 // Numeric sorting types - order doesn't matter here
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14683 _addNumericSort( '' );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14684
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14685
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14686 $.extend( true, DataTable.ext.renderer, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14687 header: {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14688 _: function ( settings, cell, column, classes ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14689 // No additional mark-up required
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14690 // Attach a sort listener to update on sort - note that using the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14691 // `DT` namespace will allow the event to be removed automatically
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14692 // on destroy, while the `dt` namespaced event is the one we are
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14693 // listening for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14694 $(settings.nTable).on( 'order.dt.DT', function ( e, ctx, sorting, columns ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14695 if ( settings !== ctx ) { // need to check this this is the host
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14696 return; // table, not a nested one
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14697 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14698
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14699 var colIdx = column.idx;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14700
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14701 cell
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14702 .removeClass(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14703 column.sSortingClass +' '+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14704 classes.sSortAsc +' '+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14705 classes.sSortDesc
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14706 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14707 .addClass( columns[ colIdx ] == 'asc' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14708 classes.sSortAsc : columns[ colIdx ] == 'desc' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14709 classes.sSortDesc :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14710 column.sSortingClass
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14711 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14712 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14713 },
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14714
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14715 jqueryui: function ( settings, cell, column, classes ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14716 $('<div/>')
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14717 .addClass( classes.sSortJUIWrapper )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14718 .append( cell.contents() )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14719 .append( $('<span/>')
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14720 .addClass( classes.sSortIcon+' '+column.sSortingClassJUI )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14721 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14722 .appendTo( cell );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14723
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14724 // Attach a sort listener to update on sort
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14725 $(settings.nTable).on( 'order.dt.DT', function ( e, ctx, sorting, columns ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14726 if ( settings !== ctx ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14727 return;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14728 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14729
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14730 var colIdx = column.idx;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14731
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14732 cell
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14733 .removeClass( classes.sSortAsc +" "+classes.sSortDesc )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14734 .addClass( columns[ colIdx ] == 'asc' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14735 classes.sSortAsc : columns[ colIdx ] == 'desc' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14736 classes.sSortDesc :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14737 column.sSortingClass
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14738 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14739
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14740 cell
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14741 .find( 'span.'+classes.sSortIcon )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14742 .removeClass(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14743 classes.sSortJUIAsc +" "+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14744 classes.sSortJUIDesc +" "+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14745 classes.sSortJUI +" "+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14746 classes.sSortJUIAscAllowed +" "+
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14747 classes.sSortJUIDescAllowed
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14748 )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14749 .addClass( columns[ colIdx ] == 'asc' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14750 classes.sSortJUIAsc : columns[ colIdx ] == 'desc' ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14751 classes.sSortJUIDesc :
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14752 column.sSortingClassJUI
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14753 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14754 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14755 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14756 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14757 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14758
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14759 /*
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14760 * Public helper functions. These aren't used internally by DataTables, or
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14761 * called by any of the options passed into DataTables, but they can be used
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14762 * externally by developers working with DataTables. They are helper functions
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14763 * to make working with DataTables a little bit easier.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14764 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14765
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14766 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14767 * Helpers for `columns.render`.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14768 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14769 * The options defined here can be used with the `columns.render` initialisation
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14770 * option to provide a display renderer. The following functions are defined:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14771 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14772 * * `number` - Will format numeric data (defined by `columns.data`) for
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14773 * display, retaining the original unformatted data for sorting and filtering.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14774 * It takes 5 parameters:
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14775 * * `string` - Thousands grouping separator
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14776 * * `string` - Decimal point indicator
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14777 * * `integer` - Number of decimal points to show
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14778 * * `string` (optional) - Prefix.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14779 * * `string` (optional) - Postfix (/suffix).
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14780 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14781 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14782 * // Column definition using the number renderer
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14783 * {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14784 * data: "salary",
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14785 * render: $.fn.dataTable.render.number( '\'', '.', 0, '$' )
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14786 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14787 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14788 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14789 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14790 DataTable.render = {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14791 number: function ( thousands, decimal, precision, prefix, postfix ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14792 return {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14793 display: function ( d ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14794 if ( typeof d !== 'number' && typeof d !== 'string' ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14795 return d;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14796 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14797
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14798 var negative = d < 0 ? '-' : '';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14799 d = Math.abs( parseFloat( d ) );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14800
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14801 var intPart = parseInt( d, 10 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14802 var floatPart = precision ?
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14803 decimal+(d - intPart).toFixed( precision ).substring( 2 ):
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14804 '';
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14805
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14806 return negative + (prefix||'') +
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14807 intPart.toString().replace(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14808 /\B(?=(\d{3})+(?!\d))/g, thousands
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14809 ) +
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14810 floatPart +
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14811 (postfix||'');
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14812 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14813 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14814 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14815 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14816
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14817
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14818 /*
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14819 * This is really a good bit rubbish this method of exposing the internal methods
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14820 * publicly... - To be fixed in 2.0 using methods on the prototype
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14821 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14822
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14823
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14824 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14825 * Create a wrapper function for exporting an internal functions to an external API.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14826 * @param {string} fn API function name
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14827 * @returns {function} wrapped function
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14828 * @memberof DataTable#internal
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14829 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14830 function _fnExternApiFunc (fn)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14831 {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14832 return function() {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14833 var args = [_fnSettingsFromNode( this[DataTable.ext.iApiIndex] )].concat(
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14834 Array.prototype.slice.call(arguments)
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14835 );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14836 return DataTable.ext.internal[fn].apply( this, args );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14837 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14838 }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14839
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14840
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14841 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14842 * Reference to internal functions for use by plug-in developers. Note that
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14843 * these methods are references to internal functions and are considered to be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14844 * private. If you use these methods, be aware that they are liable to change
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14845 * between versions.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14846 * @namespace
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14847 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14848 $.extend( DataTable.ext.internal, {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14849 _fnExternApiFunc: _fnExternApiFunc,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14850 _fnBuildAjax: _fnBuildAjax,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14851 _fnAjaxUpdate: _fnAjaxUpdate,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14852 _fnAjaxParameters: _fnAjaxParameters,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14853 _fnAjaxUpdateDraw: _fnAjaxUpdateDraw,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14854 _fnAjaxDataSrc: _fnAjaxDataSrc,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14855 _fnAddColumn: _fnAddColumn,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14856 _fnColumnOptions: _fnColumnOptions,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14857 _fnAdjustColumnSizing: _fnAdjustColumnSizing,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14858 _fnVisibleToColumnIndex: _fnVisibleToColumnIndex,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14859 _fnColumnIndexToVisible: _fnColumnIndexToVisible,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14860 _fnVisbleColumns: _fnVisbleColumns,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14861 _fnGetColumns: _fnGetColumns,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14862 _fnColumnTypes: _fnColumnTypes,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14863 _fnApplyColumnDefs: _fnApplyColumnDefs,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14864 _fnHungarianMap: _fnHungarianMap,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14865 _fnCamelToHungarian: _fnCamelToHungarian,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14866 _fnLanguageCompat: _fnLanguageCompat,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14867 _fnBrowserDetect: _fnBrowserDetect,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14868 _fnAddData: _fnAddData,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14869 _fnAddTr: _fnAddTr,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14870 _fnNodeToDataIndex: _fnNodeToDataIndex,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14871 _fnNodeToColumnIndex: _fnNodeToColumnIndex,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14872 _fnGetCellData: _fnGetCellData,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14873 _fnSetCellData: _fnSetCellData,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14874 _fnSplitObjNotation: _fnSplitObjNotation,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14875 _fnGetObjectDataFn: _fnGetObjectDataFn,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14876 _fnSetObjectDataFn: _fnSetObjectDataFn,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14877 _fnGetDataMaster: _fnGetDataMaster,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14878 _fnClearTable: _fnClearTable,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14879 _fnDeleteIndex: _fnDeleteIndex,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14880 _fnInvalidate: _fnInvalidate,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14881 _fnGetRowElements: _fnGetRowElements,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14882 _fnCreateTr: _fnCreateTr,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14883 _fnBuildHead: _fnBuildHead,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14884 _fnDrawHead: _fnDrawHead,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14885 _fnDraw: _fnDraw,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14886 _fnReDraw: _fnReDraw,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14887 _fnAddOptionsHtml: _fnAddOptionsHtml,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14888 _fnDetectHeader: _fnDetectHeader,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14889 _fnGetUniqueThs: _fnGetUniqueThs,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14890 _fnFeatureHtmlFilter: _fnFeatureHtmlFilter,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14891 _fnFilterComplete: _fnFilterComplete,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14892 _fnFilterCustom: _fnFilterCustom,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14893 _fnFilterColumn: _fnFilterColumn,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14894 _fnFilter: _fnFilter,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14895 _fnFilterCreateSearch: _fnFilterCreateSearch,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14896 _fnEscapeRegex: _fnEscapeRegex,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14897 _fnFilterData: _fnFilterData,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14898 _fnFeatureHtmlInfo: _fnFeatureHtmlInfo,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14899 _fnUpdateInfo: _fnUpdateInfo,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14900 _fnInfoMacros: _fnInfoMacros,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14901 _fnInitialise: _fnInitialise,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14902 _fnInitComplete: _fnInitComplete,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14903 _fnLengthChange: _fnLengthChange,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14904 _fnFeatureHtmlLength: _fnFeatureHtmlLength,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14905 _fnFeatureHtmlPaginate: _fnFeatureHtmlPaginate,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14906 _fnPageChange: _fnPageChange,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14907 _fnFeatureHtmlProcessing: _fnFeatureHtmlProcessing,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14908 _fnProcessingDisplay: _fnProcessingDisplay,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14909 _fnFeatureHtmlTable: _fnFeatureHtmlTable,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14910 _fnScrollDraw: _fnScrollDraw,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14911 _fnApplyToChildren: _fnApplyToChildren,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14912 _fnCalculateColumnWidths: _fnCalculateColumnWidths,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14913 _fnThrottle: _fnThrottle,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14914 _fnConvertToWidth: _fnConvertToWidth,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14915 _fnGetWidestNode: _fnGetWidestNode,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14916 _fnGetMaxLenString: _fnGetMaxLenString,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14917 _fnStringToCss: _fnStringToCss,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14918 _fnSortFlatten: _fnSortFlatten,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14919 _fnSort: _fnSort,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14920 _fnSortAria: _fnSortAria,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14921 _fnSortListener: _fnSortListener,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14922 _fnSortAttachListener: _fnSortAttachListener,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14923 _fnSortingClasses: _fnSortingClasses,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14924 _fnSortData: _fnSortData,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14925 _fnSaveState: _fnSaveState,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14926 _fnLoadState: _fnLoadState,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14927 _fnSettingsFromNode: _fnSettingsFromNode,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14928 _fnLog: _fnLog,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14929 _fnMap: _fnMap,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14930 _fnBindAction: _fnBindAction,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14931 _fnCallbackReg: _fnCallbackReg,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14932 _fnCallbackFire: _fnCallbackFire,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14933 _fnLengthOverflow: _fnLengthOverflow,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14934 _fnRenderer: _fnRenderer,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14935 _fnDataSource: _fnDataSource,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14936 _fnRowAttributes: _fnRowAttributes,
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14937 _fnCalculateEnd: function () {} // Used by a lot of plug-ins, but redundant
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14938 // in 1.10, so this dead-end function is
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14939 // added to prevent errors
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14940 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14941
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14942
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14943 // jQuery access
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14944 $.fn.dataTable = DataTable;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14945
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14946 // Legacy aliases
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14947 $.fn.dataTableSettings = DataTable.settings;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14948 $.fn.dataTableExt = DataTable.ext;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14949
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14950 // With a capital `D` we return a DataTables API instance rather than a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14951 // jQuery object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14952 $.fn.DataTable = function ( opts ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14953 return $(this).dataTable( opts ).api();
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14954 };
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14955
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14956 // All properties that are available to $.fn.dataTable should also be
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14957 // available on $.fn.DataTable
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14958 $.each( DataTable, function ( prop, val ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14959 $.fn.DataTable[ prop ] = val;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14960 } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14961
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14962
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14963 // Information about events fired by DataTables - for documentation.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14964 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14965 * Draw event, fired whenever the table is redrawn on the page, at the same
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14966 * point as fnDrawCallback. This may be useful for binding events or
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14967 * performing calculations when the table is altered at all.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14968 * @name DataTable#draw.dt
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14969 * @event
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14970 * @param {event} e jQuery event object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14971 * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14972 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14973
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14974 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14975 * Search event, fired when the searching applied to the table (using the
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14976 * built-in global search, or column filters) is altered.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14977 * @name DataTable#search.dt
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14978 * @event
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14979 * @param {event} e jQuery event object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14980 * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14981 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14982
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14983 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14984 * Page change event, fired when the paging of the table is altered.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14985 * @name DataTable#page.dt
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14986 * @event
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14987 * @param {event} e jQuery event object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14988 * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14989 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14990
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14991 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14992 * Order event, fired when the ordering applied to the table is altered.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14993 * @name DataTable#order.dt
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14994 * @event
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14995 * @param {event} e jQuery event object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14996 * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14997 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14998
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
14999 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15000 * DataTables initialisation complete event, fired when the table is fully
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15001 * drawn, including Ajax data loaded, if Ajax data is required.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15002 * @name DataTable#init.dt
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15003 * @event
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15004 * @param {event} e jQuery event object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15005 * @param {object} oSettings DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15006 * @param {object} json The JSON object request from the server - only
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15007 * present if client-side Ajax sourced data is used</li></ol>
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15008 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15009
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15010 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15011 * State save event, fired when the table has changed state a new state save
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15012 * is required. This event allows modification of the state saving object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15013 * prior to actually doing the save, including addition or other state
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15014 * properties (for plug-ins) or modification of a DataTables core property.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15015 * @name DataTable#stateSaveParams.dt
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15016 * @event
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15017 * @param {event} e jQuery event object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15018 * @param {object} oSettings DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15019 * @param {object} json The state information to be saved
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15020 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15021
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15022 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15023 * State load event, fired when the table is loading state from the stored
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15024 * data, but prior to the settings object being modified by the saved state
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15025 * - allowing modification of the saved state is required or loading of
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15026 * state for a plug-in.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15027 * @name DataTable#stateLoadParams.dt
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15028 * @event
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15029 * @param {event} e jQuery event object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15030 * @param {object} oSettings DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15031 * @param {object} json The saved state information
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15032 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15033
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15034 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15035 * State loaded event, fired when state has been loaded from stored data and
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15036 * the settings object has been modified by the loaded data.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15037 * @name DataTable#stateLoaded.dt
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15038 * @event
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15039 * @param {event} e jQuery event object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15040 * @param {object} oSettings DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15041 * @param {object} json The saved state information
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15042 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15043
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15044 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15045 * Processing event, fired when DataTables is doing some kind of processing
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15046 * (be it, order, searcg or anything else). It can be used to indicate to
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15047 * the end user that there is something happening, or that something has
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15048 * finished.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15049 * @name DataTable#processing.dt
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15050 * @event
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15051 * @param {event} e jQuery event object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15052 * @param {object} oSettings DataTables settings object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15053 * @param {boolean} bShow Flag for if DataTables is doing processing or not
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15054 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15055
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15056 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15057 * Ajax (XHR) event, fired whenever an Ajax request is completed from a
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15058 * request to made to the server for new data. This event is called before
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15059 * DataTables processed the returned data, so it can also be used to pre-
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15060 * process the data returned from the server, if needed.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15061 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15062 * Note that this trigger is called in `fnServerData`, if you override
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15063 * `fnServerData` and which to use this event, you need to trigger it in you
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15064 * success function.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15065 * @name DataTable#xhr.dt
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15066 * @event
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15067 * @param {event} e jQuery event object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15068 * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15069 * @param {object} json JSON returned from the server
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15070 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15071 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15072 * // Use a custom property returned from the server in another DOM element
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15073 * $('#table').dataTable().on('xhr.dt', function (e, settings, json) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15074 * $('#status').html( json.status );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15075 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15076 *
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15077 * @example
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15078 * // Pre-process the data returned from the server
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15079 * $('#table').dataTable().on('xhr.dt', function (e, settings, json) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15080 * for ( var i=0, ien=json.aaData.length ; i<ien ; i++ ) {
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15081 * json.aaData[i].sum = json.aaData[i].one + json.aaData[i].two;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15082 * }
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15083 * // Note no return - manipulate the data directly in the JSON object.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15084 * } );
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15085 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15086
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15087 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15088 * Destroy event, fired when the DataTable is destroyed by calling fnDestroy
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15089 * or passing the bDestroy:true parameter in the initialisation object. This
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15090 * can be used to remove bound events, added DOM nodes, etc.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15091 * @name DataTable#destroy.dt
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15092 * @event
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15093 * @param {event} e jQuery event object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15094 * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15095 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15096
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15097 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15098 * Page length change event, fired when number of records to show on each
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15099 * page (the length) is changed.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15100 * @name DataTable#length.dt
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15101 * @event
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15102 * @param {event} e jQuery event object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15103 * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15104 * @param {integer} len New length
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15105 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15106
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15107 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15108 * Column sizing has changed.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15109 * @name DataTable#column-sizing.dt
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15110 * @event
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15111 * @param {event} e jQuery event object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15112 * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15113 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15114
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15115 /**
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15116 * Column visibility has changed.
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15117 * @name DataTable#column-visibility.dt
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15118 * @event
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15119 * @param {event} e jQuery event object
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15120 * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15121 * @param {int} column Column index
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15122 * @param {bool} vis `false` if column now hidden, or `true` if visible
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15123 */
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15124
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15125 return $.fn.dataTable;
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15126 }));
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15127
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15128 }(window, document));
42076db43d42 Fixed auto resizing plus various other minor bugs
saskia-hiltemann
parents:
diff changeset
15129