4 * DataTables settings object - this holds all the information needed for a
5 * given table, including configuration, data and current application of the
6 * table options. DataTables does not have a single instance for each DataTable
7 * with the settings attached to that instance, but rather instances of the
8 * DataTable "class" are created on-the-fly as needed (typically by a
9 * $().dataTable() call) and the settings object is then applied to that
12 * Note that this object is related to {@link DataTable.defaults} but this
13 * one is the internal data store for DataTables's cache of columns. It should
14 * NOT be manipulated outside of DataTables. Any configuration should be done
15 * through the initialisation options.
17 * @todo Really should attach the settings object to individual instances so we
18 * don't need to create new instances on each $().dataTable() call (if the
19 * table already exists). It would also save passing oSettings around and
20 * into every single function. However, this is a very significant
21 * architecture change for DataTables and will almost certainly break
22 * backwards compatibility with older installations. This is something that
23 * will be done in 2.0.
25 DataTable.models.oSettings = {
27 * Primary features of DataTables and their enablement state.
33 * Flag to say if DataTables should automatically try to calculate the
34 * optimum table and columns widths (true) or not (false).
35 * Note that this parameter will be set by the initialisation routine. To
36 * set a default use {@link DataTable.defaults}.
42 * Delay the creation of TR and TD elements until they are actually
43 * needed by a driven page draw. This can give a significant speed
44 * increase for Ajax source and Javascript source data, but makes no
45 * difference at all fro DOM and server-side processing tables.
46 * Note that this parameter will be set by the initialisation routine. To
47 * set a default use {@link DataTable.defaults}.
53 * Enable filtering on the table or not. Note that if this is disabled
54 * then there is no filtering at all on the table, including fnFilter.
55 * To just remove the filtering input use sDom and remove the 'f' option.
56 * Note that this parameter will be set by the initialisation routine. To
57 * set a default use {@link DataTable.defaults}.
63 * Table information element (the 'Showing x of y records' div) enable
65 * Note that this parameter will be set by the initialisation routine. To
66 * set a default use {@link DataTable.defaults}.
72 * Present a user control allowing the end user to change the page size
73 * when pagination is enabled.
74 * Note that this parameter will be set by the initialisation routine. To
75 * set a default use {@link DataTable.defaults}.
78 "bLengthChange": null,
81 * Pagination enabled or not. Note that if this is disabled then length
82 * changing must also be disabled.
83 * Note that this parameter will be set by the initialisation routine. To
84 * set a default use {@link DataTable.defaults}.
90 * Processing indicator enable flag whenever DataTables is enacting a
91 * user request - typically an Ajax request for server-side processing.
92 * Note that this parameter will be set by the initialisation routine. To
93 * set a default use {@link DataTable.defaults}.
99 * Server-side processing enabled flag - when enabled DataTables will
100 * get all data from the server for every draw - there is no filtering,
101 * sorting or paging done on the client-side.
102 * Note that this parameter will be set by the initialisation routine. To
103 * set a default use {@link DataTable.defaults}.
109 * Sorting enablement flag.
110 * Note that this parameter will be set by the initialisation routine. To
111 * set a default use {@link DataTable.defaults}.
117 * Apply a class to the columns which are being sorted to provide a
118 * visual highlight or not. This can slow things down when enabled since
119 * there is a lot of DOM interaction.
120 * Note that this parameter will be set by the initialisation routine. To
121 * set a default use {@link DataTable.defaults}.
124 "bSortClasses": null,
127 * State saving enablement flag.
128 * Note that this parameter will be set by the initialisation routine. To
129 * set a default use {@link DataTable.defaults}.
137 * Scrolling settings for a table.
142 * Indicate if DataTables should be allowed to set the padding / margin
143 * etc for the scrolling header elements or not. Typically you will want
145 * Note that this parameter will be set by the initialisation routine. To
146 * set a default use {@link DataTable.defaults}.
152 * When the table is shorter in height than sScrollY, collapse the
153 * table container down to the height of the table (when true).
154 * Note that this parameter will be set by the initialisation routine. To
155 * set a default use {@link DataTable.defaults}.
161 * Infinite scrolling enablement flag. Now deprecated in favour of
162 * using the Scroller plug-in.
163 * Note that this parameter will be set by the initialisation routine. To
164 * set a default use {@link DataTable.defaults}.
170 * Width of the scrollbar for the web-browser's platform. Calculated
171 * during table initialisation.
178 * Space (in pixels) between the bottom of the scrolling container and
179 * the bottom of the scrolling viewport before the next page is loaded
180 * when using infinite scrolling.
181 * Note that this parameter will be set by the initialisation routine. To
182 * set a default use {@link DataTable.defaults}.
188 * Viewport width for horizontal scrolling. Horizontal scrolling is
189 * disabled if an empty string.
190 * Note that this parameter will be set by the initialisation routine. To
191 * set a default use {@link DataTable.defaults}.
197 * Width to expand the table to when using x-scrolling. Typically you
198 * should not need to use this.
199 * Note that this parameter will be set by the initialisation routine. To
200 * set a default use {@link DataTable.defaults}.
207 * Viewport height for vertical scrolling. Vertical scrolling is disabled
208 * if an empty string.
209 * Note that this parameter will be set by the initialisation routine. To
210 * set a default use {@link DataTable.defaults}.
217 * Language information for the table.
219 * @extends DataTable.defaults.oLanguage
223 * Information callback function. See
224 * {@link DataTable.defaults.fnInfoCallback}
228 "fnInfoCallback": null
232 * Browser support parameters
237 * Indicate if the browser incorrectly calculates width:100% inside a
238 * scrolling element (IE6/7)
242 "bScrollOversize": false
246 * Array referencing the nodes which are used for the features. The
247 * parameters of this object match what is allowed by sDom - i.e.
249 * <li>'l' - Length changing</li>
250 * <li>'f' - Filtering input</li>
251 * <li>'t' - The table!</li>
252 * <li>'i' - Information</li>
253 * <li>'p' - Pagination</li>
254 * <li>'r' - pRocessing</li>
262 * Store data information - see {@link DataTable.models.oRow} for detailed
270 * Array of indexes which are in the current display (after filtering etc)
277 * Array of indexes for display - no filtering
281 "aiDisplayMaster": [],
284 * Store information about each column that is in use
291 * Store information about the table's header
298 * Store information about the table's footer
305 * Search data array for regular expression searching
312 * Store the applied global search information in case we want to force a
313 * research or compare the old search to a new one.
314 * Note that this parameter will be set by the initialisation routine. To
315 * set a default use {@link DataTable.defaults}.
317 * @extends DataTable.models.oSearch
319 "oPreviousSearch": {},
322 * Store the applied search for each column - see
323 * {@link DataTable.models.oSearch} for the format that is used for the
324 * filtering information for each column.
328 "aoPreSearchCols": [],
331 * Sorting that is applied to the table. Note that the inner arrays are
332 * used in the following manner:
334 * <li>Index 0 - column number</li>
335 * <li>Index 1 - current sorting direction</li>
336 * <li>Index 2 - index of asSorting for this column</li>
338 * Note that this parameter will be set by the initialisation routine. To
339 * set a default use {@link DataTable.defaults}.
341 * @todo These inner arrays should really be objects
346 * Sorting that is always applied to the table (i.e. prefixed in front of
348 * Note that this parameter will be set by the initialisation routine. To
349 * set a default use {@link DataTable.defaults}.
353 "aaSortingFixed": null,
356 * Classes to use for the striping of a table.
357 * Note that this parameter will be set by the initialisation routine. To
358 * set a default use {@link DataTable.defaults}.
362 "asStripeClasses": null,
365 * If restoring a table - we should restore its striping classes as well
369 "asDestroyStripes": [],
372 * If restoring a table - we should restore its width
379 * Callback functions array for every time a row is inserted (i.e. on a draw).
386 * Callback functions for the header on each draw.
390 "aoHeaderCallback": [],
393 * Callback function for the footer on each draw.
397 "aoFooterCallback": [],
400 * Array of callback functions for draw callback functions
404 "aoDrawCallback": [],
407 * Array of callback functions for row created function
411 "aoRowCreatedCallback": [],
414 * Callback functions for just before the table is redrawn. A return of
415 * false will be used to cancel the draw.
419 "aoPreDrawCallback": [],
422 * Callback functions for when the table has been initialised.
426 "aoInitComplete": [],
430 * Callbacks for modifying the settings to be stored for state saving, prior to
435 "aoStateSaveParams": [],
438 * Callbacks for modifying the settings that have been stored for state saving
439 * prior to using the stored values to restore the state.
443 "aoStateLoadParams": [],
446 * Callbacks for operating on the settings object once the saved state has been
454 * Cache the table ID for quick access
456 * @default <i>Empty string</i>
461 * The TABLE node for the main table
468 * Permanent ref to the thead element
475 * Permanent ref to the tfoot element - if it exists
482 * Permanent ref to the tbody element
489 * Cache the wrapper node (contains all DataTables controlled elements)
493 "nTableWrapper": null,
496 * Indicate if when using server-side processing the loading of data
497 * should be deferred until the second draw.
498 * Note that this parameter will be set by the initialisation routine. To
499 * set a default use {@link DataTable.defaults}.
503 "bDeferLoading": false,
506 * Indicate if all required information has been read in
510 "bInitialised": false,
513 * Information about open rows. Each object in the array has the parameters
514 * 'nTr' and 'nParent'
521 * Dictate the positioning of DataTables' control elements - see
522 * {@link DataTable.model.oInit.sDom}.
523 * Note that this parameter will be set by the initialisation routine. To
524 * set a default use {@link DataTable.defaults}.
531 * Which type of pagination should be used.
532 * Note that this parameter will be set by the initialisation routine. To
533 * set a default use {@link DataTable.defaults}.
535 * @default two_button
537 "sPaginationType": "two_button",
540 * The cookie duration (for bStateSave) in seconds.
541 * Note that this parameter will be set by the initialisation routine. To
542 * set a default use {@link DataTable.defaults}.
546 "iCookieDuration": 0,
549 * The cookie name prefix.
550 * Note that this parameter will be set by the initialisation routine. To
551 * set a default use {@link DataTable.defaults}.
553 * @default <i>Empty string</i>
558 * Callback function for cookie creation.
559 * Note that this parameter will be set by the initialisation routine. To
560 * set a default use {@link DataTable.defaults}.
564 "fnCookieCallback": null,
567 * Array of callback functions for state saving. Each array element is an
568 * object with the following parameters:
570 * <li>function:fn - function to call. Takes two parameters, oSettings
571 * and the JSON string to save that has been thus far created. Returns
572 * a JSON string to be inserted into a json object
573 * (i.e. '"param": [ 0, 1, 2]')</li>
574 * <li>string:sName - name of callback</li>
582 * Array of callback functions for state loading. Each array element is an
583 * object with the following parameters:
585 * <li>function:fn - function to call. Takes two parameters, oSettings
586 * and the object stored. May return false to cancel state loading</li>
587 * <li>string:sName - name of callback</li>
595 * State that was loaded from the cookie. Useful for back reference
599 "oLoadedState": null,
602 * Source url for AJAX data for the table.
603 * Note that this parameter will be set by the initialisation routine. To
604 * set a default use {@link DataTable.defaults}.
611 * Property from a given object from which to read the table data from. This
612 * can be an empty string (when not server-side processing), in which case
613 * it is assumed an an array is given directly.
614 * Note that this parameter will be set by the initialisation routine. To
615 * set a default use {@link DataTable.defaults}.
618 "sAjaxDataProp": null,
621 * Note if draw should be blocked while getting data
625 "bAjaxDataGet": true,
628 * The last jQuery XHR object that was used for server-side data gathering.
629 * This can be used for working with the XHR information in one of the
637 * Function to get the server-side data.
638 * Note that this parameter will be set by the initialisation routine. To
639 * set a default use {@link DataTable.defaults}.
642 "fnServerData": null,
645 * Functions which are called prior to sending an Ajax request so extra
646 * parameters can easily be sent to the server
650 "aoServerParams": [],
653 * Send the XHR HTTP method - GET or POST (could be PUT or DELETE if
655 * Note that this parameter will be set by the initialisation routine. To
656 * set a default use {@link DataTable.defaults}.
659 "sServerMethod": null,
662 * Format numbers for display.
663 * Note that this parameter will be set by the initialisation routine. To
664 * set a default use {@link DataTable.defaults}.
667 "fnFormatNumber": null,
670 * List of options that can be used for the user selectable length menu.
671 * Note that this parameter will be set by the initialisation routine. To
672 * set a default use {@link DataTable.defaults}.
679 * Counter for the draws that the table does. Also used as a tracker for
680 * server-side processing
687 * Indicate if a redraw is being done - useful for Ajax
694 * Draw index (iDraw) of the last error when parsing the returned data
701 * Paging display length
705 "_iDisplayLength": 10,
708 * Paging start point - aiDisplay index
715 * Paging end point - aiDisplay index. Use fnDisplayEnd rather than
716 * this property to get the end point
724 * Server-side processing - number of records in the result set
725 * (i.e. before filtering), Use fnRecordsTotal rather than
726 * this property to get the value of the number of records, regardless of
727 * the server-side processing setting.
735 * Server-side processing - number of records in the current display set
736 * (i.e. after filtering). Use fnRecordsDisplay rather than
737 * this property to get the value of the number of records, regardless of
738 * the server-side processing setting.
743 "_iRecordsDisplay": 0,
746 * Flag to indicate if jQuery UI marking and classes should be used.
747 * Note that this parameter will be set by the initialisation routine. To
748 * set a default use {@link DataTable.defaults}.
754 * The classes to use for the table
761 * Flag attached to the settings object so you can check in the draw
762 * callback if filtering has been done in the draw. Deprecated in favour of
771 * Flag attached to the settings object so you can check in the draw
772 * callback if sorting has been done in the draw. Deprecated in favour of
781 * Indicate that if multiple rows are in the header and there is more than
782 * one unique cell per column, if the top one (true) or bottom one (false)
783 * should be used for sorting / title by DataTables.
784 * Note that this parameter will be set by the initialisation routine. To
785 * set a default use {@link DataTable.defaults}.
788 "bSortCellsTop": null,
791 * Initialisation object that is used for the table
798 * Destroy callback functions - for plug-ins to attach themselves to the
799 * destroy so they can clean up markup and events.
803 "aoDestroyCallback": [],
807 * Get the number of records in the current record set, before filtering
810 "fnRecordsTotal": function ()
812 if ( this.oFeatures.bServerSide ) {
813 return parseInt(this._iRecordsTotal, 10);
815 return this.aiDisplayMaster.length;
820 * Get the number of records in the current record set, after filtering
823 "fnRecordsDisplay": function ()
825 if ( this.oFeatures.bServerSide ) {
826 return parseInt(this._iRecordsDisplay, 10);
828 return this.aiDisplay.length;
833 * Set the display end point - aiDisplay index
835 * @todo Should do away with _iDisplayEnd and calculate it on-the-fly here
837 "fnDisplayEnd": function ()
839 if ( this.oFeatures.bServerSide ) {
840 if ( this.oFeatures.bPaginate === false || this._iDisplayLength == -1 ) {
841 return this._iDisplayStart+this.aiDisplay.length;
843 return Math.min( this._iDisplayStart+this._iDisplayLength,
844 this._iRecordsDisplay );
847 return this._iDisplayEnd;
852 * The DataTables object for this table
859 * Unique identifier for each instance of the DataTables object. If there
860 * is an ID on the table node, then it takes that value, otherwise an
861 * incrementing internal counter is used.
868 * tabindex attribute value that is added to DataTables control elements, allowing
869 * keyboard navigation of the table and its controls.
874 * DIV container for the footer scrolling table if scrolling
879 * DIV container for the footer scrolling table if scrolling