Revision 62c5d012
Added by Andreas Kohlbecker about 10 years ago
.gitattributes | ||
---|---|---|
914 | 914 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/images/sort_desc_disabled.png -text svneol=unset#unset |
915 | 915 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/js/jquery.dataTables.js -text |
916 | 916 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/js/jquery.dataTables.min.js -text |
917 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/DataTables.js -text |
|
918 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/api/api.internal.js -text |
|
919 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/api/api.methods.js -text |
|
920 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/api/api.static.js -text |
|
921 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/core/core.ajax.js -text |
|
922 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/core/core.columns.js -text |
|
923 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/core/core.constructor.js -text |
|
924 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/core/core.data.js -text |
|
925 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/core/core.draw.js -text |
|
926 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/core/core.filter.js -text |
|
927 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/core/core.info.js -text |
|
928 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/core/core.init.js -text |
|
929 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/core/core.length.js -text |
|
930 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/core/core.page.js -text |
|
931 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/core/core.processing.js -text |
|
932 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/core/core.scrolling.js -text |
|
933 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/core/core.sizing.js -text |
|
934 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/core/core.sort.js -text |
|
935 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/core/core.state.js -text |
|
936 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/core/core.support.js -text |
|
937 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/ext/ext.classes.js -text |
|
938 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/ext/ext.paging.js -text |
|
939 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/ext/ext.sorting.js -text |
|
940 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/ext/ext.types.js -text |
|
941 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/model/model.column.js -text |
|
942 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/model/model.defaults.columns.js -text |
|
943 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/model/model.defaults.js -text |
|
944 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/model/model.ext.js -text |
|
945 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/model/model.row.js -text |
|
946 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/model/model.search.js -text |
|
947 |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/model/model.settings.js -text |
|
948 | 917 |
7.x/modules/cdm_dataportal/js/OpenLayers-2.11/OpenLayers.js -text |
949 | 918 |
7.x/modules/cdm_dataportal/js/OpenLayers-2.11/img/blank.gif -text |
950 | 919 |
7.x/modules/cdm_dataportal/js/OpenLayers-2.11/img/cloud-popup-relative.png -text svneol=unset#unset |
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/DataTables.js | ||
---|---|---|
1 |
/** |
|
2 |
* @summary DataTables |
|
3 |
* @description Paginate, search and sort HTML tables |
|
4 |
* @version 1.9.4 |
|
5 |
* @file jquery.dataTables.js |
|
6 |
* @author Allan Jardine (www.sprymedia.co.uk) |
|
7 |
* @contact www.sprymedia.co.uk/contact |
|
8 |
* |
|
9 |
* @copyright Copyright 2008-2012 Allan Jardine, all rights reserved. |
|
10 |
* |
|
11 |
* This source file is free software, under either the GPL v2 license or a |
|
12 |
* BSD style license, available at: |
|
13 |
* http://datatables.net/license_gpl2 |
|
14 |
* http://datatables.net/license_bsd |
|
15 |
* |
|
16 |
* This source file is distributed in the hope that it will be useful, but |
|
17 |
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
|
18 |
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. |
|
19 |
* |
|
20 |
* For details please refer to: http://www.datatables.net |
|
21 |
*/ |
|
22 |
|
|
23 |
/*jslint evil: true, undef: true, browser: true */ |
|
24 |
/*globals $, jQuery,define,_fnExternApiFunc,_fnInitialise,_fnInitComplete,_fnLanguageCompat,_fnAddColumn,_fnColumnOptions,_fnAddData,_fnCreateTr,_fnGatherData,_fnBuildHead,_fnDrawHead,_fnDraw,_fnReDraw,_fnAjaxUpdate,_fnAjaxParameters,_fnAjaxUpdateDraw,_fnServerParams,_fnAddOptionsHtml,_fnFeatureHtmlTable,_fnScrollDraw,_fnAdjustColumnSizing,_fnFeatureHtmlFilter,_fnFilterComplete,_fnFilterCustom,_fnFilterColumn,_fnFilter,_fnBuildSearchArray,_fnBuildSearchRow,_fnFilterCreateSearch,_fnDataToSearch,_fnSort,_fnSortAttachListener,_fnSortingClasses,_fnFeatureHtmlPaginate,_fnPageChange,_fnFeatureHtmlInfo,_fnUpdateInfo,_fnFeatureHtmlLength,_fnFeatureHtmlProcessing,_fnProcessingDisplay,_fnVisibleToColumnIndex,_fnColumnIndexToVisible,_fnNodeToDataIndex,_fnVisbleColumns,_fnCalculateEnd,_fnConvertToWidth,_fnCalculateColumnWidths,_fnScrollingWidthAdjust,_fnGetWidestNode,_fnGetMaxLenString,_fnStringToCss,_fnDetectType,_fnSettingsFromNode,_fnGetDataMaster,_fnGetTrNodes,_fnGetTdNodes,_fnEscapeRegex,_fnDeleteIndex,_fnReOrderIndex,_fnColumnOrdering,_fnLog,_fnClearTable,_fnSaveState,_fnLoadState,_fnCreateCookie,_fnReadCookie,_fnDetectHeader,_fnGetUniqueThs,_fnScrollBarWidth,_fnApplyToChildren,_fnMap,_fnGetRowData,_fnGetCellData,_fnSetCellData,_fnGetObjectDataFn,_fnSetObjectDataFn,_fnApplyColumnDefs,_fnBindAction,_fnCallbackReg,_fnCallbackFire,_fnJsonString,_fnRender,_fnNodeToColumnIndex,_fnInfoMacros,_fnBrowserDetect,_fnGetColumns*/ |
|
25 |
|
|
26 |
(/** @lends <global> */function( window, document, undefined ) { |
|
27 |
|
|
28 |
(function( factory ) { |
|
29 |
"use strict"; |
|
30 |
|
|
31 |
// Define as an AMD module if possible |
|
32 |
if ( typeof define === 'function' && define.amd ) |
|
33 |
{ |
|
34 |
define( ['jquery'], factory ); |
|
35 |
} |
|
36 |
/* Define using browser globals otherwise |
|
37 |
* Prevent multiple instantiations if the script is loaded twice |
|
38 |
*/ |
|
39 |
else if ( jQuery && !jQuery.fn.dataTable ) |
|
40 |
{ |
|
41 |
factory( jQuery ); |
|
42 |
} |
|
43 |
} |
|
44 |
(/** @lends <global> */function( $ ) { |
|
45 |
"use strict"; |
|
46 |
/** |
|
47 |
* DataTables is a plug-in for the jQuery Javascript library. It is a |
|
48 |
* highly flexible tool, based upon the foundations of progressive |
|
49 |
* enhancement, which will add advanced interaction controls to any |
|
50 |
* HTML table. For a full list of features please refer to |
|
51 |
* <a href="http://datatables.net">DataTables.net</a>. |
|
52 |
* |
|
53 |
* Note that the <i>DataTable</i> object is not a global variable but is |
|
54 |
* aliased to <i>jQuery.fn.DataTable</i> and <i>jQuery.fn.dataTable</i> through which |
|
55 |
* it may be accessed. |
|
56 |
* |
|
57 |
* @class |
|
58 |
* @param {object} [oInit={}] Configuration object for DataTables. Options |
|
59 |
* are defined by {@link DataTable.defaults} |
|
60 |
* @requires jQuery 1.3+ |
|
61 |
* |
|
62 |
* @example |
|
63 |
* // Basic initialisation |
|
64 |
* $(document).ready( function { |
|
65 |
* $('#example').dataTable(); |
|
66 |
* } ); |
|
67 |
* |
|
68 |
* @example |
|
69 |
* // Initialisation with configuration options - in this case, disable |
|
70 |
* // pagination and sorting. |
|
71 |
* $(document).ready( function { |
|
72 |
* $('#example').dataTable( { |
|
73 |
* "bPaginate": false, |
|
74 |
* "bSort": false |
|
75 |
* } ); |
|
76 |
* } ); |
|
77 |
*/ |
|
78 |
var DataTable = function( oInit ) |
|
79 |
{ |
|
80 |
require('core.columns.js'); |
|
81 |
require('core.data.js'); |
|
82 |
require('core.draw.js'); |
|
83 |
require('core.ajax.js'); |
|
84 |
require('core.filter.js'); |
|
85 |
require('core.info.js'); |
|
86 |
require('core.init.js'); |
|
87 |
require('core.length.js'); |
|
88 |
require('core.page.js'); |
|
89 |
require('core.processing.js'); |
|
90 |
require('core.scrolling.js'); |
|
91 |
require('core.sizing.js'); |
|
92 |
require('core.sort.js'); |
|
93 |
require('core.state.js'); |
|
94 |
require('core.support.js'); |
|
95 |
|
|
96 |
require('api.methods.js'); |
|
97 |
require('api.internal.js'); |
|
98 |
|
|
99 |
var _that = this; |
|
100 |
this.each(function() { |
|
101 |
require('core.constructor.js'); |
|
102 |
} ); |
|
103 |
_that = null; |
|
104 |
return this; |
|
105 |
}; |
|
106 |
|
|
107 |
require('api.static.js'); |
|
108 |
|
|
109 |
/** |
|
110 |
* Version string for plug-ins to check compatibility. Allowed format is |
|
111 |
* a.b.c.d.e where: a:int, b:int, c:int, d:string(dev|beta), e:int. d and |
|
112 |
* e are optional |
|
113 |
* @member |
|
114 |
* @type string |
|
115 |
* @default Version number |
|
116 |
*/ |
|
117 |
DataTable.version = "1.9.4"; |
|
118 |
|
|
119 |
/** |
|
120 |
* Private data store, containing all of the settings objects that are created for the |
|
121 |
* tables on a given page. |
|
122 |
* |
|
123 |
* Note that the <i>DataTable.settings</i> object is aliased to <i>jQuery.fn.dataTableExt</i> |
|
124 |
* through which it may be accessed and manipulated, or <i>jQuery.fn.dataTable.settings</i>. |
|
125 |
* @member |
|
126 |
* @type array |
|
127 |
* @default [] |
|
128 |
* @private |
|
129 |
*/ |
|
130 |
DataTable.settings = []; |
|
131 |
|
|
132 |
/** |
|
133 |
* Object models container, for the various models that DataTables has available |
|
134 |
* to it. These models define the objects that are used to hold the active state |
|
135 |
* and configuration of the table. |
|
136 |
* @namespace |
|
137 |
*/ |
|
138 |
DataTable.models = {}; |
|
139 |
require('model.ext.js'); |
|
140 |
require('model.search.js'); |
|
141 |
require('model.row.js'); |
|
142 |
require('model.column.js'); |
|
143 |
require('model.defaults.js'); |
|
144 |
require('model.defaults.columns.js'); |
|
145 |
require('model.settings.js'); |
|
146 |
|
|
147 |
/** |
|
148 |
* Extension object for DataTables that is used to provide all extension options. |
|
149 |
* |
|
150 |
* Note that the <i>DataTable.ext</i> object is available through |
|
151 |
* <i>jQuery.fn.dataTable.ext</i> where it may be accessed and manipulated. It is |
|
152 |
* also aliased to <i>jQuery.fn.dataTableExt</i> for historic reasons. |
|
153 |
* @namespace |
|
154 |
* @extends DataTable.models.ext |
|
155 |
*/ |
|
156 |
DataTable.ext = $.extend( true, {}, DataTable.models.ext ); |
|
157 |
require('ext.classes.js'); |
|
158 |
require('ext.paging.js'); |
|
159 |
require('ext.sorting.js'); |
|
160 |
require('ext.types.js'); |
|
161 |
|
|
162 |
// jQuery aliases |
|
163 |
$.fn.DataTable = DataTable; |
|
164 |
$.fn.dataTable = DataTable; |
|
165 |
$.fn.dataTableSettings = DataTable.settings; |
|
166 |
$.fn.dataTableExt = DataTable.ext; |
|
167 |
|
|
168 |
|
|
169 |
// Information about events fired by DataTables - for documentation. |
|
170 |
/** |
|
171 |
* Draw event, fired whenever the table is redrawn on the page, at the same point as |
|
172 |
* fnDrawCallback. This may be useful for binding events or performing calculations when |
|
173 |
* the table is altered at all. |
|
174 |
* @name DataTable#draw |
|
175 |
* @event |
|
176 |
* @param {event} e jQuery event object |
|
177 |
* @param {object} o DataTables settings object {@link DataTable.models.oSettings} |
|
178 |
*/ |
|
179 |
|
|
180 |
/** |
|
181 |
* Filter event, fired when the filtering applied to the table (using the build in global |
|
182 |
* global filter, or column filters) is altered. |
|
183 |
* @name DataTable#filter |
|
184 |
* @event |
|
185 |
* @param {event} e jQuery event object |
|
186 |
* @param {object} o DataTables settings object {@link DataTable.models.oSettings} |
|
187 |
*/ |
|
188 |
|
|
189 |
/** |
|
190 |
* Page change event, fired when the paging of the table is altered. |
|
191 |
* @name DataTable#page |
|
192 |
* @event |
|
193 |
* @param {event} e jQuery event object |
|
194 |
* @param {object} o DataTables settings object {@link DataTable.models.oSettings} |
|
195 |
*/ |
|
196 |
|
|
197 |
/** |
|
198 |
* Sort event, fired when the sorting applied to the table is altered. |
|
199 |
* @name DataTable#sort |
|
200 |
* @event |
|
201 |
* @param {event} e jQuery event object |
|
202 |
* @param {object} o DataTables settings object {@link DataTable.models.oSettings} |
|
203 |
*/ |
|
204 |
|
|
205 |
/** |
|
206 |
* DataTables initialisation complete event, fired when the table is fully drawn, |
|
207 |
* including Ajax data loaded, if Ajax data is required. |
|
208 |
* @name DataTable#init |
|
209 |
* @event |
|
210 |
* @param {event} e jQuery event object |
|
211 |
* @param {object} oSettings DataTables settings object |
|
212 |
* @param {object} json The JSON object request from the server - only |
|
213 |
* present if client-side Ajax sourced data is used</li></ol> |
|
214 |
*/ |
|
215 |
|
|
216 |
/** |
|
217 |
* State save event, fired when the table has changed state a new state save is required. |
|
218 |
* This method allows modification of the state saving object prior to actually doing the |
|
219 |
* save, including addition or other state properties (for plug-ins) or modification |
|
220 |
* of a DataTables core property. |
|
221 |
* @name DataTable#stateSaveParams |
|
222 |
* @event |
|
223 |
* @param {event} e jQuery event object |
|
224 |
* @param {object} oSettings DataTables settings object |
|
225 |
* @param {object} json The state information to be saved |
|
226 |
*/ |
|
227 |
|
|
228 |
/** |
|
229 |
* State load event, fired when the table is loading state from the stored data, but |
|
230 |
* prior to the settings object being modified by the saved state - allowing modification |
|
231 |
* of the saved state is required or loading of state for a plug-in. |
|
232 |
* @name DataTable#stateLoadParams |
|
233 |
* @event |
|
234 |
* @param {event} e jQuery event object |
|
235 |
* @param {object} oSettings DataTables settings object |
|
236 |
* @param {object} json The saved state information |
|
237 |
*/ |
|
238 |
|
|
239 |
/** |
|
240 |
* State loaded event, fired when state has been loaded from stored data and the settings |
|
241 |
* object has been modified by the loaded data. |
|
242 |
* @name DataTable#stateLoaded |
|
243 |
* @event |
|
244 |
* @param {event} e jQuery event object |
|
245 |
* @param {object} oSettings DataTables settings object |
|
246 |
* @param {object} json The saved state information |
|
247 |
*/ |
|
248 |
|
|
249 |
/** |
|
250 |
* Processing event, fired when DataTables is doing some kind of processing (be it, |
|
251 |
* sort, filter or anything else). Can be used to indicate to the end user that |
|
252 |
* there is something happening, or that something has finished. |
|
253 |
* @name DataTable#processing |
|
254 |
* @event |
|
255 |
* @param {event} e jQuery event object |
|
256 |
* @param {object} oSettings DataTables settings object |
|
257 |
* @param {boolean} bShow Flag for if DataTables is doing processing or not |
|
258 |
*/ |
|
259 |
|
|
260 |
/** |
|
261 |
* Ajax (XHR) event, fired whenever an Ajax request is completed from a request to |
|
262 |
* made to the server for new data (note that this trigger is called in fnServerData, |
|
263 |
* if you override fnServerData and which to use this event, you need to trigger it in |
|
264 |
* you success function). |
|
265 |
* @name DataTable#xhr |
|
266 |
* @event |
|
267 |
* @param {event} e jQuery event object |
|
268 |
* @param {object} o DataTables settings object {@link DataTable.models.oSettings} |
|
269 |
* @param {object} json JSON returned from the server |
|
270 |
*/ |
|
271 |
|
|
272 |
/** |
|
273 |
* Destroy event, fired when the DataTable is destroyed by calling fnDestroy or passing |
|
274 |
* the bDestroy:true parameter in the initialisation object. This can be used to remove |
|
275 |
* bound events, added DOM nodes, etc. |
|
276 |
* @name DataTable#destroy |
|
277 |
* @event |
|
278 |
* @param {event} e jQuery event object |
|
279 |
* @param {object} o DataTables settings object {@link DataTable.models.oSettings} |
|
280 |
*/ |
|
281 |
})); |
|
282 |
|
|
283 |
}(window, document)); |
|
284 |
|
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/api/api.internal.js | ||
---|---|---|
1 |
|
|
2 |
/* |
|
3 |
* This is really a good bit rubbish this method of exposing the internal methods |
|
4 |
* publicly... - To be fixed in 2.0 using methods on the prototype |
|
5 |
*/ |
|
6 |
|
|
7 |
|
|
8 |
/** |
|
9 |
* Create a wrapper function for exporting an internal functions to an external API. |
|
10 |
* @param {string} sFunc API function name |
|
11 |
* @returns {function} wrapped function |
|
12 |
* @memberof DataTable#oApi |
|
13 |
*/ |
|
14 |
function _fnExternApiFunc (sFunc) |
|
15 |
{ |
|
16 |
return function() { |
|
17 |
var aArgs = [_fnSettingsFromNode(this[DataTable.ext.iApiIndex])].concat( |
|
18 |
Array.prototype.slice.call(arguments) ); |
|
19 |
return DataTable.ext.oApi[sFunc].apply( this, aArgs ); |
|
20 |
}; |
|
21 |
} |
|
22 |
|
|
23 |
|
|
24 |
/** |
|
25 |
* Reference to internal functions for use by plug-in developers. Note that these |
|
26 |
* methods are references to internal functions and are considered to be private. |
|
27 |
* If you use these methods, be aware that they are liable to change between versions |
|
28 |
* (check the upgrade notes). |
|
29 |
* @namespace |
|
30 |
*/ |
|
31 |
this.oApi = { |
|
32 |
"_fnExternApiFunc": _fnExternApiFunc, |
|
33 |
"_fnInitialise": _fnInitialise, |
|
34 |
"_fnInitComplete": _fnInitComplete, |
|
35 |
"_fnLanguageCompat": _fnLanguageCompat, |
|
36 |
"_fnAddColumn": _fnAddColumn, |
|
37 |
"_fnColumnOptions": _fnColumnOptions, |
|
38 |
"_fnAddData": _fnAddData, |
|
39 |
"_fnCreateTr": _fnCreateTr, |
|
40 |
"_fnGatherData": _fnGatherData, |
|
41 |
"_fnBuildHead": _fnBuildHead, |
|
42 |
"_fnDrawHead": _fnDrawHead, |
|
43 |
"_fnDraw": _fnDraw, |
|
44 |
"_fnReDraw": _fnReDraw, |
|
45 |
"_fnAjaxUpdate": _fnAjaxUpdate, |
|
46 |
"_fnAjaxParameters": _fnAjaxParameters, |
|
47 |
"_fnAjaxUpdateDraw": _fnAjaxUpdateDraw, |
|
48 |
"_fnServerParams": _fnServerParams, |
|
49 |
"_fnAddOptionsHtml": _fnAddOptionsHtml, |
|
50 |
"_fnFeatureHtmlTable": _fnFeatureHtmlTable, |
|
51 |
"_fnScrollDraw": _fnScrollDraw, |
|
52 |
"_fnAdjustColumnSizing": _fnAdjustColumnSizing, |
|
53 |
"_fnFeatureHtmlFilter": _fnFeatureHtmlFilter, |
|
54 |
"_fnFilterComplete": _fnFilterComplete, |
|
55 |
"_fnFilterCustom": _fnFilterCustom, |
|
56 |
"_fnFilterColumn": _fnFilterColumn, |
|
57 |
"_fnFilter": _fnFilter, |
|
58 |
"_fnBuildSearchArray": _fnBuildSearchArray, |
|
59 |
"_fnBuildSearchRow": _fnBuildSearchRow, |
|
60 |
"_fnFilterCreateSearch": _fnFilterCreateSearch, |
|
61 |
"_fnDataToSearch": _fnDataToSearch, |
|
62 |
"_fnSort": _fnSort, |
|
63 |
"_fnSortAttachListener": _fnSortAttachListener, |
|
64 |
"_fnSortingClasses": _fnSortingClasses, |
|
65 |
"_fnFeatureHtmlPaginate": _fnFeatureHtmlPaginate, |
|
66 |
"_fnPageChange": _fnPageChange, |
|
67 |
"_fnFeatureHtmlInfo": _fnFeatureHtmlInfo, |
|
68 |
"_fnUpdateInfo": _fnUpdateInfo, |
|
69 |
"_fnFeatureHtmlLength": _fnFeatureHtmlLength, |
|
70 |
"_fnFeatureHtmlProcessing": _fnFeatureHtmlProcessing, |
|
71 |
"_fnProcessingDisplay": _fnProcessingDisplay, |
|
72 |
"_fnVisibleToColumnIndex": _fnVisibleToColumnIndex, |
|
73 |
"_fnColumnIndexToVisible": _fnColumnIndexToVisible, |
|
74 |
"_fnNodeToDataIndex": _fnNodeToDataIndex, |
|
75 |
"_fnVisbleColumns": _fnVisbleColumns, |
|
76 |
"_fnCalculateEnd": _fnCalculateEnd, |
|
77 |
"_fnConvertToWidth": _fnConvertToWidth, |
|
78 |
"_fnCalculateColumnWidths": _fnCalculateColumnWidths, |
|
79 |
"_fnScrollingWidthAdjust": _fnScrollingWidthAdjust, |
|
80 |
"_fnGetWidestNode": _fnGetWidestNode, |
|
81 |
"_fnGetMaxLenString": _fnGetMaxLenString, |
|
82 |
"_fnStringToCss": _fnStringToCss, |
|
83 |
"_fnDetectType": _fnDetectType, |
|
84 |
"_fnSettingsFromNode": _fnSettingsFromNode, |
|
85 |
"_fnGetDataMaster": _fnGetDataMaster, |
|
86 |
"_fnGetTrNodes": _fnGetTrNodes, |
|
87 |
"_fnGetTdNodes": _fnGetTdNodes, |
|
88 |
"_fnEscapeRegex": _fnEscapeRegex, |
|
89 |
"_fnDeleteIndex": _fnDeleteIndex, |
|
90 |
"_fnReOrderIndex": _fnReOrderIndex, |
|
91 |
"_fnColumnOrdering": _fnColumnOrdering, |
|
92 |
"_fnLog": _fnLog, |
|
93 |
"_fnClearTable": _fnClearTable, |
|
94 |
"_fnSaveState": _fnSaveState, |
|
95 |
"_fnLoadState": _fnLoadState, |
|
96 |
"_fnCreateCookie": _fnCreateCookie, |
|
97 |
"_fnReadCookie": _fnReadCookie, |
|
98 |
"_fnDetectHeader": _fnDetectHeader, |
|
99 |
"_fnGetUniqueThs": _fnGetUniqueThs, |
|
100 |
"_fnScrollBarWidth": _fnScrollBarWidth, |
|
101 |
"_fnApplyToChildren": _fnApplyToChildren, |
|
102 |
"_fnMap": _fnMap, |
|
103 |
"_fnGetRowData": _fnGetRowData, |
|
104 |
"_fnGetCellData": _fnGetCellData, |
|
105 |
"_fnSetCellData": _fnSetCellData, |
|
106 |
"_fnGetObjectDataFn": _fnGetObjectDataFn, |
|
107 |
"_fnSetObjectDataFn": _fnSetObjectDataFn, |
|
108 |
"_fnApplyColumnDefs": _fnApplyColumnDefs, |
|
109 |
"_fnBindAction": _fnBindAction, |
|
110 |
"_fnExtend": _fnExtend, |
|
111 |
"_fnCallbackReg": _fnCallbackReg, |
|
112 |
"_fnCallbackFire": _fnCallbackFire, |
|
113 |
"_fnJsonString": _fnJsonString, |
|
114 |
"_fnRender": _fnRender, |
|
115 |
"_fnNodeToColumnIndex": _fnNodeToColumnIndex, |
|
116 |
"_fnInfoMacros": _fnInfoMacros, |
|
117 |
"_fnBrowserDetect": _fnBrowserDetect, |
|
118 |
"_fnGetColumns": _fnGetColumns |
|
119 |
}; |
|
120 |
|
|
121 |
$.extend( DataTable.ext.oApi, this.oApi ); |
|
122 |
|
|
123 |
for ( var sFunc in DataTable.ext.oApi ) |
|
124 |
{ |
|
125 |
if ( sFunc ) |
|
126 |
{ |
|
127 |
this[sFunc] = _fnExternApiFunc(sFunc); |
|
128 |
} |
|
129 |
} |
|
130 |
|
7.x/modules/cdm_dataportal/js/DataTables-1.9.4/media/src/api/api.methods.js | ||
---|---|---|
1 |
/** |
|
2 |
* Perform a jQuery selector action on the table's TR elements (from the tbody) and |
|
3 |
* return the resulting jQuery object. |
|
4 |
* @param {string|node|jQuery} sSelector jQuery selector or node collection to act on |
|
5 |
* @param {object} [oOpts] Optional parameters for modifying the rows to be included |
|
6 |
* @param {string} [oOpts.filter=none] Select TR elements that meet the current filter |
|
7 |
* criterion ("applied") or all TR elements (i.e. no filter). |
|
8 |
* @param {string} [oOpts.order=current] Order of the TR elements in the processed array. |
|
9 |
* Can be either 'current', whereby the current sorting of the table is used, or |
|
10 |
* 'original' whereby the original order the data was read into the table is used. |
|
11 |
* @param {string} [oOpts.page=all] Limit the selection to the currently displayed page |
|
12 |
* ("current") or not ("all"). If 'current' is given, then order is assumed to be |
|
13 |
* 'current' and filter is 'applied', regardless of what they might be given as. |
|
14 |
* @returns {object} jQuery object, filtered by the given selector. |
|
15 |
* @dtopt API |
|
16 |
* |
|
17 |
* @example |
|
18 |
* $(document).ready(function() { |
|
19 |
* var oTable = $('#example').dataTable(); |
|
20 |
* |
|
21 |
* // Highlight every second row |
|
22 |
* oTable.$('tr:odd').css('backgroundColor', 'blue'); |
|
23 |
* } ); |
|
24 |
* |
|
25 |
* @example |
|
26 |
* $(document).ready(function() { |
|
27 |
* var oTable = $('#example').dataTable(); |
|
28 |
* |
|
29 |
* // Filter to rows with 'Webkit' in them, add a background colour and then |
|
30 |
* // remove the filter, thus highlighting the 'Webkit' rows only. |
|
31 |
* oTable.fnFilter('Webkit'); |
|
32 |
* oTable.$('tr', {"filter": "applied"}).css('backgroundColor', 'blue'); |
|
33 |
* oTable.fnFilter(''); |
|
34 |
* } ); |
|
35 |
*/ |
|
36 |
this.$ = function ( sSelector, oOpts ) |
|
37 |
{ |
|
38 |
var i, iLen, a = [], tr; |
|
39 |
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] ); |
|
40 |
var aoData = oSettings.aoData; |
|
41 |
var aiDisplay = oSettings.aiDisplay; |
|
42 |
var aiDisplayMaster = oSettings.aiDisplayMaster; |
|
43 |
|
|
44 |
if ( !oOpts ) |
|
45 |
{ |
|
46 |
oOpts = {}; |
|
47 |
} |
|
48 |
|
|
49 |
oOpts = $.extend( {}, { |
|
50 |
"filter": "none", // applied |
|
51 |
"order": "current", // "original" |
|
52 |
"page": "all" // current |
|
53 |
}, oOpts ); |
|
54 |
|
|
55 |
// Current page implies that order=current and fitler=applied, since it is fairly |
|
56 |
// senseless otherwise |
|
57 |
if ( oOpts.page == 'current' ) |
|
58 |
{ |
|
59 |
for ( i=oSettings._iDisplayStart, iLen=oSettings.fnDisplayEnd() ; i<iLen ; i++ ) |
|
60 |
{ |
|
61 |
tr = aoData[ aiDisplay[i] ].nTr; |
|
62 |
if ( tr ) |
|
63 |
{ |
|
64 |
a.push( tr ); |
|
65 |
} |
|
66 |
} |
|
67 |
} |
|
68 |
else if ( oOpts.order == "current" && oOpts.filter == "none" ) |
|
69 |
{ |
|
70 |
for ( i=0, iLen=aiDisplayMaster.length ; i<iLen ; i++ ) |
|
71 |
{ |
|
72 |
tr = aoData[ aiDisplayMaster[i] ].nTr; |
|
73 |
if ( tr ) |
|
74 |
{ |
|
75 |
a.push( tr ); |
|
76 |
} |
|
77 |
} |
|
78 |
} |
|
79 |
else if ( oOpts.order == "current" && oOpts.filter == "applied" ) |
|
80 |
{ |
|
81 |
for ( i=0, iLen=aiDisplay.length ; i<iLen ; i++ ) |
|
82 |
{ |
|
83 |
tr = aoData[ aiDisplay[i] ].nTr; |
|
84 |
if ( tr ) |
|
85 |
{ |
|
86 |
a.push( tr ); |
|
87 |
} |
|
88 |
} |
|
89 |
} |
|
90 |
else if ( oOpts.order == "original" && oOpts.filter == "none" ) |
|
91 |
{ |
|
92 |
for ( i=0, iLen=aoData.length ; i<iLen ; i++ ) |
|
93 |
{ |
|
94 |
tr = aoData[ i ].nTr ; |
|
95 |
if ( tr ) |
|
96 |
{ |
|
97 |
a.push( tr ); |
|
98 |
} |
|
99 |
} |
|
100 |
} |
|
101 |
else if ( oOpts.order == "original" && oOpts.filter == "applied" ) |
|
102 |
{ |
|
103 |
for ( i=0, iLen=aoData.length ; i<iLen ; i++ ) |
|
104 |
{ |
|
105 |
tr = aoData[ i ].nTr; |
|
106 |
if ( $.inArray( i, aiDisplay ) !== -1 && tr ) |
|
107 |
{ |
|
108 |
a.push( tr ); |
|
109 |
} |
|
110 |
} |
|
111 |
} |
|
112 |
else |
|
113 |
{ |
|
114 |
_fnLog( oSettings, 1, "Unknown selection options" ); |
|
115 |
} |
|
116 |
|
|
117 |
/* We need to filter on the TR elements and also 'find' in their descendants |
|
118 |
* to make the selector act like it would in a full table - so we need |
|
119 |
* to build both results and then combine them together |
|
120 |
*/ |
|
121 |
var jqA = $(a); |
|
122 |
var jqTRs = jqA.filter( sSelector ); |
|
123 |
var jqDescendants = jqA.find( sSelector ); |
|
124 |
|
|
125 |
return $( [].concat($.makeArray(jqTRs), $.makeArray(jqDescendants)) ); |
|
126 |
}; |
|
127 |
|
|
128 |
|
|
129 |
/** |
|
130 |
* Almost identical to $ in operation, but in this case returns the data for the matched |
|
131 |
* rows - as such, the jQuery selector used should match TR row nodes or TD/TH cell nodes |
|
132 |
* rather than any descendants, so the data can be obtained for the row/cell. If matching |
|
133 |
* rows are found, the data returned is the original data array/object that was used to |
|
134 |
* create the row (or a generated array if from a DOM source). |
|
135 |
* |
|
136 |
* This method is often useful in-combination with $ where both functions are given the |
|
137 |
* same parameters and the array indexes will match identically. |
|
138 |
* @param {string|node|jQuery} sSelector jQuery selector or node collection to act on |
|
139 |
* @param {object} [oOpts] Optional parameters for modifying the rows to be included |
|
140 |
* @param {string} [oOpts.filter=none] Select elements that meet the current filter |
|
141 |
* criterion ("applied") or all elements (i.e. no filter). |
|
142 |
* @param {string} [oOpts.order=current] Order of the data in the processed array. |
|
143 |
* Can be either 'current', whereby the current sorting of the table is used, or |
|
144 |
* 'original' whereby the original order the data was read into the table is used. |
|
145 |
* @param {string} [oOpts.page=all] Limit the selection to the currently displayed page |
|
146 |
* ("current") or not ("all"). If 'current' is given, then order is assumed to be |
|
147 |
* 'current' and filter is 'applied', regardless of what they might be given as. |
|
148 |
* @returns {array} Data for the matched elements. If any elements, as a result of the |
|
149 |
* selector, were not TR, TD or TH elements in the DataTable, they will have a null |
|
150 |
* entry in the array. |
|
151 |
* @dtopt API |
|
152 |
* |
|
153 |
* @example |
|
154 |
* $(document).ready(function() { |
|
155 |
* var oTable = $('#example').dataTable(); |
|
156 |
* |
|
157 |
* // Get the data from the first row in the table |
|
158 |
* var data = oTable._('tr:first'); |
|
159 |
* |
|
160 |
* // Do something useful with the data |
|
161 |
* alert( "First cell is: "+data[0] ); |
|
162 |
* } ); |
|
163 |
* |
|
164 |
* @example |
|
165 |
* $(document).ready(function() { |
|
166 |
* var oTable = $('#example').dataTable(); |
|
167 |
* |
|
168 |
* // Filter to 'Webkit' and get all data for |
|
169 |
* oTable.fnFilter('Webkit'); |
|
170 |
* var data = oTable._('tr', {"filter": "applied"}); |
|
171 |
* |
|
172 |
* // Do something with the data |
|
173 |
* alert( data.length+" rows matched the filter" ); |
|
174 |
* } ); |
|
175 |
*/ |
|
176 |
this._ = function ( sSelector, oOpts ) |
|
177 |
{ |
|
178 |
var aOut = []; |
|
179 |
var i, iLen, iIndex; |
|
180 |
var aTrs = this.$( sSelector, oOpts ); |
|
181 |
|
|
182 |
for ( i=0, iLen=aTrs.length ; i<iLen ; i++ ) |
|
183 |
{ |
|
184 |
aOut.push( this.fnGetData(aTrs[i]) ); |
|
185 |
} |
|
186 |
|
|
187 |
return aOut; |
|
188 |
}; |
|
189 |
|
|
190 |
|
|
191 |
/** |
|
192 |
* Add a single new row or multiple rows of data to the table. Please note |
|
193 |
* that this is suitable for client-side processing only - if you are using |
|
194 |
* server-side processing (i.e. "bServerSide": true), then to add data, you |
|
195 |
* must add it to the data source, i.e. the server-side, through an Ajax call. |
|
196 |
* @param {array|object} mData The data to be added to the table. This can be: |
|
197 |
* <ul> |
|
198 |
* <li>1D array of data - add a single row with the data provided</li> |
|
199 |
* <li>2D array of arrays - add multiple rows in a single call</li> |
|
200 |
* <li>object - data object when using <i>mData</i></li> |
|
201 |
* <li>array of objects - multiple data objects when using <i>mData</i></li> |
|
202 |
* </ul> |
|
203 |
* @param {bool} [bRedraw=true] redraw the table or not |
|
204 |
* @returns {array} An array of integers, representing the list of indexes in |
|
205 |
* <i>aoData</i> ({@link DataTable.models.oSettings}) that have been added to |
|
206 |
* the table. |
|
207 |
* @dtopt API |
|
208 |
* |
|
209 |
* @example |
|
210 |
* // Global var for counter |
|
211 |
* var giCount = 2; |
|
212 |
* |
|
213 |
* $(document).ready(function() { |
|
214 |
* $('#example').dataTable(); |
|
215 |
* } ); |
|
216 |
* |
|
217 |
* function fnClickAddRow() { |
|
218 |
* $('#example').dataTable().fnAddData( [ |
|
219 |
* giCount+".1", |
|
220 |
* giCount+".2", |
|
221 |
* giCount+".3", |
|
222 |
* giCount+".4" ] |
|
223 |
* ); |
|
224 |
* |
|
225 |
* giCount++; |
|
226 |
* } |
|
227 |
*/ |
|
228 |
this.fnAddData = function( mData, bRedraw ) |
|
229 |
{ |
|
230 |
if ( mData.length === 0 ) |
|
231 |
{ |
|
232 |
return []; |
|
233 |
} |
|
234 |
|
|
235 |
var aiReturn = []; |
|
236 |
var iTest; |
|
237 |
|
|
238 |
/* Find settings from table node */ |
|
239 |
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] ); |
|
240 |
|
|
241 |
/* Check if we want to add multiple rows or not */ |
|
242 |
if ( typeof mData[0] === "object" && mData[0] !== null ) |
|
243 |
{ |
|
244 |
for ( var i=0 ; i<mData.length ; i++ ) |
|
245 |
{ |
|
246 |
iTest = _fnAddData( oSettings, mData[i] ); |
|
247 |
if ( iTest == -1 ) |
|
248 |
{ |
|
249 |
return aiReturn; |
|
250 |
} |
|
251 |
aiReturn.push( iTest ); |
|
252 |
} |
|
253 |
} |
|
254 |
else |
|
255 |
{ |
|
256 |
iTest = _fnAddData( oSettings, mData ); |
|
257 |
if ( iTest == -1 ) |
|
258 |
{ |
|
259 |
return aiReturn; |
|
260 |
} |
|
261 |
aiReturn.push( iTest ); |
|
262 |
} |
|
263 |
|
|
264 |
oSettings.aiDisplay = oSettings.aiDisplayMaster.slice(); |
|
265 |
|
|
266 |
if ( bRedraw === undefined || bRedraw ) |
|
267 |
{ |
|
268 |
_fnReDraw( oSettings ); |
|
269 |
} |
|
270 |
return aiReturn; |
|
271 |
}; |
|
272 |
|
|
273 |
|
|
274 |
/** |
|
275 |
* This function will make DataTables recalculate the column sizes, based on the data |
|
276 |
* contained in the table and the sizes applied to the columns (in the DOM, CSS or |
|
277 |
* through the sWidth parameter). This can be useful when the width of the table's |
|
278 |
* parent element changes (for example a window resize). |
|
279 |
* @param {boolean} [bRedraw=true] Redraw the table or not, you will typically want to |
|
280 |
* @dtopt API |
|
281 |
* |
|
282 |
* @example |
|
283 |
* $(document).ready(function() { |
|
284 |
* var oTable = $('#example').dataTable( { |
|
285 |
* "sScrollY": "200px", |
|
286 |
* "bPaginate": false |
|
287 |
* } ); |
|
288 |
* |
|
289 |
* $(window).bind('resize', function () { |
|
290 |
* oTable.fnAdjustColumnSizing(); |
|
291 |
* } ); |
|
292 |
* } ); |
|
293 |
*/ |
|
294 |
this.fnAdjustColumnSizing = function ( bRedraw ) |
|
295 |
{ |
|
296 |
var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]); |
|
297 |
_fnAdjustColumnSizing( oSettings ); |
|
298 |
|
|
299 |
if ( bRedraw === undefined || bRedraw ) |
|
300 |
{ |
|
301 |
this.fnDraw( false ); |
|
302 |
} |
|
303 |
else if ( oSettings.oScroll.sX !== "" || oSettings.oScroll.sY !== "" ) |
|
304 |
{ |
|
305 |
/* If not redrawing, but scrolling, we want to apply the new column sizes anyway */ |
|
306 |
this.oApi._fnScrollDraw(oSettings); |
|
307 |
} |
|
308 |
}; |
|
309 |
|
|
310 |
|
|
311 |
/** |
|
312 |
* Quickly and simply clear a table |
|
313 |
* @param {bool} [bRedraw=true] redraw the table or not |
|
314 |
* @dtopt API |
|
315 |
* |
|
316 |
* @example |
|
317 |
* $(document).ready(function() { |
|
318 |
* var oTable = $('#example').dataTable(); |
|
319 |
* |
|
320 |
* // Immediately 'nuke' the current rows (perhaps waiting for an Ajax callback...) |
|
321 |
* oTable.fnClearTable(); |
|
322 |
* } ); |
|
323 |
*/ |
|
324 |
this.fnClearTable = function( bRedraw ) |
|
325 |
{ |
|
326 |
/* Find settings from table node */ |
|
327 |
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] ); |
|
328 |
_fnClearTable( oSettings ); |
|
329 |
|
|
330 |
if ( bRedraw === undefined || bRedraw ) |
|
331 |
{ |
|
332 |
_fnDraw( oSettings ); |
|
333 |
} |
|
334 |
}; |
|
335 |
|
|
336 |
|
|
337 |
/** |
|
338 |
* The exact opposite of 'opening' a row, this function will close any rows which |
|
339 |
* are currently 'open'. |
|
340 |
* @param {node} nTr the table row to 'close' |
|
341 |
* @returns {int} 0 on success, or 1 if failed (can't find the row) |
|
342 |
* @dtopt API |
|
343 |
* |
|
344 |
* @example |
|
345 |
* $(document).ready(function() { |
|
346 |
* var oTable; |
|
347 |
* |
|
348 |
* // 'open' an information row when a row is clicked on |
|
349 |
* $('#example tbody tr').click( function () { |
|
350 |
* if ( oTable.fnIsOpen(this) ) { |
|
351 |
* oTable.fnClose( this ); |
|
352 |
* } else { |
|
353 |
* oTable.fnOpen( this, "Temporary row opened", "info_row" ); |
|
354 |
* } |
|
355 |
* } ); |
|
356 |
* |
|
357 |
* oTable = $('#example').dataTable(); |
|
358 |
* } ); |
|
359 |
*/ |
|
360 |
this.fnClose = function( nTr ) |
|
361 |
{ |
|
362 |
/* Find settings from table node */ |
|
363 |
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] ); |
|
364 |
|
|
365 |
for ( var i=0 ; i<oSettings.aoOpenRows.length ; i++ ) |
|
366 |
{ |
|
367 |
if ( oSettings.aoOpenRows[i].nParent == nTr ) |
|
368 |
{ |
|
369 |
var nTrParent = oSettings.aoOpenRows[i].nTr.parentNode; |
|
370 |
if ( nTrParent ) |
|
371 |
{ |
|
372 |
/* Remove it if it is currently on display */ |
|
373 |
nTrParent.removeChild( oSettings.aoOpenRows[i].nTr ); |
|
374 |
} |
|
375 |
oSettings.aoOpenRows.splice( i, 1 ); |
|
376 |
return 0; |
|
377 |
} |
|
378 |
} |
|
379 |
return 1; |
|
380 |
}; |
|
381 |
|
|
382 |
|
|
383 |
/** |
|
384 |
* Remove a row for the table |
|
385 |
* @param {mixed} mTarget The index of the row from aoData to be deleted, or |
|
386 |
* the TR element you want to delete |
|
387 |
* @param {function|null} [fnCallBack] Callback function |
|
388 |
* @param {bool} [bRedraw=true] Redraw the table or not |
|
389 |
* @returns {array} The row that was deleted |
|
390 |
* @dtopt API |
|
391 |
* |
|
392 |
* @example |
|
393 |
* $(document).ready(function() { |
|
394 |
* var oTable = $('#example').dataTable(); |
|
395 |
* |
|
396 |
* // Immediately remove the first row |
|
397 |
* oTable.fnDeleteRow( 0 ); |
|
398 |
* } ); |
|
399 |
*/ |
|
400 |
this.fnDeleteRow = function( mTarget, fnCallBack, bRedraw ) |
|
401 |
{ |
|
402 |
/* Find settings from table node */ |
|
403 |
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] ); |
|
404 |
var i, iLen, iAODataIndex; |
|
405 |
|
|
406 |
iAODataIndex = (typeof mTarget === 'object') ? |
|
407 |
_fnNodeToDataIndex(oSettings, mTarget) : mTarget; |
|
408 |
|
|
409 |
/* Return the data array from this row */ |
|
410 |
var oData = oSettings.aoData.splice( iAODataIndex, 1 ); |
|
411 |
|
|
412 |
/* Update the _DT_RowIndex parameter */ |
|
413 |
for ( i=0, iLen=oSettings.aoData.length ; i<iLen ; i++ ) |
|
414 |
{ |
|
415 |
if ( oSettings.aoData[i].nTr !== null ) |
|
416 |
{ |
|
417 |
oSettings.aoData[i].nTr._DT_RowIndex = i; |
|
418 |
} |
|
419 |
} |
|
420 |
|
|
421 |
/* Remove the target row from the search array */ |
|
422 |
var iDisplayIndex = $.inArray( iAODataIndex, oSettings.aiDisplay ); |
|
423 |
oSettings.asDataSearch.splice( iDisplayIndex, 1 ); |
|
424 |
|
|
425 |
/* Delete from the display arrays */ |
|
426 |
_fnDeleteIndex( oSettings.aiDisplayMaster, iAODataIndex ); |
|
427 |
_fnDeleteIndex( oSettings.aiDisplay, iAODataIndex ); |
|
428 |
|
|
429 |
/* If there is a user callback function - call it */ |
|
430 |
if ( typeof fnCallBack === "function" ) |
|
431 |
{ |
|
432 |
fnCallBack.call( this, oSettings, oData ); |
|
433 |
} |
|
434 |
|
|
435 |
/* Check for an 'overflow' they case for displaying the table */ |
|
436 |
if ( oSettings._iDisplayStart >= oSettings.fnRecordsDisplay() ) |
|
437 |
{ |
|
438 |
oSettings._iDisplayStart -= oSettings._iDisplayLength; |
|
439 |
if ( oSettings._iDisplayStart < 0 ) |
|
440 |
{ |
|
441 |
oSettings._iDisplayStart = 0; |
|
442 |
} |
|
443 |
} |
|
444 |
|
|
445 |
if ( bRedraw === undefined || bRedraw ) |
|
446 |
{ |
|
447 |
_fnCalculateEnd( oSettings ); |
|
448 |
_fnDraw( oSettings ); |
|
449 |
} |
|
450 |
|
|
451 |
return oData; |
|
452 |
}; |
|
453 |
|
|
454 |
|
|
455 |
/** |
|
456 |
* Restore the table to it's original state in the DOM by removing all of DataTables |
|
457 |
* enhancements, alterations to the DOM structure of the table and event listeners. |
|
458 |
* @param {boolean} [bRemove=false] Completely remove the table from the DOM |
|
459 |
* @dtopt API |
|
460 |
* |
|
461 |
* @example |
|
462 |
* $(document).ready(function() { |
|
463 |
* // This example is fairly pointless in reality, but shows how fnDestroy can be used |
|
464 |
* var oTable = $('#example').dataTable(); |
|
465 |
* oTable.fnDestroy(); |
|
466 |
* } ); |
|
467 |
*/ |
|
468 |
this.fnDestroy = function ( bRemove ) |
|
469 |
{ |
|
470 |
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] ); |
|
471 |
var nOrig = oSettings.nTableWrapper.parentNode; |
|
472 |
var nBody = oSettings.nTBody; |
|
473 |
var i, iLen; |
|
474 |
|
|
475 |
bRemove = (bRemove===undefined) ? false : bRemove; |
|
476 |
|
|
477 |
/* Flag to note that the table is currently being destroyed - no action should be taken */ |
|
478 |
oSettings.bDestroying = true; |
|
479 |
|
|
480 |
/* Fire off the destroy callbacks for plug-ins etc */ |
|
481 |
_fnCallbackFire( oSettings, "aoDestroyCallback", "destroy", [oSettings] ); |
|
482 |
|
|
483 |
/* If the table is not being removed, restore the hidden columns */ |
|
484 |
if ( !bRemove ) |
|
485 |
{ |
|
486 |
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ ) |
|
487 |
{ |
|
488 |
if ( oSettings.aoColumns[i].bVisible === false ) |
|
489 |
{ |
|
490 |
this.fnSetColumnVis( i, true ); |
|
491 |
} |
|
492 |
} |
|
493 |
} |
|
494 |
|
|
495 |
/* Blitz all DT events */ |
|
496 |
$(oSettings.nTableWrapper).find('*').andSelf().unbind('.DT'); |
|
497 |
|
|
498 |
/* If there is an 'empty' indicator row, remove it */ |
|
499 |
$('tbody>tr>td.'+oSettings.oClasses.sRowEmpty, oSettings.nTable).parent().remove(); |
|
500 |
|
|
501 |
/* When scrolling we had to break the table up - restore it */ |
|
502 |
if ( oSettings.nTable != oSettings.nTHead.parentNode ) |
|
503 |
{ |
|
504 |
$(oSettings.nTable).children('thead').remove(); |
|
505 |
oSettings.nTable.appendChild( oSettings.nTHead ); |
|
506 |
} |
|
507 |
|
|
508 |
if ( oSettings.nTFoot && oSettings.nTable != oSettings.nTFoot.parentNode ) |
|
509 |
{ |
|
510 |
$(oSettings.nTable).children('tfoot').remove(); |
|
511 |
oSettings.nTable.appendChild( oSettings.nTFoot ); |
|
512 |
} |
|
513 |
|
|
514 |
/* Remove the DataTables generated nodes, events and classes */ |
|
515 |
oSettings.nTable.parentNode.removeChild( oSettings.nTable ); |
|
516 |
$(oSettings.nTableWrapper).remove(); |
|
517 |
|
|
518 |
oSettings.aaSorting = []; |
|
519 |
oSettings.aaSortingFixed = []; |
|
520 |
_fnSortingClasses( oSettings ); |
|
521 |
|
|
522 |
$(_fnGetTrNodes( oSettings )).removeClass( oSettings.asStripeClasses.join(' ') ); |
|
523 |
|
|
524 |
$('th, td', oSettings.nTHead).removeClass( [ |
|
525 |
oSettings.oClasses.sSortable, |
|
526 |
oSettings.oClasses.sSortableAsc, |
|
527 |
oSettings.oClasses.sSortableDesc, |
|
528 |
oSettings.oClasses.sSortableNone ].join(' ') |
|
529 |
); |
|
530 |
if ( oSettings.bJUI ) |
|
531 |
{ |
|
532 |
$('th span.'+oSettings.oClasses.sSortIcon |
|
533 |
+ ', td span.'+oSettings.oClasses.sSortIcon, oSettings.nTHead).remove(); |
|
534 |
|
|
535 |
$('th, td', oSettings.nTHead).each( function () { |
|
536 |
var jqWrapper = $('div.'+oSettings.oClasses.sSortJUIWrapper, this); |
|
537 |
var kids = jqWrapper.contents(); |
|
538 |
$(this).append( kids ); |
|
539 |
jqWrapper.remove(); |
|
540 |
} ); |
|
541 |
} |
|
542 |
|
|
543 |
/* Add the TR elements back into the table in their original order */ |
|
544 |
if ( !bRemove && oSettings.nTableReinsertBefore ) |
|
545 |
{ |
|
546 |
nOrig.insertBefore( oSettings.nTable, oSettings.nTableReinsertBefore ); |
|
547 |
} |
|
548 |
else if ( !bRemove ) |
|
549 |
{ |
|
550 |
nOrig.appendChild( oSettings.nTable ); |
|
551 |
} |
|
552 |
|
|
553 |
for ( i=0, iLen=oSettings.aoData.length ; i<iLen ; i++ ) |
|
554 |
{ |
|
555 |
if ( oSettings.aoData[i].nTr !== null ) |
|
556 |
{ |
|
557 |
nBody.appendChild( oSettings.aoData[i].nTr ); |
|
558 |
} |
|
559 |
} |
|
560 |
|
|
561 |
/* Restore the width of the original table */ |
|
562 |
if ( oSettings.oFeatures.bAutoWidth === true ) |
|
563 |
{ |
|
564 |
oSettings.nTable.style.width = _fnStringToCss(oSettings.sDestroyWidth); |
|
565 |
} |
|
566 |
|
|
567 |
/* If the were originally stripe classes - then we add them back here. Note |
|
568 |
* this is not fool proof (for example if not all rows had stripe classes - but |
|
569 |
* it's a good effort without getting carried away |
|
570 |
*/ |
|
571 |
iLen = oSettings.asDestroyStripes.length; |
|
572 |
if (iLen) |
|
573 |
{ |
|
574 |
var anRows = $(nBody).children('tr'); |
|
575 |
for ( i=0 ; i<iLen ; i++ ) |
|
576 |
{ |
|
577 |
anRows.filter(':nth-child(' + iLen + 'n + ' + i + ')').addClass( oSettings.asDestroyStripes[i] ); |
|
578 |
} |
|
579 |
} |
|
580 |
|
|
581 |
/* Remove the settings object from the settings array */ |
|
582 |
for ( i=0, iLen=DataTable.settings.length ; i<iLen ; i++ ) |
|
583 |
{ |
|
584 |
if ( DataTable.settings[i] == oSettings ) |
|
585 |
{ |
|
586 |
DataTable.settings.splice( i, 1 ); |
|
587 |
} |
|
588 |
} |
|
589 |
|
|
590 |
/* End it all */ |
|
591 |
oSettings = null; |
|
592 |
oInit = null; |
|
593 |
}; |
|
594 |
|
|
595 |
|
|
596 |
/** |
|
597 |
* Redraw the table |
|
598 |
* @param {bool} [bComplete=true] Re-filter and resort (if enabled) the table before the draw. |
|
599 |
* @dtopt API |
|
600 |
* |
|
601 |
* @example |
|
602 |
* $(document).ready(function() { |
|
603 |
* var oTable = $('#example').dataTable(); |
|
604 |
* |
|
605 |
* // Re-draw the table - you wouldn't want to do it here, but it's an example :-) |
|
606 |
* oTable.fnDraw(); |
|
607 |
* } ); |
|
608 |
*/ |
|
609 |
this.fnDraw = function( bComplete ) |
|
610 |
{ |
|
611 |
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] ); |
|
612 |
if ( bComplete === false ) |
|
613 |
{ |
|
614 |
_fnCalculateEnd( oSettings ); |
|
615 |
_fnDraw( oSettings ); |
|
616 |
} |
|
617 |
else |
|
618 |
{ |
|
619 |
_fnReDraw( oSettings ); |
|
620 |
} |
|
621 |
}; |
|
622 |
|
|
623 |
|
|
624 |
/** |
|
625 |
* Filter the input based on data |
|
626 |
* @param {string} sInput String to filter the table on |
|
627 |
* @param {int|null} [iColumn] Column to limit filtering to |
|
628 |
* @param {bool} [bRegex=false] Treat as regular expression or not |
|
629 |
* @param {bool} [bSmart=true] Perform smart filtering or not |
|
630 |
* @param {bool} [bShowGlobal=true] Show the input global filter in it's input box(es) |
|
631 |
* @param {bool} [bCaseInsensitive=true] Do case-insensitive matching (true) or not (false) |
|
632 |
* @dtopt API |
|
633 |
* |
|
634 |
* @example |
|
635 |
* $(document).ready(function() { |
|
636 |
* var oTable = $('#example').dataTable(); |
|
637 |
* |
|
638 |
* // Sometime later - filter... |
|
639 |
* oTable.fnFilter( 'test string' ); |
|
640 |
* } ); |
|
641 |
*/ |
|
642 |
this.fnFilter = function( sInput, iColumn, bRegex, bSmart, bShowGlobal, bCaseInsensitive ) |
|
643 |
{ |
|
644 |
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] ); |
|
645 |
|
|
646 |
if ( !oSettings.oFeatures.bFilter ) |
|
647 |
{ |
|
648 |
return; |
|
649 |
} |
|
650 |
|
|
651 |
if ( bRegex === undefined || bRegex === null ) |
|
652 |
{ |
|
653 |
bRegex = false; |
|
654 |
} |
|
655 |
|
|
656 |
if ( bSmart === undefined || bSmart === null ) |
|
657 |
{ |
|
658 |
bSmart = true; |
|
659 |
} |
|
660 |
|
|
661 |
if ( bShowGlobal === undefined || bShowGlobal === null ) |
|
662 |
{ |
|
663 |
bShowGlobal = true; |
|
664 |
} |
|
665 |
|
|
666 |
if ( bCaseInsensitive === undefined || bCaseInsensitive === null ) |
|
667 |
{ |
|
668 |
bCaseInsensitive = true; |
|
669 |
} |
|
670 |
|
|
671 |
if ( iColumn === undefined || iColumn === null ) |
|
672 |
{ |
|
673 |
/* Global filter */ |
|
674 |
_fnFilterComplete( oSettings, { |
|
675 |
"sSearch":sInput+"", |
|
676 |
"bRegex": bRegex, |
|
677 |
"bSmart": bSmart, |
|
678 |
"bCaseInsensitive": bCaseInsensitive |
|
679 |
}, 1 ); |
|
680 |
|
|
681 |
if ( bShowGlobal && oSettings.aanFeatures.f ) |
|
682 |
{ |
|
683 |
var n = oSettings.aanFeatures.f; |
|
684 |
for ( var i=0, iLen=n.length ; i<iLen ; i++ ) |
|
685 |
{ |
|
686 |
// IE9 throws an 'unknown error' if document.activeElement is used |
|
687 |
// inside an iframe or frame... |
|
688 |
try { |
|
689 |
if ( n[i]._DT_Input != document.activeElement ) |
|
690 |
{ |
|
691 |
$(n[i]._DT_Input).val( sInput ); |
|
692 |
} |
|
693 |
} |
|
694 |
catch ( e ) { |
|
695 |
$(n[i]._DT_Input).val( sInput ); |
|
696 |
} |
|
697 |
} |
|
698 |
} |
|
699 |
} |
|
700 |
else |
|
701 |
{ |
|
702 |
/* Single column filter */ |
|
703 |
$.extend( oSettings.aoPreSearchCols[ iColumn ], { |
|
704 |
"sSearch": sInput+"", |
|
705 |
"bRegex": bRegex, |
|
706 |
"bSmart": bSmart, |
|
707 |
"bCaseInsensitive": bCaseInsensitive |
|
708 |
} ); |
|
709 |
_fnFilterComplete( oSettings, oSettings.oPreviousSearch, 1 ); |
|
710 |
} |
|
711 |
}; |
|
712 |
|
|
713 |
|
|
714 |
/** |
|
715 |
* Get the data for the whole table, an individual row or an individual cell based on the |
|
716 |
* provided parameters. |
|
717 |
* @param {int|node} [mRow] A TR row node, TD/TH cell node or an integer. If given as |
|
718 |
* a TR node then the data source for the whole row will be returned. If given as a |
|
719 |
* TD/TH cell node then iCol will be automatically calculated and the data for the |
|
720 |
* cell returned. If given as an integer, then this is treated as the aoData internal |
|
721 |
* data index for the row (see fnGetPosition) and the data for that row used. |
|
722 |
* @param {int} [iCol] Optional column index that you want the data of. |
|
723 |
* @returns {array|object|string} If mRow is undefined, then the data for all rows is |
|
724 |
* returned. If mRow is defined, just data for that row, and is iCol is |
|
725 |
* defined, only data for the designated cell is returned. |
|
726 |
* @dtopt API |
|
727 |
* |
|
728 |
* @example |
|
729 |
* // Row data |
|
730 |
* $(document).ready(function() { |
|
731 |
* oTable = $('#example').dataTable(); |
|
732 |
* |
|
733 |
* oTable.$('tr').click( function () { |
|
734 |
* var data = oTable.fnGetData( this ); |
|
735 |
* // ... do something with the array / object of data for the row |
|
736 |
* } ); |
|
737 |
* } ); |
|
738 |
* |
|
739 |
* @example |
|
740 |
* // Individual cell data |
|
741 |
* $(document).ready(function() { |
|
742 |
* oTable = $('#example').dataTable(); |
|
743 |
* |
|
744 |
* oTable.$('td').click( function () { |
|
745 |
* var sData = oTable.fnGetData( this ); |
|
746 |
* alert( 'The cell clicked on had the value of '+sData ); |
|
747 |
* } ); |
|
748 |
* } ); |
|
749 |
*/ |
|
750 |
this.fnGetData = function( mRow, iCol ) |
|
751 |
{ |
|
752 |
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] ); |
|
753 |
|
|
754 |
if ( mRow !== undefined ) |
|
755 |
{ |
|
756 |
var iRow = mRow; |
|
757 |
if ( typeof mRow === 'object' ) |
|
758 |
{ |
|
759 |
var sNode = mRow.nodeName.toLowerCase(); |
|
760 |
if (sNode === "tr" ) |
|
761 |
{ |
|
762 |
iRow = _fnNodeToDataIndex(oSettings, mRow); |
|
763 |
} |
|
764 |
else if ( sNode === "td" ) |
|
765 |
{ |
|
766 |
iRow = _fnNodeToDataIndex(oSettings, mRow.parentNode); |
|
767 |
iCol = _fnNodeToColumnIndex( oSettings, iRow, mRow ); |
|
768 |
} |
|
769 |
} |
|
770 |
|
|
771 |
if ( iCol !== undefined ) |
|
772 |
{ |
|
773 |
return _fnGetCellData( oSettings, iRow, iCol, '' ); |
|
774 |
} |
|
775 |
return (oSettings.aoData[iRow]!==undefined) ? |
|
776 |
oSettings.aoData[iRow]._aData : null; |
|
777 |
} |
|
778 |
return _fnGetDataMaster( oSettings ); |
|
779 |
}; |
|
780 |
|
|
781 |
|
|
782 |
/** |
|
783 |
* Get an array of the TR nodes that are used in the table's body. Note that you will |
|
784 |
* typically want to use the '$' API method in preference to this as it is more |
|
785 |
* flexible. |
|
786 |
* @param {int} [iRow] Optional row index for the TR element you want |
|
787 |
* @returns {array|node} If iRow is undefined, returns an array of all TR elements |
|
788 |
* in the table's body, or iRow is defined, just the TR element requested. |
|
789 |
* @dtopt API |
|
790 |
* |
|
791 |
* @example |
|
792 |
* $(document).ready(function() { |
|
793 |
* var oTable = $('#example').dataTable(); |
|
794 |
* |
|
795 |
* // Get the nodes from the table |
|
796 |
* var nNodes = oTable.fnGetNodes( ); |
|
797 |
* } ); |
|
798 |
*/ |
|
799 |
this.fnGetNodes = function( iRow ) |
|
800 |
{ |
|
801 |
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] ); |
|
802 |
|
|
803 |
if ( iRow !== undefined ) { |
|
804 |
return (oSettings.aoData[iRow]!==undefined) ? |
|
805 |
oSettings.aoData[iRow].nTr : null; |
|
806 |
} |
|
807 |
return _fnGetTrNodes( oSettings ); |
|
808 |
}; |
|
809 |
|
|
810 |
|
|
811 |
/** |
|
812 |
* Get the array indexes of a particular cell from it's DOM element |
|
813 |
* and column index including hidden columns |
|
814 |
* @param {node} nNode this can either be a TR, TD or TH in the table's body |
|
815 |
* @returns {int} If nNode is given as a TR, then a single index is returned, or |
|
816 |
* if given as a cell, an array of [row index, column index (visible), |
|
817 |
* column index (all)] is given. |
|
818 |
* @dtopt API |
|
819 |
* |
|
820 |
* @example |
|
821 |
* $(document).ready(function() { |
|
822 |
* $('#example tbody td').click( function () { |
|
823 |
* // Get the position of the current data from the node |
|
824 |
* var aPos = oTable.fnGetPosition( this ); |
|
825 |
* |
|
826 |
* // Get the data array for this row |
|
827 |
* var aData = oTable.fnGetData( aPos[0] ); |
|
828 |
* |
|
829 |
* // Update the data array and return the value |
|
830 |
* aData[ aPos[1] ] = 'clicked'; |
|
831 |
* this.innerHTML = 'clicked'; |
|
832 |
* } ); |
|
833 |
* |
|
834 |
* // Init DataTables |
|
835 |
* oTable = $('#example').dataTable(); |
|
836 |
* } ); |
|
837 |
*/ |
|
838 |
this.fnGetPosition = function( nNode ) |
|
839 |
{ |
|
840 |
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] ); |
|
841 |
var sNodeName = nNode.nodeName.toUpperCase(); |
|
842 |
|
|
843 |
if ( sNodeName == "TR" ) |
|
844 |
{ |
|
845 |
return _fnNodeToDataIndex(oSettings, nNode); |
|
846 |
} |
|
847 |
else if ( sNodeName == "TD" || sNodeName == "TH" ) |
|
848 |
{ |
|
849 |
var iDataIndex = _fnNodeToDataIndex( oSettings, nNode.parentNode ); |
|
850 |
var iColumnIndex = _fnNodeToColumnIndex( oSettings, iDataIndex, nNode ); |
|
851 |
return [ iDataIndex, _fnColumnIndexToVisible(oSettings, iColumnIndex ), iColumnIndex ]; |
|
852 |
} |
|
853 |
return null; |
|
854 |
}; |
|
855 |
|
|
856 |
|
|
857 |
/** |
|
858 |
* Check to see if a row is 'open' or not. |
|
859 |
* @param {node} nTr the table row to check |
|
860 |
* @returns {boolean} true if the row is currently open, false otherwise |
|
861 |
* @dtopt API |
|
862 |
* |
|
863 |
* @example |
|
864 |
* $(document).ready(function() { |
|
865 |
* var oTable; |
|
866 |
* |
|
867 |
* // 'open' an information row when a row is clicked on |
|
868 |
* $('#example tbody tr').click( function () { |
|
869 |
* if ( oTable.fnIsOpen(this) ) { |
|
870 |
* oTable.fnClose( this ); |
|
871 |
* } else { |
|
872 |
* oTable.fnOpen( this, "Temporary row opened", "info_row" ); |
|
873 |
* } |
|
874 |
* } ); |
|
875 |
* |
|
876 |
* oTable = $('#example').dataTable(); |
|
877 |
* } ); |
|
878 |
*/ |
|
879 |
this.fnIsOpen = function( nTr ) |
|
880 |
{ |
|
881 |
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] ); |
|
882 |
var aoOpenRows = oSettings.aoOpenRows; |
|
883 |
|
|
884 |
for ( var i=0 ; i<oSettings.aoOpenRows.length ; i++ ) |
|
885 |
{ |
|
886 |
if ( oSettings.aoOpenRows[i].nParent == nTr ) |
|
887 |
{ |
|
888 |
return true; |
|
889 |
} |
|
890 |
} |
|
891 |
return false; |
|
892 |
}; |
|
893 |
|
|
894 |
|
|
895 |
/** |
|
896 |
* This function will place a new row directly after a row which is currently |
|
897 |
* on display on the page, with the HTML contents that is passed into the |
|
898 |
* function. This can be used, for example, to ask for confirmation that a |
|
899 |
* particular record should be deleted. |
|
900 |
* @param {node} nTr The table row to 'open' |
|
901 |
* @param {string|node|jQuery} mHtml The HTML to put into the row |
|
902 |
* @param {string} sClass Class to give the new TD cell |
|
903 |
* @returns {node} The row opened. Note that if the table row passed in as the |
|
904 |
* first parameter, is not found in the table, this method will silently |
|
905 |
* return. |
|
906 |
* @dtopt API |
|
907 |
* |
|
908 |
* @example |
|
909 |
* $(document).ready(function() { |
|
910 |
* var oTable; |
|
911 |
* |
|
912 |
* // 'open' an information row when a row is clicked on |
|
913 |
* $('#example tbody tr').click( function () { |
|
914 |
* if ( oTable.fnIsOpen(this) ) { |
|
915 |
* oTable.fnClose( this ); |
|
916 |
* } else { |
|
917 |
* oTable.fnOpen( this, "Temporary row opened", "info_row" ); |
|
918 |
* } |
|
919 |
* } ); |
|
920 |
* |
|
921 |
* oTable = $('#example').dataTable(); |
|
922 |
* } ); |
|
923 |
*/ |
|
924 |
this.fnOpen = function( nTr, mHtml, sClass ) |
|
925 |
{ |
|
926 |
/* Find settings from table node */ |
|
927 |
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] ); |
|
928 |
|
|
929 |
/* Check that the row given is in the table */ |
|
930 |
var nTableRows = _fnGetTrNodes( oSettings ); |
|
931 |
if ( $.inArray(nTr, nTableRows) === -1 ) |
|
932 |
{ |
|
933 |
return; |
|
934 |
} |
|
935 |
|
|
936 |
/* the old open one if there is one */ |
|
937 |
this.fnClose( nTr ); |
|
938 |
|
|
939 |
var nNewRow = document.createElement("tr"); |
|
940 |
var nNewCell = document.createElement("td"); |
|
941 |
nNewRow.appendChild( nNewCell ); |
|
942 |
nNewCell.className = sClass; |
|
943 |
nNewCell.colSpan = _fnVisbleColumns( oSettings ); |
|
944 |
|
|
945 |
if (typeof mHtml === "string") |
|
946 |
{ |
|
947 |
nNewCell.innerHTML = mHtml; |
|
948 |
} |
|
949 |
else |
|
950 |
{ |
|
951 |
$(nNewCell).html( mHtml ); |
|
952 |
} |
|
953 |
|
|
954 |
/* If the nTr isn't on the page at the moment - then we don't insert at the moment */ |
|
955 |
var nTrs = $('tr', oSettings.nTBody); |
|
956 |
if ( $.inArray(nTr, nTrs) != -1 ) |
|
957 |
{ |
|
958 |
$(nNewRow).insertAfter(nTr); |
|
959 |
} |
|
960 |
|
|
961 |
oSettings.aoOpenRows.push( { |
|
962 |
"nTr": nNewRow, |
|
963 |
"nParent": nTr |
|
964 |
} ); |
|
965 |
|
|
966 |
return nNewRow; |
|
967 |
}; |
|
968 |
|
|
969 |
|
|
970 |
/** |
|
971 |
* Change the pagination - provides the internal logic for pagination in a simple API |
|
972 |
* function. With this function you can have a DataTables table go to the next, |
|
973 |
* previous, first or last pages. |
|
974 |
* @param {string|int} mAction Paging action to take: "first", "previous", "next" or "last" |
|
975 |
* or page number to jump to (integer), note that page 0 is the first page. |
|
976 |
* @param {bool} [bRedraw=true] Redraw the table or not |
|
977 |
* @dtopt API |
|
978 |
* |
|
979 |
* @example |
|
980 |
* $(document).ready(function() { |
|
981 |
* var oTable = $('#example').dataTable(); |
|
982 |
* oTable.fnPageChange( 'next' ); |
|
983 |
* } ); |
|
984 |
*/ |
|
985 |
this.fnPageChange = function ( mAction, bRedraw ) |
|
986 |
{ |
|
987 |
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] ); |
|
988 |
_fnPageChange( oSettings, mAction ); |
|
989 |
_fnCalculateEnd( oSettings ); |
|
990 |
|
|
991 |
if ( bRedraw === undefined || bRedraw ) |
|
992 |
{ |
|
993 |
_fnDraw( oSettings ); |
|
994 |
} |
|
995 |
}; |
|
996 |
|
|
997 |
|
|
998 |
/** |
|
999 |
* Show a particular column |
|
1000 |
* @param {int} iCol The column whose display should be changed |
|
1001 |
* @param {bool} bShow Show (true) or hide (false) the column |
|
1002 |
* @param {bool} [bRedraw=true] Redraw the table or not |
|
1003 |
* @dtopt API |
|
1004 |
* |
|
1005 |
* @example |
|
1006 |
* $(document).ready(function() { |
|
1007 |
* var oTable = $('#example').dataTable(); |
|
1008 |
* |
|
1009 |
* // Hide the second column after initialisation |
|
1010 |
* oTable.fnSetColumnVis( 1, false ); |
|
1011 |
* } ); |
|
1012 |
*/ |
|
1013 |
this.fnSetColumnVis = function ( iCol, bShow, bRedraw ) |
|
1014 |
{ |
|
1015 |
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] ); |
|
1016 |
var i, iLen; |
|
1017 |
var aoColumns = oSettings.aoColumns; |
|
1018 |
var aoData = oSettings.aoData; |
|
1019 |
var nTd, bAppend, iBefore; |
|
1020 |
|
|
1021 |
/* No point in doing anything if we are requesting what is already true */ |
Also available in: Unified diff
removing unneccesary source code of js lib