1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-02-21 19:54:15 +01:00

Add JSDoc comments for the DataTables settings object

This commit is contained in:
Allan Jardine 2011-11-27 17:50:06 +00:00
parent 133e7fb7fe
commit 3ddd89b52e
5 changed files with 1305 additions and 960 deletions

View File

@ -8523,599 +8523,729 @@
*/ */
var _aoSettings = []; var _aoSettings = [];
/*
* Function: classSettings /**
* Purpose: Settings container function for all 'class' properties which are required * DataTables settings object - this holds all the information needed for a
* by dataTables * given table, including configuration, data and current application of the
* Returns: - * table options. DataTables does not have a single instance for each DataTable
* Inputs: - * with the settings attached to that instance, but rather instances of the
* DataTable "class" are created on-the-fly as needed (typically by a
* $().dataTable() call) and the settings object is then applied to that
* instance.
*
* Note that this object is related to {@link DataTable.models.oInit} but this
* one is the internal data store for DataTables's cache of columns. It should
* NOT be manipulated outside of DataTables. Any configuration should be done
* through the initialisation options.
* @namespace
* @todo Really should attach the settings object to individual instances so we
* don't need to create new instances on each $().dataTable() call (if the
* table already exists). It would also save passing oSettings around and
* into every single function. However, this is a very significant
* architecture change for DataTables and will almost certainly break
* backwards compatibility with older installations. This is something that
* will be done in 2.0.
*/ */
DataTable.models.oSettings = { DataTable.models.oSettings = {
/**
/* * Primary features of DataTables and their enablement state.
* Variable: oFeatures * @namespace
* Purpose: Indicate the enablement of key dataTable features
* Scope: jQuery.dataTable.classSettings
*/ */
oFeatures: { "oFeatures": {
"bPaginate": true,
"bLengthChange": true, /**
"bFilter": true, * Flag to say if DataTables should automatically try to calculate the
"bSort": true, * optimum table and columns widths (true) or not (false).
"bInfo": true, * @type boolean
* @default true
*/
"bAutoWidth": true, "bAutoWidth": true,
/**
* Delay the creation of TR and TD elements until they are actually
* needed by a driven page draw. This can give a significant speed
* increase for Ajax source and Javascript source data, but makes no
* difference at all fro DOM and server-side processing tables.
* @type boolean
* @default false
*/
"bDeferRender": false,
/**
* Enable filtering on the table or not. Note that if this is disabled
* then there is no filtering at all on the table, including fnFilter.
* To just remove the filtering input use sDom and remove the 'f' option
* @type boolean
* @default true
*/
"bFilter": true,
/**
* Table information element (the 'Showing x of y records' div) enable
* flag
* @type boolean
* @default true
*/
"bInfo": true,
/**
* Present a user control allowing the end user to change the page size
* when pagination is enabled.
* @type boolean
* @default true
*/
"bLengthChange": true,
/**
* Pagination enabled or not. Note that if this is disabled then length
* changing must also be disabled.
* @type boolean
* @default true
*/
"bPaginate": true,
/**
* Processing indicator enable flag whenever DataTables is enacting a
* user request - typically an Ajax request for server-side processing.
* @type boolean
* @default false
*/
"bProcessing": false, "bProcessing": false,
"bSortClasses": true,
"bStateSave": false, /**
* Server-side processing enabled flag - when enabled DataTables will
* get all data from the server for every draw - there is no filtering,
* sorting or paging done on the client-side.
* @type boolean
* @default false
*/
"bServerSide": false, "bServerSide": false,
"bDeferRender": false
/**
* Sorting enablement flag.
* @type boolean
* @default true
*/
"bSort": true,
/**
* Apply a class to the columns which are being sorted to provide a
* visual highlight or not. This can slow things down when enabled since
* there is a lot of DOM interaction.
* @type boolean
* @default true
*/
"bSortClasses": true,
/**
* State saving enablement flag.
* @type boolean
* @default false
*/
"bStateSave": false
}, },
/*
* Variable: oScroll /**
* Purpose: Container for scrolling options * Scrolling settings for a table.
* Scope: jQuery.dataTable.classSettings * @namespace
*/ */
oScroll: { "oScroll": {
"sX": "", /**
"sXInner": "", * Indicate if DataTables should be allowed to set the padding / margin
"sY": "", * etc for the scrolling header elements or not. Typically you will want
* this.
* @type boolean
* @default true
*/
"bAutoCss": true,
/**
* When the table is shorter in height than sScrollY, collapse the
* table container down to the height of the table (when true)
* @type boolean
* @default false
*/
"bCollapse": false, "bCollapse": false,
/**
* Infinite scrolling enablement flag. Now deprecated in favour of
* using the Scroller plug-in.
* @type boolean
* @default false
* @deprecated
*/
"bInfinite": false, "bInfinite": false,
"iLoadGap": 100,
/**
* Width of the scrollbar for the web-browser's platform. Calculated
* during table initialisation.
* @type int
* @default 0
*/
"iBarWidth": 0, "iBarWidth": 0,
"bAutoCss": true
/**
* Space (in pixels) between the bottom of the scrolling container and
* the bottom of the scrolling viewport before the next page is loaded
* when using infinite scrolling.
* @type int
* @default 100
* @deprecated
*/
"iLoadGap": 100,
/**
* Viewport width for horizontal scrolling. Horizontal scrolling is
* disabled if an empty string.
* @type string
* @default <i>Empty string</i>
*/
"sX": "",
/**
* Width to expand the table to when using x-scrolling. Typically you
* should not need to use this.
* @type string
* @default <i>Empty string</i>
* @deprecated
*/
"sXInner": "",
/**
* Viewport height for vertical scrolling. Vertical scrolling is disabled
* if an empty string.
* @type string
* @default <i>Empty string</i>
*/
"sY": ""
}, },
/* /**
* Variable: aanFeatures * Language information for the table.
* Purpose: Array referencing the nodes which are used for the features * @namespace
* Scope: jQuery.dataTable.classSettings * @extends DataTable.models.oInit.oLanguage
* Notes: The parameters of this object match what is allowed by sDom - i.e.
* 'l' - Length changing
* 'f' - Filtering input
* 't' - The table!
* 'i' - Information
* 'p' - Pagination
* 'r' - pRocessing
*/ */
aanFeatures: [], "oLanguage": {
/**
/* * Information callback function. See
* Variable: oLanguage * {@link DataTable.models.oInit.fnInfoCallback}
* Purpose: Store the language strings used by dataTables * @type function
* Scope: jQuery.dataTable.classSettings * @default
* Notes: The words in the format _VAR_ are variables which are dynamically replaced */
* by javascript
*/
oLanguage: {
"sProcessing": "Processing...",
"sLengthMenu": "Show _MENU_ entries",
"sZeroRecords": "No matching records found",
"sEmptyTable": "No data available in table",
"sLoadingRecords": "Loading...",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
"sInfoEmpty": "Showing 0 to 0 of 0 entries",
"sInfoFiltered": "(filtered from _MAX_ total entries)",
"sInfoPostFix": "",
"sInfoThousands": ",",
"sSearch": "Search:",
"sUrl": "",
"oPaginate": {
"sFirst": "First",
"sPrevious": "Previous",
"sNext": "Next",
"sLast": "Last"
},
"fnInfoCallback": null "fnInfoCallback": null
}, },
/* /**
* Variable: aoData * Array referencing the nodes which are used for the features. The
* Purpose: Store data information * parameters of this object match what is allowed by sDom - i.e.
* Scope: jQuery.dataTable.classSettings * <ul>
* Notes: This is an array of objects with the following parameters: * <li>'l' - Length changing</li>
* array: _aData - internal data - used for sorting / filtering etc * <li>'f' - Filtering input</li>
* node: nTr - display node * <li>'t' - The table!</li>
* array node: _anHidden - hidden TD nodes * <li>'i' - Information</li>
* string: _sRowStripe * <li>'p' - Pagination</li>
* <li>'r' - pRocessing</li>
* </ul>
* @type array
* @default []
*/ */
aoData: [], "aanFeatures": [],
/* /**
* Variable: aiDisplay * Store data information - see {@link DataTable.models.oRow} for detailed
* Purpose: Array of indexes which are in the current display (after filtering etc) * information.
* Scope: jQuery.dataTable.classSettings * @type array
* @default []
*/ */
aiDisplay: [], "aoData": [],
/* /**
* Variable: aiDisplayMaster * Array of indexes which are in the current display (after filtering etc)
* Purpose: Array of indexes for display - no filtering * @type array
* Scope: jQuery.dataTable.classSettings * @default []
*/ */
aiDisplayMaster: [], "aiDisplay": [],
/*
* Variable: aoColumns
* Purpose: Store information about each column that is in use
* Scope: jQuery.dataTable.classSettings
*/
aoColumns: [],
/*
* Variable: aoHeader
* Purpose: Store information about the table's header
* Scope: jQuery.dataTable.classSettings
*/
aoHeader: [],
/*
* Variable: aoFooter
* Purpose: Store information about the table's footer
* Scope: jQuery.dataTable.classSettings
*/
aoFooter: [],
/* /**
* Variable: asDataSearch * Array of indexes for display - no filtering
* Purpose: Search data array for regular expression searching * @type array
* Scope: jQuery.dataTable.classSettings * @default []
*/ */
asDataSearch: [], "aiDisplayMaster": [],
/* /**
* Variable: oPreviousSearch * Store information about each column that is in use
* Purpose: Store the previous search incase we want to force a re-search * @type array
* or compare the old search to a new one * @default []
* Scope: jQuery.dataTable.classSettings
*/ */
oPreviousSearch: { "aoColumns": [],
"sSearch": "",
"bRegex": false,
"bSmart": true
},
/* /**
* Variable: aoPreSearchCols * Store information about the table's header
* Purpose: Store the previous search for each column * @type array
* Scope: jQuery.dataTable.classSettings * @default []
*/ */
aoPreSearchCols: [], "aoHeader": [],
/* /**
* Variable: aaSorting * Store information about the table's footer
* Purpose: Sorting information * @type array
* Scope: jQuery.dataTable.classSettings * @default []
* Notes: Index 0 - column number
* Index 1 - current sorting direction
* Index 2 - index of asSorting for this column
*/ */
aaSorting: [ [0, 'asc', 0] ], "aoFooter": [],
/* /**
* Variable: aaSortingFixed * Search data array for regular expression searching
* Purpose: Sorting information that is always applied * @type array
* Scope: jQuery.dataTable.classSettings * @default []
*/ */
aaSortingFixed: null, "asDataSearch": [],
/* /**
* Variable: asStripeClasses * Store the applied global search information in case we want to force a
* Purpose: Classes to use for the striping of a table * research or compare the old search to a new one
* Scope: jQuery.dataTable.classSettings * @namespace
* @extends DataTable.models.oSearch
*/ */
asStripeClasses: [], "oPreviousSearch": {},
/* /**
* Variable: asDestroyStripes * Store the applied search for each column - see
* Purpose: If restoring a table - we should restore its striping classes as well * {@link DataTable.models.oSearch} for the format that is used for the
* Scope: jQuery.dataTable.classSettings * filtering information for each column.
* @type array
* @default []
*/ */
asDestroyStripes: [], "aoPreSearchCols": [],
/* /**
* Variable: sDestroyWidth * Sorting that is applied to the table. Note that the inner arrays are
* Purpose: If restoring a table - we should restore its width * used in the following manner:
* Scope: jQuery.dataTable.classSettings * <ul>
* <li>Index 0 - column number</li>
* <li>Index 1 - current sorting direction</li>
* <li>Index 2 - index of asSorting for this column</li>
* </ul>
* @type array
* @default [[0, 'asc', 0]]
* @todo These inner arrays should really be objects
*/ */
sDestroyWidth: 0, "aaSorting": [[0, 'asc', 0]],
/* /**
* Variable: fnRowCallback * Sorting that is always applied to the table (i.e. prefixed in front of
* Purpose: Call this function every time a row is inserted (draw) * aaSorting).
* Scope: jQuery.dataTable.classSettings * @type array|null
* @default null
*/ */
fnRowCallback: null, "aaSortingFixed": null,
/* /**
* Variable: fnHeaderCallback * Classes to use for the striping of a table
* Purpose: Callback function for the header on each draw * @type array
* Scope: jQuery.dataTable.classSettings * @default []
*/ */
fnHeaderCallback: null, "asStripeClasses": [],
/* /**
* Variable: fnFooterCallback * If restoring a table - we should restore its striping classes as well
* Purpose: Callback function for the footer on each draw * @type array
* Scope: jQuery.dataTable.classSettings * @default []
*/ */
fnFooterCallback: null, "asDestroyStripes": [],
/* /**
* Variable: aoDrawCallback * If restoring a table - we should restore its width
* Purpose: Array of callback functions for draw callback functions * @type int
* Scope: jQuery.dataTable.classSettings * @default 0
* Notes: Each array element is an object with the following parameters:
* function:fn - function to call
* string:sName - name callback (feature). useful for arranging array
*/ */
aoDrawCallback: [], "sDestroyWidth": 0,
/* /**
* Variable: fnPreDrawCallback * Call this function every time a row is inserted (draw)
* Purpose: Callback function for just before the table is redrawn. A return of false * @type function
* will be used to cancel the draw. * @default null
* Scope: jQuery.dataTable.classSettings * @todo Make into an array so plug-ins can hook in
*/ */
fnPreDrawCallback: null, "fnRowCallback": null,
/* /**
* Variable: fnInitComplete * Callback function for the header on each draw
* Purpose: Callback function for when the table has been initialised * @type function
* Scope: jQuery.dataTable.classSettings * @default null
* @todo Make into an array so plug-ins can hook in
*/ */
fnInitComplete: null, "fnHeaderCallback": null,
/* /**
* Variable: sTableId * Callback function for the footer on each draw
* Purpose: Cache the table ID for quick access * @type function
* Scope: jQuery.dataTable.classSettings * @default null
* @todo Make into an array so plug-ins can hook in
*/ */
sTableId: "", "fnFooterCallback": null,
/* /**
* Variable: nTable * Array of callback functions for draw callback functions
* Purpose: Cache the table node for quick access * @type array
* Scope: jQuery.dataTable.classSettings * @default []
*/ */
nTable: null, "aoDrawCallback": [],
/* /**
* Variable: nTHead * Callback function for just before the table is redrawn. A return of
* Purpose: Permanent ref to the thead element * false will be used to cancel the draw.
* Scope: jQuery.dataTable.classSettings * @type function
* @default null
* @todo Make into an array so plug-ins can hook in
*/ */
nTHead: null, "fnPreDrawCallback": null,
/* /**
* Variable: nTFoot * Callback function for when the table has been initialised
* Purpose: Permanent ref to the tfoot element - if it exists * @type function
* Scope: jQuery.dataTable.classSettings * @default null
* @todo Make into an array so plug-ins can hook in
*/ */
nTFoot: null, "fnInitComplete": null,
/* /**
* Variable: nTBody * Cache the table ID for quick access
* Purpose: Permanent ref to the tbody element * @type string
* Scope: jQuery.dataTable.classSettings * @default <i>Empty string</i>
*/ */
nTBody: null, "sTableId": "",
/* /**
* Variable: nTableWrapper * The TABLE node for the main table
* Purpose: Cache the wrapper node (contains all DataTables controlled elements) * @type node
* Scope: jQuery.dataTable.classSettings * @default null
*/ */
nTableWrapper: null, "nTable": null,
/* /**
* Variable: bDeferLoading * Permanent ref to the thead element
* Purpose: Indicate if when using server-side processing the loading of data * @type node
* should be deferred until the second draw * @default null
* Scope: jQuery.dataTable.classSettings
*/ */
bDeferLoading: false, "nTHead": null,
/* /**
* Variable: bInitialised * Permanent ref to the tfoot element - if it exists
* Purpose: Indicate if all required information has been read in * @type node
* Scope: jQuery.dataTable.classSettings * @default null
*/ */
bInitialised: false, "nTFoot": null,
/* /**
* Variable: aoOpenRows * Permanent ref to the tbody element
* Purpose: Information about open rows * @type node
* Scope: jQuery.dataTable.classSettings * @default null
* Notes: Has the parameters 'nTr' and 'nParent'
*/ */
aoOpenRows: [], "nTBody": null,
/* /**
* Variable: sDom * Cache the wrapper node (contains all DataTables controlled elements)
* Purpose: Dictate the positioning that the created elements will take * @type node
* Scope: jQuery.dataTable.classSettings * @default null
* Notes:
* The following options are allowed:
* 'l' - Length changing
* 'f' - Filtering input
* 't' - The table!
* 'i' - Information
* 'p' - Pagination
* 'r' - pRocessing
* The following constants are allowed:
* 'H' - jQueryUI theme "header" classes
* 'F' - jQueryUI theme "footer" classes
* The following syntax is expected:
* '<' and '>' - div elements
* '<"class" and '>' - div with a class
* Examples:
* '<"wrapper"flipt>', '<lf<t>ip>'
*/ */
sDom: 'lfrtip', "nTableWrapper": null,
/* /**
* Variable: sPaginationType * Indicate if when using server-side processing the loading of data
* Purpose: Note which type of sorting should be used * should be deferred until the second draw
* Scope: jQuery.dataTable.classSettings * @type boolean
* @default false
*/ */
sPaginationType: "two_button", "bDeferLoading": false,
/* /**
* Variable: iCookieDuration * Indicate if all required information has been read in
* Purpose: The cookie duration (for bStateSave) in seconds - default 2 hours * @type boolean
* Scope: jQuery.dataTable.classSettings * @default false
*/ */
iCookieDuration: 60 * 60 * 2, "bInitialised": false,
/* /**
* Variable: sCookiePrefix * Information about open rows. Each object in the array has the parameters
* Purpose: The cookie name prefix * 'nTr' and 'nParent'
* Scope: jQuery.dataTable.classSettings * @type array
* @default []
*/ */
sCookiePrefix: "SpryMedia_DataTables_", "aoOpenRows": [],
/* /**
* Variable: fnCookieCallback * Dictate the positioning of DataTables' control elements - see
* Purpose: Callback function for cookie creation * {@link DataTable.model.oInit.sDom}.
* Scope: jQuery.dataTable.classSettings * @type string
* @default null
*/ */
fnCookieCallback: null, "sDom": null,
/* /**
* Variable: aoStateSave * Which type of pagination should be used
* Purpose: Array of callback functions for state saving * @type string
* Scope: jQuery.dataTable.classSettings * @default two_button
* Notes: Each array element is an object with the following parameters:
* function:fn - function to call. Takes two parameters, oSettings and the JSON string to
* save that has been thus far created. Returns a JSON string to be inserted into a
* json object (i.e. '"param": [ 0, 1, 2]')
* string:sName - name of callback
*/ */
aoStateSave: [], "sPaginationType": "two_button",
/* /**
* Variable: aoStateLoad * The cookie duration (for bStateSave) in seconds
* Purpose: Array of callback functions for state loading * @type int
* Scope: jQuery.dataTable.classSettings * @default 0
* Notes: Each array element is an object with the following parameters:
* function:fn - function to call. Takes two parameters, oSettings and the object stored.
* May return false to cancel state loading.
* string:sName - name of callback
*/ */
aoStateLoad: [], "iCookieDuration": 0,
/* /**
* Variable: oLoadedState * The cookie name prefix
* Purpose: State that was loaded from the cookie. Useful for back reference * @type string
* Scope: jQuery.dataTable.classSettings * @default <i>Empty string</i>
*/ */
oLoadedState: null, "sCookiePrefix": "",
/* /**
* Variable: sAjaxSource * Callback function for cookie creation
* Purpose: Source url for AJAX data for the table * @type function
* Scope: jQuery.dataTable.classSettings * @default null
*/ */
sAjaxSource: null, "fnCookieCallback": null,
/* /**
* Variable: sAjaxDataProp * Array of callback functions for state saving. Each array element is an
* Purpose: Property from a given object from which to read the table data from. This can * object with the following parameters:
* be an empty string (when not server-side processing), in which case it is * <ul>
* assumed an an array is given directly. * <li>function:fn - function to call. Takes two parameters, oSettings
* Scope: jQuery.dataTable.classSettings * and the JSON string to save that has been thus far created. Returns
* a JSON string to be inserted into a json object
* (i.e. '"param": [ 0, 1, 2]')</li>
* <li>string:sName - name of callback</li>
* </ul>
* @type array
* @default []
*/ */
sAjaxDataProp: 'aaData', "aoStateSave": [],
/* /**
* Variable: bAjaxDataGet * Array of callback functions for state loading. Each array element is an
* Purpose: Note if draw should be blocked while getting data * object with the following parameters:
* Scope: jQuery.dataTable.classSettings * <ul>
* <li>function:fn - function to call. Takes two parameters, oSettings
* and the object stored. May return false to cancel state loading</li>
* <li>string:sName - name of callback</li>
* </ul>
* @type array
* @default []
*/ */
bAjaxDataGet: true, "aoStateLoad": [],
/* /**
* Variable: jqXHR * State that was loaded from the cookie. Useful for back reference
* Purpose: The last jQuery XHR object that was used for server-side data gathering. * @type object
* This can be used for working with the XHR information in one of the callbacks * @default null
* Scope: jQuery.dataTable.classSettings
*/ */
jqXHR: null, "oLoadedState": null,
/* /**
* Variable: fnServerData * Source url for AJAX data for the table
* Purpose: Function to get the server-side data - can be overruled by the developer * @type string
* Scope: jQuery.dataTable.classSettings * @default null
*/ */
fnServerData: function ( url, data, callback, settings ) { "sAjaxSource": null,
settings.jqXHR = $.ajax( {
"url": url,
"data": data,
"success": function (json) {
$(settings.oInstance).trigger('xhr', settings);
callback( json );
},
"dataType": "json",
"cache": false,
"type": settings.sServerMethod,
"error": function (xhr, error, thrown) {
if ( error == "parsererror" ) {
alert( "DataTables warning: JSON data from server could not be parsed. "+
"This is caused by a JSON formatting error." );
}
}
} );
},
/* /**
* Variable: aoServerParams * Property from a given object from which to read the table data from. This
* Purpose: Functions which are called prior to sending an Ajax request so extra parameters * can be an empty string (when not server-side processing), in which case
* can easily be sent to the server * it is assumed an an array is given directly.
* Scope: jQuery.dataTable.classSettings * @type string
* Notes: Each array element is an object with the following parameters: * @default aaData
* function:fn - function to call
* string:sName - name callback - useful for knowing where it came from (plugin etc)
*/ */
aoServerParams: [], "sAjaxDataProp": 'aaData',
/* /**
* Variable: sServerType * Note if draw should be blocked while getting data
* Purpose: Send the XHR HTTP method - GET or POST (could be PUT or DELETE if required) * @type boolean
* Scope: jQuery.dataTable.classSettings * @default true
*/ */
sServerMethod: "GET", "bAjaxDataGet": true,
/* /**
* Variable: fnFormatNumber * The last jQuery XHR object that was used for server-side data gathering.
* Purpose: Format numbers for display * This can be used for working with the XHR information in one of the
* Scope: jQuery.dataTable.classSettings * callbacks
* @type object
* @default null
*/ */
fnFormatNumber: function ( iIn ) "jqXHR": null,
{
if ( iIn < 1000 )
{
/* A small optimisation for what is likely to be the vast majority of use cases */
return iIn;
}
else
{
var s=(iIn+""), a=s.split(""), out="", iLen=s.length;
for ( var i=0 ; i<iLen ; i++ )
{
if ( i%3 === 0 && i !== 0 )
{
out = this.oLanguage.sInfoThousands+out;
}
out = a[iLen-i-1]+out;
}
}
return out;
},
/* /**
* Variable: aLengthMenu * Function to get the server-side data
* Purpose: List of options that can be used for the user selectable length menu * @type function
* Scope: jQuery.dataTable.classSettings * @default null
* Note: This varaible can take for form of a 1D array, in which case the value and the
* displayed value in the menu are the same, or a 2D array in which case the value comes
* from the first array, and the displayed value to the end user comes from the second
* array. 2D example: [ [ 10, 25, 50, 100, -1 ], [ 10, 25, 50, 100, 'All' ] ];
*/ */
aLengthMenu: [ 10, 25, 50, 100 ], "fnServerData": null,
/* /**
* Variable: iDraw * Functions which are called prior to sending an Ajax request so extra
* Purpose: Counter for the draws that the table does. Also used as a tracker for * parameters can easily be sent to the server
* server-side processing * @type array
* Scope: jQuery.dataTable.classSettings * @default []
*/ */
iDraw: 0, "aoServerParams": [],
/* /**
* Variable: bDrawing * Send the XHR HTTP method - GET or POST (could be PUT or DELETE if
* Purpose: Indicate if a redraw is being done - useful for Ajax * required)
* Scope: jQuery.dataTable.classSettings * @type string
* @default GET
*/ */
bDrawing: 0, "sServerMethod": "GET",
/* /**
* Variable: iDrawError * Format numbers for display
* Purpose: Last draw error * @type function
* Scope: jQuery.dataTable.classSettings * @default null
*/ */
iDrawError: -1, "fnFormatNumber": null,
/* /**
* Variable: _iDisplayLength, _iDisplayStart, _iDisplayEnd * List of options that can be used for the user selectable length menu
* Purpose: Display length variables * @type array
* Scope: jQuery.dataTable.classSettings * @default []
* Notes: These variable must NOT be used externally to get the data length. Rather, use
* the fnRecordsTotal() (etc) functions.
*/ */
_iDisplayLength: 10, "aLengthMenu": [],
_iDisplayStart: 0,
_iDisplayEnd: 10,
/* /**
* Variable: _iRecordsTotal, _iRecordsDisplay * Counter for the draws that the table does. Also used as a tracker for
* Purpose: Display length variables used for server side processing * server-side processing
* Scope: jQuery.dataTable.classSettings * @type int
* Notes: These variable must NOT be used externally to get the data length. Rather, use * @default 0
* the fnRecordsTotal() (etc) functions.
*/ */
_iRecordsTotal: 0, "iDraw": 0,
_iRecordsDisplay: 0,
/* /**
* Variable: bJUI * Indicate if a redraw is being done - useful for Ajax
* Purpose: Should we add the markup needed for jQuery UI theming? * @type boolean
* Scope: jQuery.dataTable.classSettings * @default false
*/ */
bJUI: false, "bDrawing": false,
/* /**
* Variable: oClasses * Draw index (iDraw) of the last error when parsing the returned data
* Purpose: Should we add the markup needed for jQuery UI theming? * @type int
* Scope: jQuery.dataTable.classSettings * @default -1
*/ */
oClasses: null, "iDrawError": -1,
/* /**
* Variable: bFiltered and bSorted * Paging display length
* Purpose: Flags to allow callback functions to see what actions have been performed * @type int
* Scope: jQuery.dataTable.classSettings * @default 10
*/ */
bFiltered: false, "_iDisplayLength": 10,
bSorted: false,
/**
* Paging start point - aiDisplay index
* @type int
* @default 0
*/
"_iDisplayStart": 0,
/**
* Paging end point - aiDisplay index. Use fnDisplayEnd rather than
* this property to get the end point
* @type int
* @default 10
* @private
*/
"_iDisplayEnd": 10,
/* /**
* Variable: bSortCellsTop * Server-side processing - number of records in the result set
* Purpose: Indicate that if multiple rows are in the header and there is more than one * (i.e. before filtering), Use fnRecordsTotal rather than
* unique cell per column, if the top one (true) or bottom one (false) should * this property to get the value of the number of records, regardless of
* be used for sorting / title by DataTables * the server-side processing setting.
* Scope: jQuery.dataTable.classSettings * @type int
* @default 0
* @private
*/ */
bSortCellsTop: false, "_iRecordsTotal": 0,
/**
* Server-side processing - number of records in the current display set
* (i.e. after filtering). Use fnRecordsDisplay rather than
* this property to get the value of the number of records, regardless of
* the server-side processing setting.
* @type boolean
* @default 0
* @private
*/
"_iRecordsDisplay": 0,
/* /**
* Variable: oInit * Flag to indicate if jQuery UI marking and classes should be used
* Purpose: Initialisation object that is used for the table * @type boolean
* Scope: jQuery.dataTable.classSettings * @default false
*/ */
oInit: null, "bJUI": false,
/* /**
* Variable: aoDestroyCallback * The classes to use for the table
* Purpose: Destroy callback functions * @type object
* Scope: jQuery.dataTable.classSettings * @default null
*/ */
aoDestroyCallback: [], "oClasses": null,
/**
* Flag attached to the settings object so you can check in the draw
* callback if filtering has been done in the draw. Deprecated in favour of
* events.
* @type boolean
* @default false
* @deprecated
*/
"bFiltered": false,
/**
* Flag attached to the settings object so you can check in the draw
* callback if sorting has been done in the draw. Deprecated in favour of
* events.
* @type boolean
* @default false
* @deprecated
*/
"bSorted": false,
/**
* Indicate that if multiple rows are in the header and there is more than
* one unique cell per column, if the top one (true) or bottom one (false)
* should be used for sorting / title by DataTables
* @type boolean
* @default false
*/
"bSortCellsTop": false,
/**
* Initialisation object that is used for the table
* @type object
* @default null
*/
"oInit": null,
/**
* Destroy callback functions - for plug-ins to attach themselves to the
* destroy so they can clean up markup and events.
* @type array
* @default []
*/
"aoDestroyCallback": [],
fnRecordsTotal: function () /**
* Get the number of records in the current record set, before filtering
* @type function
*/
"fnRecordsTotal": function ()
{ {
if ( this.oFeatures.bServerSide ) { if ( this.oFeatures.bServerSide ) {
return parseInt(this._iRecordsTotal, 10); return parseInt(this._iRecordsTotal, 10);
@ -9124,7 +9254,11 @@
} }
}, },
fnRecordsDisplay: function () /**
* Get the number of records in the current record set, after filtering
* @type function
*/
"fnRecordsDisplay": function ()
{ {
if ( this.oFeatures.bServerSide ) { if ( this.oFeatures.bServerSide ) {
return parseInt(this._iRecordsDisplay, 10); return parseInt(this._iRecordsDisplay, 10);
@ -9133,7 +9267,12 @@
} }
}, },
fnDisplayEnd: function () /**
* Set the display end point - aiDisplay index
* @type function
* @todo Should do away with _iDisplayEnd and calculate it on-the-fly here
*/
"fnDisplayEnd": function ()
{ {
if ( this.oFeatures.bServerSide ) { if ( this.oFeatures.bServerSide ) {
if ( this.oFeatures.bPaginate === false || this._iDisplayLength == -1 ) { if ( this.oFeatures.bPaginate === false || this._iDisplayLength == -1 ) {
@ -9147,21 +9286,21 @@
} }
}, },
/* /**
* Variable: oInstance * The DataTables object for this table
* Purpose: The DataTables object for this table * @type object
* Scope: jQuery.dataTable.classSettings * @default null
*/ */
oInstance: null, "oInstance": null,
/* /**
* Variable: sInstance * Unique identifier for each instance of the DataTables object. If there
* Purpose: Unique idendifier for each instance of the DataTables object * is an ID on the table node, then it takes that value, otherwise an
* Scope: jQuery.dataTable.classSettings * incrementing internal counter is used.
* @type string
* @default null
*/ */
sInstance: null, "sInstance": null
oClasses: null
}; };
@ -9470,6 +9609,39 @@
"sWidthOrig": null "sWidthOrig": null
}; };
/**
* Template object for the way in which DataTables holds information about
* search information for the global filter and individual column filters.
* @namespace
*/
DataTable.models.oSearch = {
/**
* Applied search term
* @type string
* @default <i>Empty string</i>
*/
"sSearch": "",
/**
* Flag to indicate if the search term should be interpreted as a
* regular expression (true) or not (false) and therefore and special
* regex characters escaped.
* @type boolean
* @default false
*/
"bRegex": false,
/**
* Flag to indicate if DataTables is to use its smart filtering or not.
* @type boolean
* @default true
*/
"bSmart": true
};
DataTable.ext = {}; DataTable.ext = {};

BIN
media/src/.DS_Store vendored

Binary file not shown.

View File

@ -93,6 +93,7 @@
require('model.settings.js'); require('model.settings.js');
require('model.row.js'); require('model.row.js');
require('model.column.js'); require('model.column.js');
require('model.search.js');
DataTable.ext = {}; DataTable.ext = {};

View File

@ -0,0 +1,33 @@
/**
* Template object for the way in which DataTables holds information about
* search information for the global filter and individual column filters.
* @namespace
*/
DataTable.models.oSearch = {
/**
* Applied search term
* @type string
* @default <i>Empty string</i>
*/
"sSearch": "",
/**
* Flag to indicate if the search term should be interpreted as a
* regular expression (true) or not (false) and therefore and special
* regex characters escaped.
* @type boolean
* @default false
*/
"bRegex": false,
/**
* Flag to indicate if DataTables is to use its smart filtering or not.
* @type boolean
* @default true
*/
"bSmart": true
};

View File

@ -6,599 +6,729 @@
*/ */
var _aoSettings = []; var _aoSettings = [];
/*
* Function: classSettings /**
* Purpose: Settings container function for all 'class' properties which are required * DataTables settings object - this holds all the information needed for a
* by dataTables * given table, including configuration, data and current application of the
* Returns: - * table options. DataTables does not have a single instance for each DataTable
* Inputs: - * with the settings attached to that instance, but rather instances of the
* DataTable "class" are created on-the-fly as needed (typically by a
* $().dataTable() call) and the settings object is then applied to that
* instance.
*
* Note that this object is related to {@link DataTable.models.oInit} but this
* one is the internal data store for DataTables's cache of columns. It should
* NOT be manipulated outside of DataTables. Any configuration should be done
* through the initialisation options.
* @namespace
* @todo Really should attach the settings object to individual instances so we
* don't need to create new instances on each $().dataTable() call (if the
* table already exists). It would also save passing oSettings around and
* into every single function. However, this is a very significant
* architecture change for DataTables and will almost certainly break
* backwards compatibility with older installations. This is something that
* will be done in 2.0.
*/ */
DataTable.models.oSettings = { DataTable.models.oSettings = {
/**
/* * Primary features of DataTables and their enablement state.
* Variable: oFeatures * @namespace
* Purpose: Indicate the enablement of key dataTable features
* Scope: jQuery.dataTable.classSettings
*/ */
oFeatures: { "oFeatures": {
"bPaginate": true,
"bLengthChange": true, /**
"bFilter": true, * Flag to say if DataTables should automatically try to calculate the
"bSort": true, * optimum table and columns widths (true) or not (false).
"bInfo": true, * @type boolean
* @default true
*/
"bAutoWidth": true, "bAutoWidth": true,
/**
* Delay the creation of TR and TD elements until they are actually
* needed by a driven page draw. This can give a significant speed
* increase for Ajax source and Javascript source data, but makes no
* difference at all fro DOM and server-side processing tables.
* @type boolean
* @default false
*/
"bDeferRender": false,
/**
* Enable filtering on the table or not. Note that if this is disabled
* then there is no filtering at all on the table, including fnFilter.
* To just remove the filtering input use sDom and remove the 'f' option
* @type boolean
* @default true
*/
"bFilter": true,
/**
* Table information element (the 'Showing x of y records' div) enable
* flag
* @type boolean
* @default true
*/
"bInfo": true,
/**
* Present a user control allowing the end user to change the page size
* when pagination is enabled.
* @type boolean
* @default true
*/
"bLengthChange": true,
/**
* Pagination enabled or not. Note that if this is disabled then length
* changing must also be disabled.
* @type boolean
* @default true
*/
"bPaginate": true,
/**
* Processing indicator enable flag whenever DataTables is enacting a
* user request - typically an Ajax request for server-side processing.
* @type boolean
* @default false
*/
"bProcessing": false, "bProcessing": false,
"bSortClasses": true,
"bStateSave": false, /**
* Server-side processing enabled flag - when enabled DataTables will
* get all data from the server for every draw - there is no filtering,
* sorting or paging done on the client-side.
* @type boolean
* @default false
*/
"bServerSide": false, "bServerSide": false,
"bDeferRender": false
/**
* Sorting enablement flag.
* @type boolean
* @default true
*/
"bSort": true,
/**
* Apply a class to the columns which are being sorted to provide a
* visual highlight or not. This can slow things down when enabled since
* there is a lot of DOM interaction.
* @type boolean
* @default true
*/
"bSortClasses": true,
/**
* State saving enablement flag.
* @type boolean
* @default false
*/
"bStateSave": false
}, },
/*
* Variable: oScroll /**
* Purpose: Container for scrolling options * Scrolling settings for a table.
* Scope: jQuery.dataTable.classSettings * @namespace
*/ */
oScroll: { "oScroll": {
"sX": "", /**
"sXInner": "", * Indicate if DataTables should be allowed to set the padding / margin
"sY": "", * etc for the scrolling header elements or not. Typically you will want
* this.
* @type boolean
* @default true
*/
"bAutoCss": true,
/**
* When the table is shorter in height than sScrollY, collapse the
* table container down to the height of the table (when true)
* @type boolean
* @default false
*/
"bCollapse": false, "bCollapse": false,
/**
* Infinite scrolling enablement flag. Now deprecated in favour of
* using the Scroller plug-in.
* @type boolean
* @default false
* @deprecated
*/
"bInfinite": false, "bInfinite": false,
"iLoadGap": 100,
/**
* Width of the scrollbar for the web-browser's platform. Calculated
* during table initialisation.
* @type int
* @default 0
*/
"iBarWidth": 0, "iBarWidth": 0,
"bAutoCss": true
/**
* Space (in pixels) between the bottom of the scrolling container and
* the bottom of the scrolling viewport before the next page is loaded
* when using infinite scrolling.
* @type int
* @default 100
* @deprecated
*/
"iLoadGap": 100,
/**
* Viewport width for horizontal scrolling. Horizontal scrolling is
* disabled if an empty string.
* @type string
* @default <i>Empty string</i>
*/
"sX": "",
/**
* Width to expand the table to when using x-scrolling. Typically you
* should not need to use this.
* @type string
* @default <i>Empty string</i>
* @deprecated
*/
"sXInner": "",
/**
* Viewport height for vertical scrolling. Vertical scrolling is disabled
* if an empty string.
* @type string
* @default <i>Empty string</i>
*/
"sY": ""
}, },
/* /**
* Variable: aanFeatures * Language information for the table.
* Purpose: Array referencing the nodes which are used for the features * @namespace
* Scope: jQuery.dataTable.classSettings * @extends DataTable.models.oInit.oLanguage
* Notes: The parameters of this object match what is allowed by sDom - i.e.
* 'l' - Length changing
* 'f' - Filtering input
* 't' - The table!
* 'i' - Information
* 'p' - Pagination
* 'r' - pRocessing
*/ */
aanFeatures: [], "oLanguage": {
/**
/* * Information callback function. See
* Variable: oLanguage * {@link DataTable.models.oInit.fnInfoCallback}
* Purpose: Store the language strings used by dataTables * @type function
* Scope: jQuery.dataTable.classSettings * @default
* Notes: The words in the format _VAR_ are variables which are dynamically replaced */
* by javascript
*/
oLanguage: {
"sProcessing": "Processing...",
"sLengthMenu": "Show _MENU_ entries",
"sZeroRecords": "No matching records found",
"sEmptyTable": "No data available in table",
"sLoadingRecords": "Loading...",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
"sInfoEmpty": "Showing 0 to 0 of 0 entries",
"sInfoFiltered": "(filtered from _MAX_ total entries)",
"sInfoPostFix": "",
"sInfoThousands": ",",
"sSearch": "Search:",
"sUrl": "",
"oPaginate": {
"sFirst": "First",
"sPrevious": "Previous",
"sNext": "Next",
"sLast": "Last"
},
"fnInfoCallback": null "fnInfoCallback": null
}, },
/* /**
* Variable: aoData * Array referencing the nodes which are used for the features. The
* Purpose: Store data information * parameters of this object match what is allowed by sDom - i.e.
* Scope: jQuery.dataTable.classSettings * <ul>
* Notes: This is an array of objects with the following parameters: * <li>'l' - Length changing</li>
* array: _aData - internal data - used for sorting / filtering etc * <li>'f' - Filtering input</li>
* node: nTr - display node * <li>'t' - The table!</li>
* array node: _anHidden - hidden TD nodes * <li>'i' - Information</li>
* string: _sRowStripe * <li>'p' - Pagination</li>
* <li>'r' - pRocessing</li>
* </ul>
* @type array
* @default []
*/ */
aoData: [], "aanFeatures": [],
/* /**
* Variable: aiDisplay * Store data information - see {@link DataTable.models.oRow} for detailed
* Purpose: Array of indexes which are in the current display (after filtering etc) * information.
* Scope: jQuery.dataTable.classSettings * @type array
* @default []
*/ */
aiDisplay: [], "aoData": [],
/* /**
* Variable: aiDisplayMaster * Array of indexes which are in the current display (after filtering etc)
* Purpose: Array of indexes for display - no filtering * @type array
* Scope: jQuery.dataTable.classSettings * @default []
*/ */
aiDisplayMaster: [], "aiDisplay": [],
/*
* Variable: aoColumns
* Purpose: Store information about each column that is in use
* Scope: jQuery.dataTable.classSettings
*/
aoColumns: [],
/*
* Variable: aoHeader
* Purpose: Store information about the table's header
* Scope: jQuery.dataTable.classSettings
*/
aoHeader: [],
/*
* Variable: aoFooter
* Purpose: Store information about the table's footer
* Scope: jQuery.dataTable.classSettings
*/
aoFooter: [],
/* /**
* Variable: asDataSearch * Array of indexes for display - no filtering
* Purpose: Search data array for regular expression searching * @type array
* Scope: jQuery.dataTable.classSettings * @default []
*/ */
asDataSearch: [], "aiDisplayMaster": [],
/* /**
* Variable: oPreviousSearch * Store information about each column that is in use
* Purpose: Store the previous search incase we want to force a re-search * @type array
* or compare the old search to a new one * @default []
* Scope: jQuery.dataTable.classSettings
*/ */
oPreviousSearch: { "aoColumns": [],
"sSearch": "",
"bRegex": false,
"bSmart": true
},
/* /**
* Variable: aoPreSearchCols * Store information about the table's header
* Purpose: Store the previous search for each column * @type array
* Scope: jQuery.dataTable.classSettings * @default []
*/ */
aoPreSearchCols: [], "aoHeader": [],
/* /**
* Variable: aaSorting * Store information about the table's footer
* Purpose: Sorting information * @type array
* Scope: jQuery.dataTable.classSettings * @default []
* Notes: Index 0 - column number
* Index 1 - current sorting direction
* Index 2 - index of asSorting for this column
*/ */
aaSorting: [ [0, 'asc', 0] ], "aoFooter": [],
/* /**
* Variable: aaSortingFixed * Search data array for regular expression searching
* Purpose: Sorting information that is always applied * @type array
* Scope: jQuery.dataTable.classSettings * @default []
*/ */
aaSortingFixed: null, "asDataSearch": [],
/* /**
* Variable: asStripeClasses * Store the applied global search information in case we want to force a
* Purpose: Classes to use for the striping of a table * research or compare the old search to a new one
* Scope: jQuery.dataTable.classSettings * @namespace
* @extends DataTable.models.oSearch
*/ */
asStripeClasses: [], "oPreviousSearch": {},
/* /**
* Variable: asDestroyStripes * Store the applied search for each column - see
* Purpose: If restoring a table - we should restore its striping classes as well * {@link DataTable.models.oSearch} for the format that is used for the
* Scope: jQuery.dataTable.classSettings * filtering information for each column.
* @type array
* @default []
*/ */
asDestroyStripes: [], "aoPreSearchCols": [],
/* /**
* Variable: sDestroyWidth * Sorting that is applied to the table. Note that the inner arrays are
* Purpose: If restoring a table - we should restore its width * used in the following manner:
* Scope: jQuery.dataTable.classSettings * <ul>
* <li>Index 0 - column number</li>
* <li>Index 1 - current sorting direction</li>
* <li>Index 2 - index of asSorting for this column</li>
* </ul>
* @type array
* @default [[0, 'asc', 0]]
* @todo These inner arrays should really be objects
*/ */
sDestroyWidth: 0, "aaSorting": [[0, 'asc', 0]],
/* /**
* Variable: fnRowCallback * Sorting that is always applied to the table (i.e. prefixed in front of
* Purpose: Call this function every time a row is inserted (draw) * aaSorting).
* Scope: jQuery.dataTable.classSettings * @type array|null
* @default null
*/ */
fnRowCallback: null, "aaSortingFixed": null,
/* /**
* Variable: fnHeaderCallback * Classes to use for the striping of a table
* Purpose: Callback function for the header on each draw * @type array
* Scope: jQuery.dataTable.classSettings * @default []
*/ */
fnHeaderCallback: null, "asStripeClasses": [],
/* /**
* Variable: fnFooterCallback * If restoring a table - we should restore its striping classes as well
* Purpose: Callback function for the footer on each draw * @type array
* Scope: jQuery.dataTable.classSettings * @default []
*/ */
fnFooterCallback: null, "asDestroyStripes": [],
/* /**
* Variable: aoDrawCallback * If restoring a table - we should restore its width
* Purpose: Array of callback functions for draw callback functions * @type int
* Scope: jQuery.dataTable.classSettings * @default 0
* Notes: Each array element is an object with the following parameters:
* function:fn - function to call
* string:sName - name callback (feature). useful for arranging array
*/ */
aoDrawCallback: [], "sDestroyWidth": 0,
/* /**
* Variable: fnPreDrawCallback * Call this function every time a row is inserted (draw)
* Purpose: Callback function for just before the table is redrawn. A return of false * @type function
* will be used to cancel the draw. * @default null
* Scope: jQuery.dataTable.classSettings * @todo Make into an array so plug-ins can hook in
*/ */
fnPreDrawCallback: null, "fnRowCallback": null,
/* /**
* Variable: fnInitComplete * Callback function for the header on each draw
* Purpose: Callback function for when the table has been initialised * @type function
* Scope: jQuery.dataTable.classSettings * @default null
* @todo Make into an array so plug-ins can hook in
*/ */
fnInitComplete: null, "fnHeaderCallback": null,
/* /**
* Variable: sTableId * Callback function for the footer on each draw
* Purpose: Cache the table ID for quick access * @type function
* Scope: jQuery.dataTable.classSettings * @default null
* @todo Make into an array so plug-ins can hook in
*/ */
sTableId: "", "fnFooterCallback": null,
/* /**
* Variable: nTable * Array of callback functions for draw callback functions
* Purpose: Cache the table node for quick access * @type array
* Scope: jQuery.dataTable.classSettings * @default []
*/ */
nTable: null, "aoDrawCallback": [],
/* /**
* Variable: nTHead * Callback function for just before the table is redrawn. A return of
* Purpose: Permanent ref to the thead element * false will be used to cancel the draw.
* Scope: jQuery.dataTable.classSettings * @type function
* @default null
* @todo Make into an array so plug-ins can hook in
*/ */
nTHead: null, "fnPreDrawCallback": null,
/* /**
* Variable: nTFoot * Callback function for when the table has been initialised
* Purpose: Permanent ref to the tfoot element - if it exists * @type function
* Scope: jQuery.dataTable.classSettings * @default null
* @todo Make into an array so plug-ins can hook in
*/ */
nTFoot: null, "fnInitComplete": null,
/* /**
* Variable: nTBody * Cache the table ID for quick access
* Purpose: Permanent ref to the tbody element * @type string
* Scope: jQuery.dataTable.classSettings * @default <i>Empty string</i>
*/ */
nTBody: null, "sTableId": "",
/* /**
* Variable: nTableWrapper * The TABLE node for the main table
* Purpose: Cache the wrapper node (contains all DataTables controlled elements) * @type node
* Scope: jQuery.dataTable.classSettings * @default null
*/ */
nTableWrapper: null, "nTable": null,
/* /**
* Variable: bDeferLoading * Permanent ref to the thead element
* Purpose: Indicate if when using server-side processing the loading of data * @type node
* should be deferred until the second draw * @default null
* Scope: jQuery.dataTable.classSettings
*/ */
bDeferLoading: false, "nTHead": null,
/* /**
* Variable: bInitialised * Permanent ref to the tfoot element - if it exists
* Purpose: Indicate if all required information has been read in * @type node
* Scope: jQuery.dataTable.classSettings * @default null
*/ */
bInitialised: false, "nTFoot": null,
/* /**
* Variable: aoOpenRows * Permanent ref to the tbody element
* Purpose: Information about open rows * @type node
* Scope: jQuery.dataTable.classSettings * @default null
* Notes: Has the parameters 'nTr' and 'nParent'
*/ */
aoOpenRows: [], "nTBody": null,
/* /**
* Variable: sDom * Cache the wrapper node (contains all DataTables controlled elements)
* Purpose: Dictate the positioning that the created elements will take * @type node
* Scope: jQuery.dataTable.classSettings * @default null
* Notes:
* The following options are allowed:
* 'l' - Length changing
* 'f' - Filtering input
* 't' - The table!
* 'i' - Information
* 'p' - Pagination
* 'r' - pRocessing
* The following constants are allowed:
* 'H' - jQueryUI theme "header" classes
* 'F' - jQueryUI theme "footer" classes
* The following syntax is expected:
* '<' and '>' - div elements
* '<"class" and '>' - div with a class
* Examples:
* '<"wrapper"flipt>', '<lf<t>ip>'
*/ */
sDom: 'lfrtip', "nTableWrapper": null,
/* /**
* Variable: sPaginationType * Indicate if when using server-side processing the loading of data
* Purpose: Note which type of sorting should be used * should be deferred until the second draw
* Scope: jQuery.dataTable.classSettings * @type boolean
* @default false
*/ */
sPaginationType: "two_button", "bDeferLoading": false,
/* /**
* Variable: iCookieDuration * Indicate if all required information has been read in
* Purpose: The cookie duration (for bStateSave) in seconds - default 2 hours * @type boolean
* Scope: jQuery.dataTable.classSettings * @default false
*/ */
iCookieDuration: 60 * 60 * 2, "bInitialised": false,
/* /**
* Variable: sCookiePrefix * Information about open rows. Each object in the array has the parameters
* Purpose: The cookie name prefix * 'nTr' and 'nParent'
* Scope: jQuery.dataTable.classSettings * @type array
* @default []
*/ */
sCookiePrefix: "SpryMedia_DataTables_", "aoOpenRows": [],
/* /**
* Variable: fnCookieCallback * Dictate the positioning of DataTables' control elements - see
* Purpose: Callback function for cookie creation * {@link DataTable.model.oInit.sDom}.
* Scope: jQuery.dataTable.classSettings * @type string
* @default null
*/ */
fnCookieCallback: null, "sDom": null,
/* /**
* Variable: aoStateSave * Which type of pagination should be used
* Purpose: Array of callback functions for state saving * @type string
* Scope: jQuery.dataTable.classSettings * @default two_button
* Notes: Each array element is an object with the following parameters:
* function:fn - function to call. Takes two parameters, oSettings and the JSON string to
* save that has been thus far created. Returns a JSON string to be inserted into a
* json object (i.e. '"param": [ 0, 1, 2]')
* string:sName - name of callback
*/ */
aoStateSave: [], "sPaginationType": "two_button",
/* /**
* Variable: aoStateLoad * The cookie duration (for bStateSave) in seconds
* Purpose: Array of callback functions for state loading * @type int
* Scope: jQuery.dataTable.classSettings * @default 0
* Notes: Each array element is an object with the following parameters:
* function:fn - function to call. Takes two parameters, oSettings and the object stored.
* May return false to cancel state loading.
* string:sName - name of callback
*/ */
aoStateLoad: [], "iCookieDuration": 0,
/* /**
* Variable: oLoadedState * The cookie name prefix
* Purpose: State that was loaded from the cookie. Useful for back reference * @type string
* Scope: jQuery.dataTable.classSettings * @default <i>Empty string</i>
*/ */
oLoadedState: null, "sCookiePrefix": "",
/* /**
* Variable: sAjaxSource * Callback function for cookie creation
* Purpose: Source url for AJAX data for the table * @type function
* Scope: jQuery.dataTable.classSettings * @default null
*/ */
sAjaxSource: null, "fnCookieCallback": null,
/* /**
* Variable: sAjaxDataProp * Array of callback functions for state saving. Each array element is an
* Purpose: Property from a given object from which to read the table data from. This can * object with the following parameters:
* be an empty string (when not server-side processing), in which case it is * <ul>
* assumed an an array is given directly. * <li>function:fn - function to call. Takes two parameters, oSettings
* Scope: jQuery.dataTable.classSettings * and the JSON string to save that has been thus far created. Returns
* a JSON string to be inserted into a json object
* (i.e. '"param": [ 0, 1, 2]')</li>
* <li>string:sName - name of callback</li>
* </ul>
* @type array
* @default []
*/ */
sAjaxDataProp: 'aaData', "aoStateSave": [],
/* /**
* Variable: bAjaxDataGet * Array of callback functions for state loading. Each array element is an
* Purpose: Note if draw should be blocked while getting data * object with the following parameters:
* Scope: jQuery.dataTable.classSettings * <ul>
* <li>function:fn - function to call. Takes two parameters, oSettings
* and the object stored. May return false to cancel state loading</li>
* <li>string:sName - name of callback</li>
* </ul>
* @type array
* @default []
*/ */
bAjaxDataGet: true, "aoStateLoad": [],
/* /**
* Variable: jqXHR * State that was loaded from the cookie. Useful for back reference
* Purpose: The last jQuery XHR object that was used for server-side data gathering. * @type object
* This can be used for working with the XHR information in one of the callbacks * @default null
* Scope: jQuery.dataTable.classSettings
*/ */
jqXHR: null, "oLoadedState": null,
/* /**
* Variable: fnServerData * Source url for AJAX data for the table
* Purpose: Function to get the server-side data - can be overruled by the developer * @type string
* Scope: jQuery.dataTable.classSettings * @default null
*/ */
fnServerData: function ( url, data, callback, settings ) { "sAjaxSource": null,
settings.jqXHR = $.ajax( {
"url": url,
"data": data,
"success": function (json) {
$(settings.oInstance).trigger('xhr', settings);
callback( json );
},
"dataType": "json",
"cache": false,
"type": settings.sServerMethod,
"error": function (xhr, error, thrown) {
if ( error == "parsererror" ) {
alert( "DataTables warning: JSON data from server could not be parsed. "+
"This is caused by a JSON formatting error." );
}
}
} );
},
/* /**
* Variable: aoServerParams * Property from a given object from which to read the table data from. This
* Purpose: Functions which are called prior to sending an Ajax request so extra parameters * can be an empty string (when not server-side processing), in which case
* can easily be sent to the server * it is assumed an an array is given directly.
* Scope: jQuery.dataTable.classSettings * @type string
* Notes: Each array element is an object with the following parameters: * @default aaData
* function:fn - function to call
* string:sName - name callback - useful for knowing where it came from (plugin etc)
*/ */
aoServerParams: [], "sAjaxDataProp": 'aaData',
/* /**
* Variable: sServerType * Note if draw should be blocked while getting data
* Purpose: Send the XHR HTTP method - GET or POST (could be PUT or DELETE if required) * @type boolean
* Scope: jQuery.dataTable.classSettings * @default true
*/ */
sServerMethod: "GET", "bAjaxDataGet": true,
/* /**
* Variable: fnFormatNumber * The last jQuery XHR object that was used for server-side data gathering.
* Purpose: Format numbers for display * This can be used for working with the XHR information in one of the
* Scope: jQuery.dataTable.classSettings * callbacks
* @type object
* @default null
*/ */
fnFormatNumber: function ( iIn ) "jqXHR": null,
{
if ( iIn < 1000 )
{
/* A small optimisation for what is likely to be the vast majority of use cases */
return iIn;
}
else
{
var s=(iIn+""), a=s.split(""), out="", iLen=s.length;
for ( var i=0 ; i<iLen ; i++ )
{
if ( i%3 === 0 && i !== 0 )
{
out = this.oLanguage.sInfoThousands+out;
}
out = a[iLen-i-1]+out;
}
}
return out;
},
/* /**
* Variable: aLengthMenu * Function to get the server-side data
* Purpose: List of options that can be used for the user selectable length menu * @type function
* Scope: jQuery.dataTable.classSettings * @default null
* Note: This varaible can take for form of a 1D array, in which case the value and the
* displayed value in the menu are the same, or a 2D array in which case the value comes
* from the first array, and the displayed value to the end user comes from the second
* array. 2D example: [ [ 10, 25, 50, 100, -1 ], [ 10, 25, 50, 100, 'All' ] ];
*/ */
aLengthMenu: [ 10, 25, 50, 100 ], "fnServerData": null,
/* /**
* Variable: iDraw * Functions which are called prior to sending an Ajax request so extra
* Purpose: Counter for the draws that the table does. Also used as a tracker for * parameters can easily be sent to the server
* server-side processing * @type array
* Scope: jQuery.dataTable.classSettings * @default []
*/ */
iDraw: 0, "aoServerParams": [],
/* /**
* Variable: bDrawing * Send the XHR HTTP method - GET or POST (could be PUT or DELETE if
* Purpose: Indicate if a redraw is being done - useful for Ajax * required)
* Scope: jQuery.dataTable.classSettings * @type string
* @default GET
*/ */
bDrawing: 0, "sServerMethod": "GET",
/* /**
* Variable: iDrawError * Format numbers for display
* Purpose: Last draw error * @type function
* Scope: jQuery.dataTable.classSettings * @default null
*/ */
iDrawError: -1, "fnFormatNumber": null,
/* /**
* Variable: _iDisplayLength, _iDisplayStart, _iDisplayEnd * List of options that can be used for the user selectable length menu
* Purpose: Display length variables * @type array
* Scope: jQuery.dataTable.classSettings * @default []
* Notes: These variable must NOT be used externally to get the data length. Rather, use
* the fnRecordsTotal() (etc) functions.
*/ */
_iDisplayLength: 10, "aLengthMenu": [],
_iDisplayStart: 0,
_iDisplayEnd: 10,
/* /**
* Variable: _iRecordsTotal, _iRecordsDisplay * Counter for the draws that the table does. Also used as a tracker for
* Purpose: Display length variables used for server side processing * server-side processing
* Scope: jQuery.dataTable.classSettings * @type int
* Notes: These variable must NOT be used externally to get the data length. Rather, use * @default 0
* the fnRecordsTotal() (etc) functions.
*/ */
_iRecordsTotal: 0, "iDraw": 0,
_iRecordsDisplay: 0,
/* /**
* Variable: bJUI * Indicate if a redraw is being done - useful for Ajax
* Purpose: Should we add the markup needed for jQuery UI theming? * @type boolean
* Scope: jQuery.dataTable.classSettings * @default false
*/ */
bJUI: false, "bDrawing": false,
/* /**
* Variable: oClasses * Draw index (iDraw) of the last error when parsing the returned data
* Purpose: Should we add the markup needed for jQuery UI theming? * @type int
* Scope: jQuery.dataTable.classSettings * @default -1
*/ */
oClasses: null, "iDrawError": -1,
/* /**
* Variable: bFiltered and bSorted * Paging display length
* Purpose: Flags to allow callback functions to see what actions have been performed * @type int
* Scope: jQuery.dataTable.classSettings * @default 10
*/ */
bFiltered: false, "_iDisplayLength": 10,
bSorted: false,
/**
* Paging start point - aiDisplay index
* @type int
* @default 0
*/
"_iDisplayStart": 0,
/**
* Paging end point - aiDisplay index. Use fnDisplayEnd rather than
* this property to get the end point
* @type int
* @default 10
* @private
*/
"_iDisplayEnd": 10,
/* /**
* Variable: bSortCellsTop * Server-side processing - number of records in the result set
* Purpose: Indicate that if multiple rows are in the header and there is more than one * (i.e. before filtering), Use fnRecordsTotal rather than
* unique cell per column, if the top one (true) or bottom one (false) should * this property to get the value of the number of records, regardless of
* be used for sorting / title by DataTables * the server-side processing setting.
* Scope: jQuery.dataTable.classSettings * @type int
* @default 0
* @private
*/ */
bSortCellsTop: false, "_iRecordsTotal": 0,
/**
* Server-side processing - number of records in the current display set
* (i.e. after filtering). Use fnRecordsDisplay rather than
* this property to get the value of the number of records, regardless of
* the server-side processing setting.
* @type boolean
* @default 0
* @private
*/
"_iRecordsDisplay": 0,
/* /**
* Variable: oInit * Flag to indicate if jQuery UI marking and classes should be used
* Purpose: Initialisation object that is used for the table * @type boolean
* Scope: jQuery.dataTable.classSettings * @default false
*/ */
oInit: null, "bJUI": false,
/* /**
* Variable: aoDestroyCallback * The classes to use for the table
* Purpose: Destroy callback functions * @type object
* Scope: jQuery.dataTable.classSettings * @default null
*/ */
aoDestroyCallback: [], "oClasses": null,
/**
* Flag attached to the settings object so you can check in the draw
* callback if filtering has been done in the draw. Deprecated in favour of
* events.
* @type boolean
* @default false
* @deprecated
*/
"bFiltered": false,
/**
* Flag attached to the settings object so you can check in the draw
* callback if sorting has been done in the draw. Deprecated in favour of
* events.
* @type boolean
* @default false
* @deprecated
*/
"bSorted": false,
/**
* Indicate that if multiple rows are in the header and there is more than
* one unique cell per column, if the top one (true) or bottom one (false)
* should be used for sorting / title by DataTables
* @type boolean
* @default false
*/
"bSortCellsTop": false,
/**
* Initialisation object that is used for the table
* @type object
* @default null
*/
"oInit": null,
/**
* Destroy callback functions - for plug-ins to attach themselves to the
* destroy so they can clean up markup and events.
* @type array
* @default []
*/
"aoDestroyCallback": [],
fnRecordsTotal: function () /**
* Get the number of records in the current record set, before filtering
* @type function
*/
"fnRecordsTotal": function ()
{ {
if ( this.oFeatures.bServerSide ) { if ( this.oFeatures.bServerSide ) {
return parseInt(this._iRecordsTotal, 10); return parseInt(this._iRecordsTotal, 10);
@ -607,7 +737,11 @@ DataTable.models.oSettings = {
} }
}, },
fnRecordsDisplay: function () /**
* Get the number of records in the current record set, after filtering
* @type function
*/
"fnRecordsDisplay": function ()
{ {
if ( this.oFeatures.bServerSide ) { if ( this.oFeatures.bServerSide ) {
return parseInt(this._iRecordsDisplay, 10); return parseInt(this._iRecordsDisplay, 10);
@ -616,7 +750,12 @@ DataTable.models.oSettings = {
} }
}, },
fnDisplayEnd: function () /**
* Set the display end point - aiDisplay index
* @type function
* @todo Should do away with _iDisplayEnd and calculate it on-the-fly here
*/
"fnDisplayEnd": function ()
{ {
if ( this.oFeatures.bServerSide ) { if ( this.oFeatures.bServerSide ) {
if ( this.oFeatures.bPaginate === false || this._iDisplayLength == -1 ) { if ( this.oFeatures.bPaginate === false || this._iDisplayLength == -1 ) {
@ -630,19 +769,19 @@ DataTable.models.oSettings = {
} }
}, },
/* /**
* Variable: oInstance * The DataTables object for this table
* Purpose: The DataTables object for this table * @type object
* Scope: jQuery.dataTable.classSettings * @default null
*/ */
oInstance: null, "oInstance": null,
/* /**
* Variable: sInstance * Unique identifier for each instance of the DataTables object. If there
* Purpose: Unique idendifier for each instance of the DataTables object * is an ID on the table node, then it takes that value, otherwise an
* Scope: jQuery.dataTable.classSettings * incrementing internal counter is used.
* @type string
* @default null
*/ */
sInstance: null, "sInstance": null
oClasses: null
}; };