annotate DataTables-1.9.4/media/src/model/model.ext.js @ 0:ac5f9272033b draft

first upload
author saskia-hiltemann
date Tue, 01 Jul 2014 11:42:23 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
1
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
2
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
3 /**
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
4 * DataTables extension options and plug-ins. This namespace acts as a collection "area"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
5 * for plug-ins that can be used to extend the default DataTables behaviour - indeed many
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
6 * of the build in methods use this method to provide their own capabilities (sorting methods
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
7 * for example).
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
8 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
9 * Note that this namespace is aliased to jQuery.fn.dataTableExt so it can be readily accessed
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
10 * and modified by plug-ins.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
11 * @namespace
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
12 */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
13 DataTable.models.ext = {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
14 /**
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
15 * Plug-in filtering functions - this method of filtering is complimentary to the default
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
16 * type based filtering, and a lot more comprehensive as it allows you complete control
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
17 * over the filtering logic. Each element in this array is a function (parameters
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
18 * described below) that is called for every row in the table, and your logic decides if
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
19 * it should be included in the filtered data set or not.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
20 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
21 * <li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
22 * Function input parameters:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
23 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
24 * <li>{object} DataTables settings object: see {@link DataTable.models.oSettings}.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
25 * <li>{array|object} Data for the row to be processed (same as the original format
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
26 * that was passed in as the data source, or an array from a DOM data source</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
27 * <li>{int} Row index in aoData ({@link DataTable.models.oSettings.aoData}), which can
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
28 * be useful to retrieve the TR element if you need DOM interaction.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
29 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
30 * </li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
31 * <li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
32 * Function return:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
33 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
34 * <li>{boolean} Include the row in the filtered result set (true) or not (false)</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
35 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
36 * </il>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
37 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
38 * @type array
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
39 * @default []
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
40 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
41 * @example
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
42 * // The following example shows custom filtering being applied to the fourth column (i.e.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
43 * // the aData[3] index) based on two input values from the end-user, matching the data in
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
44 * // a certain range.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
45 * $.fn.dataTableExt.afnFiltering.push(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
46 * function( oSettings, aData, iDataIndex ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
47 * var iMin = document.getElementById('min').value * 1;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
48 * var iMax = document.getElementById('max').value * 1;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
49 * var iVersion = aData[3] == "-" ? 0 : aData[3]*1;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
50 * if ( iMin == "" && iMax == "" ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
51 * return true;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
52 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
53 * else if ( iMin == "" && iVersion < iMax ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
54 * return true;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
55 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
56 * else if ( iMin < iVersion && "" == iMax ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
57 * return true;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
58 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
59 * else if ( iMin < iVersion && iVersion < iMax ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
60 * return true;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
61 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
62 * return false;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
63 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
64 * );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
65 */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
66 "afnFiltering": [],
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
67
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
68
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
69 /**
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
70 * Plug-in sorting functions - this method of sorting is complimentary to the default type
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
71 * based sorting that DataTables does automatically, allowing much greater control over the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
72 * the data that is being used to sort a column. This is useful if you want to do sorting
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
73 * based on live data (for example the contents of an 'input' element) rather than just the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
74 * static string that DataTables knows of. The way these plug-ins work is that you create
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
75 * an array of the values you wish to be sorted for the column in question and then return
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
76 * that array. Which pre-sorting function is run here depends on the sSortDataType parameter
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
77 * that is used for the column (if any). This is the corollary of <i>ofnSearch</i> for sort
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
78 * data.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
79 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
80 * <li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
81 * Function input parameters:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
82 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
83 * <li>{object} DataTables settings object: see {@link DataTable.models.oSettings}.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
84 * <li>{int} Target column index</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
85 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
86 * </li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
87 * <li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
88 * Function return:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
89 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
90 * <li>{array} Data for the column to be sorted upon</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
91 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
92 * </il>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
93 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
94 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
95 * Note that as of v1.9, it is typically preferable to use <i>mData</i> to prepare data for
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
96 * the different uses that DataTables can put the data to. Specifically <i>mData</i> when
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
97 * used as a function will give you a 'type' (sorting, filtering etc) that you can use to
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
98 * prepare the data as required for the different types. As such, this method is deprecated.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
99 * @type array
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
100 * @default []
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
101 * @deprecated
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
102 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
103 * @example
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
104 * // Updating the cached sorting information with user entered values in HTML input elements
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
105 * jQuery.fn.dataTableExt.afnSortData['dom-text'] = function ( oSettings, iColumn )
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
106 * {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
107 * var aData = [];
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
108 * $( 'td:eq('+iColumn+') input', oSettings.oApi._fnGetTrNodes(oSettings) ).each( function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
109 * aData.push( this.value );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
110 * } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
111 * return aData;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
112 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
113 */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
114 "afnSortData": [],
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
115
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
116
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
117 /**
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
118 * Feature plug-ins - This is an array of objects which describe the feature plug-ins that are
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
119 * available to DataTables. These feature plug-ins are accessible through the sDom initialisation
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
120 * option. As such, each feature plug-in must describe a function that is used to initialise
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
121 * itself (fnInit), a character so the feature can be enabled by sDom (cFeature) and the name
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
122 * of the feature (sFeature). Thus the objects attached to this method must provide:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
123 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
124 * <li>{function} fnInit Initialisation of the plug-in
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
125 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
126 * <li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
127 * Function input parameters:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
128 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
129 * <li>{object} DataTables settings object: see {@link DataTable.models.oSettings}.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
130 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
131 * </li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
132 * <li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
133 * Function return:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
134 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
135 * <li>{node|null} The element which contains your feature. Note that the return
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
136 * may also be void if your plug-in does not require to inject any DOM elements
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
137 * into DataTables control (sDom) - for example this might be useful when
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
138 * developing a plug-in which allows table control via keyboard entry.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
139 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
140 * </il>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
141 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
142 * </li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
143 * <li>{character} cFeature Character that will be matched in sDom - case sensitive</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
144 * <li>{string} sFeature Feature name</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
145 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
146 * @type array
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
147 * @default []
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
148 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
149 * @example
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
150 * // How TableTools initialises itself.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
151 * $.fn.dataTableExt.aoFeatures.push( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
152 * "fnInit": function( oSettings ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
153 * return new TableTools( { "oDTSettings": oSettings } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
154 * },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
155 * "cFeature": "T",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
156 * "sFeature": "TableTools"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
157 * } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
158 */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
159 "aoFeatures": [],
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
160
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
161
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
162 /**
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
163 * Type detection plug-in functions - DataTables utilises types to define how sorting and
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
164 * filtering behave, and types can be either be defined by the developer (sType for the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
165 * column) or they can be automatically detected by the methods in this array. The functions
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
166 * defined in the array are quite simple, taking a single parameter (the data to analyse)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
167 * and returning the type if it is a known type, or null otherwise.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
168 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
169 * <li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
170 * Function input parameters:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
171 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
172 * <li>{*} Data from the column cell to be analysed</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
173 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
174 * </li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
175 * <li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
176 * Function return:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
177 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
178 * <li>{string|null} Data type detected, or null if unknown (and thus pass it
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
179 * on to the other type detection functions.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
180 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
181 * </il>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
182 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
183 * @type array
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
184 * @default []
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
185 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
186 * @example
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
187 * // Currency type detection plug-in:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
188 * jQuery.fn.dataTableExt.aTypes.push(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
189 * function ( sData ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
190 * var sValidChars = "0123456789.-";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
191 * var Char;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
192 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
193 * // Check the numeric part
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
194 * for ( i=1 ; i<sData.length ; i++ ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
195 * Char = sData.charAt(i);
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
196 * if (sValidChars.indexOf(Char) == -1) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
197 * return null;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
198 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
199 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
200 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
201 * // Check prefixed by currency
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
202 * if ( sData.charAt(0) == '$' || sData.charAt(0) == '&pound;' ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
203 * return 'currency';
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
204 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
205 * return null;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
206 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
207 * );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
208 */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
209 "aTypes": [],
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
210
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
211
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
212 /**
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
213 * Provide a common method for plug-ins to check the version of DataTables being used,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
214 * in order to ensure compatibility.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
215 * @type function
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
216 * @param {string} sVersion Version string to check for, in the format "X.Y.Z". Note
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
217 * that the formats "X" and "X.Y" are also acceptable.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
218 * @returns {boolean} true if this version of DataTables is greater or equal to the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
219 * required version, or false if this version of DataTales is not suitable
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
220 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
221 * @example
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
222 * $(document).ready(function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
223 * var oTable = $('#example').dataTable();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
224 * alert( oTable.fnVersionCheck( '1.9.0' ) );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
225 * } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
226 */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
227 "fnVersionCheck": DataTable.fnVersionCheck,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
228
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
229
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
230 /**
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
231 * Index for what 'this' index API functions should use
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
232 * @type int
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
233 * @default 0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
234 */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
235 "iApiIndex": 0,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
236
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
237
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
238 /**
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
239 * Pre-processing of filtering data plug-ins - When you assign the sType for a column
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
240 * (or have it automatically detected for you by DataTables or a type detection plug-in),
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
241 * you will typically be using this for custom sorting, but it can also be used to provide
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
242 * custom filtering by allowing you to pre-processing the data and returning the data in
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
243 * the format that should be filtered upon. This is done by adding functions this object
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
244 * with a parameter name which matches the sType for that target column. This is the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
245 * corollary of <i>afnSortData</i> for filtering data.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
246 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
247 * <li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
248 * Function input parameters:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
249 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
250 * <li>{*} Data from the column cell to be prepared for filtering</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
251 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
252 * </li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
253 * <li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
254 * Function return:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
255 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
256 * <li>{string|null} Formatted string that will be used for the filtering.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
257 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
258 * </il>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
259 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
260 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
261 * Note that as of v1.9, it is typically preferable to use <i>mData</i> to prepare data for
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
262 * the different uses that DataTables can put the data to. Specifically <i>mData</i> when
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
263 * used as a function will give you a 'type' (sorting, filtering etc) that you can use to
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
264 * prepare the data as required for the different types. As such, this method is deprecated.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
265 * @type object
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
266 * @default {}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
267 * @deprecated
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
268 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
269 * @example
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
270 * $.fn.dataTableExt.ofnSearch['title-numeric'] = function ( sData ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
271 * return sData.replace(/\n/g," ").replace( /<.*?>/g, "" );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
272 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
273 */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
274 "ofnSearch": {},
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
275
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
276
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
277 /**
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
278 * Container for all private functions in DataTables so they can be exposed externally
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
279 * @type object
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
280 * @default {}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
281 */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
282 "oApi": {},
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
283
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
284
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
285 /**
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
286 * Storage for the various classes that DataTables uses
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
287 * @type object
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
288 * @default {}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
289 */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
290 "oStdClasses": {},
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
291
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
292
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
293 /**
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
294 * Storage for the various classes that DataTables uses - jQuery UI suitable
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
295 * @type object
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
296 * @default {}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
297 */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
298 "oJUIClasses": {},
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
299
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
300
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
301 /**
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
302 * Pagination plug-in methods - The style and controls of the pagination can significantly
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
303 * impact on how the end user interacts with the data in your table, and DataTables allows
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
304 * the addition of pagination controls by extending this object, which can then be enabled
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
305 * through the <i>sPaginationType</i> initialisation parameter. Each pagination type that
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
306 * is added is an object (the property name of which is what <i>sPaginationType</i> refers
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
307 * to) that has two properties, both methods that are used by DataTables to update the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
308 * control's state.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
309 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
310 * <li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
311 * fnInit - Initialisation of the paging controls. Called only during initialisation
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
312 * of the table. It is expected that this function will add the required DOM elements
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
313 * to the page for the paging controls to work. The element pointer
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
314 * 'oSettings.aanFeatures.p' array is provided by DataTables to contain the paging
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
315 * controls (note that this is a 2D array to allow for multiple instances of each
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
316 * DataTables DOM element). It is suggested that you add the controls to this element
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
317 * as children
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
318 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
319 * <li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
320 * Function input parameters:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
321 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
322 * <li>{object} DataTables settings object: see {@link DataTable.models.oSettings}.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
323 * <li>{node} Container into which the pagination controls must be inserted</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
324 * <li>{function} Draw callback function - whenever the controls cause a page
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
325 * change, this method must be called to redraw the table.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
326 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
327 * </li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
328 * <li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
329 * Function return:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
330 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
331 * <li>No return required</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
332 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
333 * </il>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
334 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
335 * </il>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
336 * <li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
337 * fnInit - This function is called whenever the paging status of the table changes and is
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
338 * typically used to update classes and/or text of the paging controls to reflex the new
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
339 * status.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
340 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
341 * <li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
342 * Function input parameters:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
343 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
344 * <li>{object} DataTables settings object: see {@link DataTable.models.oSettings}.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
345 * <li>{function} Draw callback function - in case you need to redraw the table again
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
346 * or attach new event listeners</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
347 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
348 * </li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
349 * <li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
350 * Function return:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
351 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
352 * <li>No return required</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
353 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
354 * </il>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
355 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
356 * </il>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
357 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
358 * @type object
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
359 * @default {}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
360 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
361 * @example
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
362 * $.fn.dataTableExt.oPagination.four_button = {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
363 * "fnInit": function ( oSettings, nPaging, fnCallbackDraw ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
364 * nFirst = document.createElement( 'span' );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
365 * nPrevious = document.createElement( 'span' );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
366 * nNext = document.createElement( 'span' );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
367 * nLast = document.createElement( 'span' );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
368 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
369 * nFirst.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sFirst ) );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
370 * nPrevious.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sPrevious ) );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
371 * nNext.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sNext ) );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
372 * nLast.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sLast ) );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
373 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
374 * nFirst.className = "paginate_button first";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
375 * nPrevious.className = "paginate_button previous";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
376 * nNext.className="paginate_button next";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
377 * nLast.className = "paginate_button last";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
378 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
379 * nPaging.appendChild( nFirst );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
380 * nPaging.appendChild( nPrevious );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
381 * nPaging.appendChild( nNext );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
382 * nPaging.appendChild( nLast );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
383 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
384 * $(nFirst).click( function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
385 * oSettings.oApi._fnPageChange( oSettings, "first" );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
386 * fnCallbackDraw( oSettings );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
387 * } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
388 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
389 * $(nPrevious).click( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
390 * oSettings.oApi._fnPageChange( oSettings, "previous" );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
391 * fnCallbackDraw( oSettings );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
392 * } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
393 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
394 * $(nNext).click( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
395 * oSettings.oApi._fnPageChange( oSettings, "next" );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
396 * fnCallbackDraw( oSettings );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
397 * } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
398 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
399 * $(nLast).click( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
400 * oSettings.oApi._fnPageChange( oSettings, "last" );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
401 * fnCallbackDraw( oSettings );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
402 * } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
403 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
404 * $(nFirst).bind( 'selectstart', function () { return false; } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
405 * $(nPrevious).bind( 'selectstart', function () { return false; } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
406 * $(nNext).bind( 'selectstart', function () { return false; } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
407 * $(nLast).bind( 'selectstart', function () { return false; } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
408 * },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
409 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
410 * "fnUpdate": function ( oSettings, fnCallbackDraw ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
411 * if ( !oSettings.aanFeatures.p ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
412 * return;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
413 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
414 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
415 * // Loop over each instance of the pager
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
416 * var an = oSettings.aanFeatures.p;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
417 * for ( var i=0, iLen=an.length ; i<iLen ; i++ ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
418 * var buttons = an[i].getElementsByTagName('span');
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
419 * if ( oSettings._iDisplayStart === 0 ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
420 * buttons[0].className = "paginate_disabled_previous";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
421 * buttons[1].className = "paginate_disabled_previous";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
422 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
423 * else {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
424 * buttons[0].className = "paginate_enabled_previous";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
425 * buttons[1].className = "paginate_enabled_previous";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
426 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
427 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
428 * if ( oSettings.fnDisplayEnd() == oSettings.fnRecordsDisplay() ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
429 * buttons[2].className = "paginate_disabled_next";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
430 * buttons[3].className = "paginate_disabled_next";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
431 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
432 * else {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
433 * buttons[2].className = "paginate_enabled_next";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
434 * buttons[3].className = "paginate_enabled_next";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
435 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
436 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
437 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
438 * };
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
439 */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
440 "oPagination": {},
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
441
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
442
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
443 /**
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
444 * Sorting plug-in methods - Sorting in DataTables is based on the detected type of the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
445 * data column (you can add your own type detection functions, or override automatic
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
446 * detection using sType). With this specific type given to the column, DataTables will
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
447 * apply the required sort from the functions in the object. Each sort type must provide
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
448 * two mandatory methods, one each for ascending and descending sorting, and can optionally
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
449 * provide a pre-formatting method that will help speed up sorting by allowing DataTables
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
450 * to pre-format the sort data only once (rather than every time the actual sort functions
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
451 * are run). The two sorting functions are typical Javascript sort methods:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
452 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
453 * <li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
454 * Function input parameters:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
455 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
456 * <li>{*} Data to compare to the second parameter</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
457 * <li>{*} Data to compare to the first parameter</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
458 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
459 * </li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
460 * <li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
461 * Function return:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
462 * <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
463 * <li>{int} Sorting match: <0 if first parameter should be sorted lower than
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
464 * the second parameter, ===0 if the two parameters are equal and >0 if
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
465 * the first parameter should be sorted height than the second parameter.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
466 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
467 * </il>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
468 * </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
469 * @type object
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
470 * @default {}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
471 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
472 * @example
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
473 * // Case-sensitive string sorting, with no pre-formatting method
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
474 * $.extend( $.fn.dataTableExt.oSort, {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
475 * "string-case-asc": function(x,y) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
476 * return ((x < y) ? -1 : ((x > y) ? 1 : 0));
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
477 * },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
478 * "string-case-desc": function(x,y) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
479 * return ((x < y) ? 1 : ((x > y) ? -1 : 0));
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
480 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
481 * } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
482 *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
483 * @example
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
484 * // Case-insensitive string sorting, with pre-formatting
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
485 * $.extend( $.fn.dataTableExt.oSort, {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
486 * "string-pre": function(x) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
487 * return x.toLowerCase();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
488 * },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
489 * "string-asc": function(x,y) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
490 * return ((x < y) ? -1 : ((x > y) ? 1 : 0));
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
491 * },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
492 * "string-desc": function(x,y) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
493 * return ((x < y) ? 1 : ((x > y) ? -1 : 0));
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
494 * }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
495 * } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
496 */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
497 "oSort": {},
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
498
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
499
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
500 /**
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
501 * Version string for plug-ins to check compatibility. Allowed format is
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
502 * a.b.c.d.e where: a:int, b:int, c:int, d:string(dev|beta), e:int. d and
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
503 * e are optional
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
504 * @type string
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
505 * @default Version number
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
506 */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
507 "sVersion": DataTable.version,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
508
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
509
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
510 /**
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
511 * How should DataTables report an error. Can take the value 'alert' or 'throw'
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
512 * @type string
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
513 * @default alert
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
514 */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
515 "sErrMode": "alert",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
516
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
517
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
518 /**
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
519 * Store information for DataTables to access globally about other instances
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
520 * @namespace
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
521 * @private
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
522 */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
523 "_oExternConfig": {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
524 /* int:iNextUnique - next unique number for an instance */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
525 "iNextUnique": 0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
526 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
527 };
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
528