mirror of
https://github.com/DataTables/DataTables.git
synced 2025-02-18 16:54:14 +01:00
First pass are using $.extend for the settings and initialsation objects.
Back into a state where the zero config will work
This commit is contained in:
parent
4853e868d4
commit
d20b87f885
3116
media/js/jquery.dataTables.js
vendored
3116
media/js/jquery.dataTables.js
vendored
@ -29,702 +29,6 @@
|
||||
|
||||
(function($, window, document) {
|
||||
|
||||
var oModels = {};
|
||||
var modelInit = {
|
||||
"a": 1
|
||||
};
|
||||
|
||||
/*
|
||||
* Variable: dataTableSettings
|
||||
* Purpose: Store the settings for each dataTables instance
|
||||
* Scope: jQuery.fn
|
||||
*/
|
||||
var _aoSettings = [];
|
||||
|
||||
/*
|
||||
* Function: classSettings
|
||||
* Purpose: Settings container function for all 'class' properties which are required
|
||||
* by dataTables
|
||||
* Returns: -
|
||||
* Inputs: -
|
||||
*/
|
||||
var classSettings = {
|
||||
|
||||
/*
|
||||
* Variable: oFeatures
|
||||
* Purpose: Indicate the enablement of key dataTable features
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
oFeatures: {
|
||||
"bPaginate": true,
|
||||
"bLengthChange": true,
|
||||
"bFilter": true,
|
||||
"bSort": true,
|
||||
"bInfo": true,
|
||||
"bAutoWidth": true,
|
||||
"bProcessing": false,
|
||||
"bSortClasses": true,
|
||||
"bStateSave": false,
|
||||
"bServerSide": false,
|
||||
"bDeferRender": false
|
||||
},
|
||||
|
||||
/*
|
||||
* Variable: oScroll
|
||||
* Purpose: Container for scrolling options
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
oScroll: {
|
||||
"sX": "",
|
||||
"sXInner": "",
|
||||
"sY": "",
|
||||
"bCollapse": false,
|
||||
"bInfinite": false,
|
||||
"iLoadGap": 100,
|
||||
"iBarWidth": 0,
|
||||
"bAutoCss": true
|
||||
},
|
||||
|
||||
/*
|
||||
* Variable: aanFeatures
|
||||
* Purpose: Array referencing the nodes which are used for the features
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* 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: [],
|
||||
|
||||
/*
|
||||
* Variable: oLanguage
|
||||
* Purpose: Store the language strings used by dataTables
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* 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
|
||||
},
|
||||
|
||||
/*
|
||||
* Variable: aoData
|
||||
* Purpose: Store data information
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* Notes: This is an array of objects with the following parameters:
|
||||
* int: _iId - internal id for tracking
|
||||
* array: _aData - internal data - used for sorting / filtering etc
|
||||
* node: nTr - display node
|
||||
* array node: _anHidden - hidden TD nodes
|
||||
* string: _sRowStripe
|
||||
*/
|
||||
aoData: [],
|
||||
|
||||
/*
|
||||
* Variable: aiDisplay
|
||||
* Purpose: Array of indexes which are in the current display (after filtering etc)
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
aiDisplay: [],
|
||||
|
||||
/*
|
||||
* Variable: aiDisplayMaster
|
||||
* Purpose: Array of indexes for display - no filtering
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
aiDisplayMaster: [],
|
||||
|
||||
/*
|
||||
* 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: iNextId
|
||||
* Purpose: Store the next unique id to be used for a new row
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
iNextId: 0,
|
||||
|
||||
/*
|
||||
* Variable: asDataSearch
|
||||
* Purpose: Search data array for regular expression searching
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
asDataSearch: [],
|
||||
|
||||
/*
|
||||
* Variable: oPreviousSearch
|
||||
* Purpose: Store the previous search incase we want to force a re-search
|
||||
* or compare the old search to a new one
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
oPreviousSearch: {
|
||||
"sSearch": "",
|
||||
"bRegex": false,
|
||||
"bSmart": true
|
||||
},
|
||||
|
||||
/*
|
||||
* Variable: aoPreSearchCols
|
||||
* Purpose: Store the previous search for each column
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
aoPreSearchCols: [],
|
||||
|
||||
/*
|
||||
* Variable: aaSorting
|
||||
* Purpose: Sorting information
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* Notes: Index 0 - column number
|
||||
* Index 1 - current sorting direction
|
||||
* Index 2 - index of asSorting for this column
|
||||
*/
|
||||
aaSorting: [ [0, 'asc', 0] ],
|
||||
|
||||
/*
|
||||
* Variable: aaSortingFixed
|
||||
* Purpose: Sorting information that is always applied
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
aaSortingFixed: null,
|
||||
|
||||
/*
|
||||
* Variable: asStripeClasses
|
||||
* Purpose: Classes to use for the striping of a table
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
asStripeClasses: [],
|
||||
|
||||
/*
|
||||
* Variable: asDestroyStripes
|
||||
* Purpose: If restoring a table - we should restore its striping classes as well
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
asDestroyStripes: [],
|
||||
|
||||
/*
|
||||
* Variable: sDestroyWidth
|
||||
* Purpose: If restoring a table - we should restore its width
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
sDestroyWidth: 0,
|
||||
|
||||
/*
|
||||
* Variable: fnRowCallback
|
||||
* Purpose: Call this function every time a row is inserted (draw)
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
fnRowCallback: null,
|
||||
|
||||
/*
|
||||
* Variable: fnHeaderCallback
|
||||
* Purpose: Callback function for the header on each draw
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
fnHeaderCallback: null,
|
||||
|
||||
/*
|
||||
* Variable: fnFooterCallback
|
||||
* Purpose: Callback function for the footer on each draw
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
fnFooterCallback: null,
|
||||
|
||||
/*
|
||||
* Variable: aoDrawCallback
|
||||
* Purpose: Array of callback functions for draw callback functions
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* 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: [],
|
||||
|
||||
/*
|
||||
* Variable: fnPreDrawCallback
|
||||
* Purpose: Callback function for just before the table is redrawn. A return of false
|
||||
* will be used to cancel the draw.
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
fnPreDrawCallback: null,
|
||||
|
||||
/*
|
||||
* Variable: fnInitComplete
|
||||
* Purpose: Callback function for when the table has been initialised
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
fnInitComplete: null,
|
||||
|
||||
/*
|
||||
* Variable: sTableId
|
||||
* Purpose: Cache the table ID for quick access
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
sTableId: "",
|
||||
|
||||
/*
|
||||
* Variable: nTable
|
||||
* Purpose: Cache the table node for quick access
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
nTable: null,
|
||||
|
||||
/*
|
||||
* Variable: nTHead
|
||||
* Purpose: Permanent ref to the thead element
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
nTHead: null,
|
||||
|
||||
/*
|
||||
* Variable: nTFoot
|
||||
* Purpose: Permanent ref to the tfoot element - if it exists
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
nTFoot: null,
|
||||
|
||||
/*
|
||||
* Variable: nTBody
|
||||
* Purpose: Permanent ref to the tbody element
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
nTBody: null,
|
||||
|
||||
/*
|
||||
* Variable: nTableWrapper
|
||||
* Purpose: Cache the wrapper node (contains all DataTables controlled elements)
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
nTableWrapper: null,
|
||||
|
||||
/*
|
||||
* Variable: bDeferLoading
|
||||
* Purpose: Indicate if when using server-side processing the loading of data
|
||||
* should be deferred until the second draw
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
bDeferLoading: false,
|
||||
|
||||
/*
|
||||
* Variable: bInitialised
|
||||
* Purpose: Indicate if all required information has been read in
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
bInitialised: false,
|
||||
|
||||
/*
|
||||
* Variable: aoOpenRows
|
||||
* Purpose: Information about open rows
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* Notes: Has the parameters 'nTr' and 'nParent'
|
||||
*/
|
||||
aoOpenRows: [],
|
||||
|
||||
/*
|
||||
* Variable: sDom
|
||||
* Purpose: Dictate the positioning that the created elements will take
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* 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',
|
||||
|
||||
/*
|
||||
* Variable: sPaginationType
|
||||
* Purpose: Note which type of sorting should be used
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
sPaginationType: "two_button",
|
||||
|
||||
/*
|
||||
* Variable: iCookieDuration
|
||||
* Purpose: The cookie duration (for bStateSave) in seconds - default 2 hours
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
iCookieDuration: 60 * 60 * 2,
|
||||
|
||||
/*
|
||||
* Variable: sCookiePrefix
|
||||
* Purpose: The cookie name prefix
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
sCookiePrefix: "SpryMedia_DataTables_",
|
||||
|
||||
/*
|
||||
* Variable: fnCookieCallback
|
||||
* Purpose: Callback function for cookie creation
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
fnCookieCallback: null,
|
||||
|
||||
/*
|
||||
* Variable: aoStateSave
|
||||
* Purpose: Array of callback functions for state saving
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* 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: [],
|
||||
|
||||
/*
|
||||
* Variable: aoStateLoad
|
||||
* Purpose: Array of callback functions for state loading
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* 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: [],
|
||||
|
||||
/*
|
||||
* Variable: oLoadedState
|
||||
* Purpose: State that was loaded from the cookie. Useful for back reference
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
oLoadedState: null,
|
||||
|
||||
/*
|
||||
* Variable: sAjaxSource
|
||||
* Purpose: Source url for AJAX data for the table
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
sAjaxSource: null,
|
||||
|
||||
/*
|
||||
* Variable: sAjaxDataProp
|
||||
* Purpose: Property from a given object from which to read the table data from. This can
|
||||
* be an empty string (when not server-side processing), in which case it is
|
||||
* assumed an an array is given directly.
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
sAjaxDataProp: 'aaData',
|
||||
|
||||
/*
|
||||
* Variable: bAjaxDataGet
|
||||
* Purpose: Note if draw should be blocked while getting data
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
bAjaxDataGet: true,
|
||||
|
||||
/*
|
||||
* Variable: jqXHR
|
||||
* Purpose: The last jQuery XHR object that was used for server-side data gathering.
|
||||
* This can be used for working with the XHR information in one of the callbacks
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
jqXHR: null,
|
||||
|
||||
/*
|
||||
* Variable: fnServerData
|
||||
* Purpose: Function to get the server-side data - can be overruled by the developer
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
fnServerData: function ( url, data, callback, settings ) {
|
||||
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
|
||||
* Purpose: Functions which are called prior to sending an Ajax request so extra parameters
|
||||
* can easily be sent to the server
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* Notes: Each array element is an object with the following parameters:
|
||||
* function:fn - function to call
|
||||
* string:sName - name callback - useful for knowing where it came from (plugin etc)
|
||||
*/
|
||||
aoServerParams: [],
|
||||
|
||||
/*
|
||||
* Variable: sServerType
|
||||
* Purpose: Send the XHR HTTP method - GET or POST (could be PUT or DELETE if required)
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
sServerMethod: "GET",
|
||||
|
||||
/*
|
||||
* Variable: fnFormatNumber
|
||||
* Purpose: Format numbers for display
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
fnFormatNumber: function ( iIn )
|
||||
{
|
||||
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
|
||||
* Purpose: List of options that can be used for the user selectable length menu
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* 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 ],
|
||||
|
||||
/*
|
||||
* Variable: iDraw
|
||||
* Purpose: Counter for the draws that the table does. Also used as a tracker for
|
||||
* server-side processing
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
iDraw: 0,
|
||||
|
||||
/*
|
||||
* Variable: bDrawing
|
||||
* Purpose: Indicate if a redraw is being done - useful for Ajax
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
bDrawing: 0,
|
||||
|
||||
/*
|
||||
* Variable: iDrawError
|
||||
* Purpose: Last draw error
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
iDrawError: -1,
|
||||
|
||||
/*
|
||||
* Variable: _iDisplayLength, _iDisplayStart, _iDisplayEnd
|
||||
* Purpose: Display length variables
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* Notes: These variable must NOT be used externally to get the data length. Rather, use
|
||||
* the fnRecordsTotal() (etc) functions.
|
||||
*/
|
||||
_iDisplayLength: 10,
|
||||
_iDisplayStart: 0,
|
||||
_iDisplayEnd: 10,
|
||||
|
||||
/*
|
||||
* Variable: _iRecordsTotal, _iRecordsDisplay
|
||||
* Purpose: Display length variables used for server side processing
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* Notes: These variable must NOT be used externally to get the data length. Rather, use
|
||||
* the fnRecordsTotal() (etc) functions.
|
||||
*/
|
||||
_iRecordsTotal: 0,
|
||||
_iRecordsDisplay: 0,
|
||||
|
||||
/*
|
||||
* Variable: bJUI
|
||||
* Purpose: Should we add the markup needed for jQuery UI theming?
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
bJUI: false,
|
||||
|
||||
/*
|
||||
* Variable: oClasses
|
||||
* Purpose: Should we add the markup needed for jQuery UI theming?
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
oClasses: null,
|
||||
|
||||
/*
|
||||
* Variable: bFiltered and bSorted
|
||||
* Purpose: Flags to allow callback functions to see what actions have been performed
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
bFiltered: false,
|
||||
bSorted: false,
|
||||
|
||||
/*
|
||||
* Variable: bSortCellsTop
|
||||
* Purpose: 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
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
bSortCellsTop: false,
|
||||
|
||||
/*
|
||||
* Variable: oInit
|
||||
* Purpose: Initialisation object that is used for the table
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
oInit: null,
|
||||
|
||||
/*
|
||||
* Variable: aoDestroyCallback
|
||||
* Purpose: Destroy callback functions
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
aoDestroyCallback: [],
|
||||
|
||||
|
||||
fnRecordsTotal: function ()
|
||||
{
|
||||
if ( this.oFeatures.bServerSide ) {
|
||||
return parseInt(this._iRecordsTotal, 10);
|
||||
} else {
|
||||
return this.aiDisplayMaster.length;
|
||||
}
|
||||
},
|
||||
|
||||
fnRecordsDisplay: function ()
|
||||
{
|
||||
if ( this.oFeatures.bServerSide ) {
|
||||
return parseInt(this._iRecordsDisplay, 10);
|
||||
} else {
|
||||
return this.aiDisplay.length;
|
||||
}
|
||||
},
|
||||
|
||||
fnDisplayEnd: function ()
|
||||
{
|
||||
if ( this.oFeatures.bServerSide ) {
|
||||
if ( this.oFeatures.bPaginate === false || this._iDisplayLength == -1 ) {
|
||||
return this._iDisplayStart+this.aiDisplay.length;
|
||||
} else {
|
||||
return Math.min( this._iDisplayStart+this._iDisplayLength,
|
||||
this._iRecordsDisplay );
|
||||
}
|
||||
} else {
|
||||
return this._iDisplayEnd;
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* Variable: oInstance
|
||||
* Purpose: The DataTables object for this table
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
oInstance: null,
|
||||
|
||||
/*
|
||||
* Variable: sInstance
|
||||
* Purpose: Unique idendifier for each instance of the DataTables object
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
sInstance: null,
|
||||
|
||||
oClasses: null
|
||||
};
|
||||
var modelRow = {
|
||||
"nTr": null,
|
||||
"_iId": null,
|
||||
"_aData": null,
|
||||
"_aSortData": [],
|
||||
"_anHidden": [],
|
||||
"_sRowStripe": ""
|
||||
};
|
||||
var modelColumn = {
|
||||
"sType": null,
|
||||
"_bAutoType": true,
|
||||
"bVisible": true,
|
||||
"bSearchable": true,
|
||||
"bSortable": true,
|
||||
"asSorting": [ 'asc', 'desc' ],
|
||||
"sSortingClass": null,
|
||||
"sSortingClassJUI": null,
|
||||
"sTitle": '',
|
||||
"sName": '',
|
||||
"sWidth": null,
|
||||
"sWidthOrig": null,
|
||||
"sClass": null,
|
||||
"fnRender": null,
|
||||
"bUseRendered": true,
|
||||
"aDataSort": [],
|
||||
"mDataProp": null,
|
||||
"fnGetData": null,
|
||||
"fnSetData": null,
|
||||
"sSortDataType": 'std',
|
||||
"sDefaultContent": null,
|
||||
"sContentPadding": "",
|
||||
"nTh": null,
|
||||
"nTf": null
|
||||
};
|
||||
|
||||
|
||||
var _oExt = {};
|
||||
|
||||
|
||||
@ -1487,6 +791,34 @@
|
||||
}
|
||||
];
|
||||
|
||||
/**
|
||||
* DataTables is a plug-in for the jQuery Javascript library. It is a
|
||||
* highly flexible tool, based upon the foundations of progressive
|
||||
* enhancement, which will add advanced interaction controls to any
|
||||
* HTML table. For a full list of features please refer to
|
||||
* <a href="http://datatables.net">DataTables.net</a>.
|
||||
* @class
|
||||
* @constructor
|
||||
* @param {object} [oInit={}] Configuration object for DataTables. Options
|
||||
* are defined by {@link FixedColumns.defaults}
|
||||
* @requires jQuery 1.3+
|
||||
*
|
||||
* @example
|
||||
* // Basic initialisation
|
||||
* $(document).ready( function {
|
||||
* $('#example').dataTable();
|
||||
* } );
|
||||
*
|
||||
* @example
|
||||
* // Initialisation with configuration options - in this case, disable
|
||||
* // pagination and sorting.
|
||||
* $(document).ready( function {
|
||||
* $('#example').dataTable( {
|
||||
* "bPaginate": false,
|
||||
* "bSort": false
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
var DataTable = function( oInit )
|
||||
{
|
||||
|
||||
@ -7044,9 +6376,7 @@
|
||||
}
|
||||
|
||||
/* Make a complete and independent copy of the settings object */
|
||||
var oSettings = $.extend( true, classSettings, {
|
||||
"oClasses": _oExt.oStdClasses
|
||||
} );
|
||||
var oSettings = $.extend( true, {}, DataTable.models.oSettings );
|
||||
|
||||
_aoSettings.push( oSettings );
|
||||
|
||||
@ -7089,10 +6419,15 @@
|
||||
/* State the table's width for if a destroy is called at a later time */
|
||||
oSettings.sDestroyWidth = $(this).width();
|
||||
|
||||
/* Store the features that we have available */
|
||||
if ( typeof oInit != 'undefined' && oInit !== null )
|
||||
{
|
||||
|
||||
/* Store the initialisation object that was passed in, useful for debugging */
|
||||
oSettings.oInit = oInit;
|
||||
|
||||
oInit = (typeof oInit === 'undefined' || oInit === null) ?
|
||||
$( true, {}, DataTable.models.oInit ) :
|
||||
$( true, {}, DataTable.models.oInit, oInit );
|
||||
|
||||
|
||||
_fnMap( oSettings.oFeatures, oInit, "bPaginate" );
|
||||
_fnMap( oSettings.oFeatures, oInit, "bLengthChange" );
|
||||
_fnMap( oSettings.oFeatures, oInit, "bFilter" );
|
||||
@ -7203,6 +6538,10 @@
|
||||
oSettings.sDom = '<"H"lfr>t<"F"ip>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
oSettings.oClasses = _oExt.oStdClasses;
|
||||
}
|
||||
|
||||
/* Calculate the scroll bar width and cache it for use later on */
|
||||
if ( oSettings.oScroll.sX !== "" || oSettings.oScroll.sY !== "" )
|
||||
@ -7269,17 +6608,17 @@
|
||||
* below is complete. The reason for spliting it like this is optimisation - we can fire
|
||||
* off the XHR (if needed) and then continue processing the data.
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Create a dummy object for quick manipulation later on. */
|
||||
oInit = {};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Stripes
|
||||
* Add the stripe classes now that we know which classes to apply - unless overruled
|
||||
*/
|
||||
console.log( oSettings.oClasses, DataTable.models );
|
||||
if ( typeof oInit.asStripClasses == 'undefined' &&
|
||||
typeof oInit.asStripeClasses == 'undefined' )
|
||||
{
|
||||
@ -7521,6 +6860,2367 @@
|
||||
} );
|
||||
};
|
||||
|
||||
DataTable.models = {};
|
||||
|
||||
|
||||
/**
|
||||
* Initilaisation options that can be given to DataTables at initialisation
|
||||
* time.
|
||||
* @namespace
|
||||
*/
|
||||
DataTable.models.oInit = {
|
||||
/**
|
||||
* An array of data to use for the table, passed in at initialisation which
|
||||
* will be used in preference to any data which is already in the DOM. This is
|
||||
* particularly useful for constructing tables purely in Javascript, for
|
||||
* example with a custom Ajax call.
|
||||
* @type array
|
||||
* @default null
|
||||
*
|
||||
* @example
|
||||
* // Using a 2D array data source
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "aaData": [
|
||||
* ['Trident', 'Internet Explorer 4.0', 'Win 95+', 4, 'X'],
|
||||
* ['Trident', 'Internet Explorer 5.0', 'Win 95+', 5, 'C'],
|
||||
* ],
|
||||
* "aoColumns": [
|
||||
* { "sTitle": "Engine" },
|
||||
* { "sTitle": "Browser" },
|
||||
* { "sTitle": "Platform" },
|
||||
* { "sTitle": "Version" },
|
||||
* { "sTitle": "Grade" }
|
||||
* ]
|
||||
* } );
|
||||
* } );
|
||||
*
|
||||
* @example
|
||||
* // Using an array of objects as a data source (mDataProp)
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "aaData": [
|
||||
* {
|
||||
* "engine": "Trident",
|
||||
* "browser": "Internet Explorer 4.0",
|
||||
* "platform": "Win 95+",
|
||||
* "version": 4,
|
||||
* "grade": "X"
|
||||
* },
|
||||
* {
|
||||
* "engine": "Trident",
|
||||
* "browser": "Internet Explorer 5.0",
|
||||
* "platform": "Win 95+",
|
||||
* "version": 5,
|
||||
* "grade": "C"
|
||||
* }
|
||||
* ],
|
||||
* "aoColumns": [
|
||||
* { "sTitle": "Engine", "mDataProp": "engine" },
|
||||
* { "sTitle": "Browser", "mDataProp": "browser" },
|
||||
* { "sTitle": "Platform", "mDataProp": "platform" },
|
||||
* { "sTitle": "Version", "mDataProp": "version" },
|
||||
* { "sTitle": "Grade", "mDataProp": "grade" }
|
||||
* ]
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"aaData": null,
|
||||
|
||||
|
||||
/**
|
||||
* If sorting is enabled, then DataTables will perform a first pass sort on
|
||||
* initialisation. You can define which column(s) the sort is performed upon,
|
||||
* and the sorting direction, with this variable. The aaSorting array should
|
||||
* contain an array for each column to be sorted initially containing the
|
||||
* column's index and a direction string ('asc' or 'desc').
|
||||
* @type array
|
||||
* @default [[0,'asc']]
|
||||
*
|
||||
* @example
|
||||
* // Sort by 3rd column first, and then 4th column
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "aaSorting": [[2,'asc'], [3,'desc']]
|
||||
* } );
|
||||
* } );
|
||||
*
|
||||
* // No initial sorting
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "aaSorting": []
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"aaSorting": [[0,'asc']],
|
||||
|
||||
|
||||
/**
|
||||
* This parameter is basically identical to the aaSorting parameter, but
|
||||
* cannot be overridden by user interaction with the table. What this means
|
||||
* is that you could have a column (visible or hidden) which the sorting will
|
||||
* always be forced on first - any sorting after that (from the user) will
|
||||
* then be performed as required. This can be useful for grouping rows
|
||||
* together.
|
||||
* @type array
|
||||
* @default null
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "aaSortingFixed": [[0,'asc']]
|
||||
* } );
|
||||
* } )
|
||||
*/
|
||||
"aaSortingFixed": null,
|
||||
|
||||
|
||||
/**
|
||||
* This parameter allows you to readily specify the entries in the length drop
|
||||
* down menu that DataTables shows when pagination is enabled. It can be
|
||||
* either a 1D array of options which will be used for both the displayed
|
||||
* option and the value, or a 2D array which will use the array in the first
|
||||
* position as the value, and the array in the second position as the
|
||||
* displayed options (useful for language strings such as 'All').
|
||||
* @type array
|
||||
* @default [ 10, 25, 50, 100 ]
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
|
||||
* } );
|
||||
* } );
|
||||
*
|
||||
* @example
|
||||
* // Setting the default display length as well as length menu
|
||||
* // This is likely to be wanted if you remove the '10' option which
|
||||
* // is the iDisplayLength default.
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "iDisplayLength": 25,
|
||||
* "aLengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]]
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"aLengthMenu": [ 10, 25, 50, 100 ],
|
||||
|
||||
|
||||
/**
|
||||
* The aoColumns option in the initialisation parameter allows you to define
|
||||
* details about the way individual columns behave. For a full list of
|
||||
* column options that can be set, please see
|
||||
* {@link DataTable.models.oInitColumns}. Note that if you use aoColumns to
|
||||
* define your columns, you must have an entry in the array for every single
|
||||
* column that you have in your table (these can be null if you don't which
|
||||
* to specify any options).
|
||||
* @namespace
|
||||
*/
|
||||
"aoColumns": null,
|
||||
|
||||
/**
|
||||
* Very similar to aoColumns, aoColumnDefs allows you to target a specific
|
||||
* column, multiple columns, or all columns, using the aTargets property of
|
||||
* each object in the array. This allows great flexibility when creating
|
||||
* tables, as the aoColumnDefs arrays can be of any length, targeting the
|
||||
* columns you specifically want. aoColumnDefs may use any of the column
|
||||
* options available: {@link DataTable.models.oInitColumns}, but it _must_
|
||||
* have aTargets defined in each object in the array. Values in the aTargets
|
||||
* array may be:
|
||||
* <ul>
|
||||
* <li>a string - class name will be matched on the TH for the column</li>
|
||||
* <li>0 or a positive integer - column index counting from the left</li>
|
||||
* <li>a negative integer - column index counting from the right</li>
|
||||
* <li>the string "_all" - all columns (i.e. assign a default)</li>
|
||||
* </ul>
|
||||
* @namespace
|
||||
*/
|
||||
"aoColumnDefs": null,
|
||||
|
||||
|
||||
/**
|
||||
* Basically the same as oSearch, this parameter defines the individual column
|
||||
* filtering state at initialisation time. The array must be of the same size
|
||||
* as the number of columns, and each element be an object with the parameters
|
||||
* "sSearch" and "bEscapeRegex" (the latter is optional). 'null' is also
|
||||
* accepted and the default will be used.
|
||||
* @type array
|
||||
* @default null
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "aoSearchCols": [
|
||||
* null,
|
||||
* { "sSearch": "My filter" },
|
||||
* null,
|
||||
* { "sSearch": "^[0-9]", "bEscapeRegex": false }
|
||||
* ]
|
||||
* } );
|
||||
* } )
|
||||
*/
|
||||
"aoSearchCols": null,
|
||||
|
||||
|
||||
/**
|
||||
* An array of CSS classes that should be applied to displayed rows. This
|
||||
* array may be of any length, and DataTables will apply each class
|
||||
* sequentially, looping when required.
|
||||
* @type array
|
||||
* @default [ 'odd', 'even' ]
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "asStripClasses": [ 'strip1', 'strip2', 'strip3' ]
|
||||
* } );
|
||||
* } )
|
||||
*/
|
||||
"asStripClasses": [ 'odd', 'even' ],
|
||||
|
||||
|
||||
/**
|
||||
* Enable or disable automatic column width calculation. This can be disabled
|
||||
* as an optimisation (it takes some time to calculate the widths) if the
|
||||
* tables widths are passed in using aoColumns.
|
||||
* @type boolean
|
||||
* @default true
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "bAutoWidth": false
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"bAutoWidth": true,
|
||||
|
||||
|
||||
/**
|
||||
* Deferred rendering can provide DataTables with a huge speed boost when you
|
||||
* are using an Ajax or JS data source for the table. This option, when set to
|
||||
* true, will cause DataTables to defer the creation of the table elements for
|
||||
* each row until they are needed for a draw - saving a significant amount of
|
||||
* time.
|
||||
* @type boolean
|
||||
* @default false
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* var oTable = $('#example').dataTable( {
|
||||
* "sAjaxSource": "sources/arrays.txt",
|
||||
* "bDeferRender": true
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"bDeferRender": false,
|
||||
|
||||
|
||||
/**
|
||||
* Replace a DataTable which matches the given selector and replace it with
|
||||
* one which has the properties of the new initialisation object passed. If no
|
||||
* table matches the selector, then the new DataTable will be constructed as
|
||||
* per normal.
|
||||
* @type boolean
|
||||
* @default false
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "sScrollY": "200px",
|
||||
* "bPaginate": false
|
||||
* } );
|
||||
*
|
||||
* // Some time later....
|
||||
* $('#example').dataTable( {
|
||||
* "bFilter": false,
|
||||
* "bDestroy": true
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"bDestroy": false,
|
||||
|
||||
|
||||
/**
|
||||
* Enable or disable filtering of data. Filtering in DataTables is "smart" in
|
||||
* that it allows the end user to input multiple words (space separated) and
|
||||
* will match a row containing those words, even if not in the order that was
|
||||
* specified (this allow matching across multiple columns). Note that if you
|
||||
* wish to use filtering in DataTables this must remain 'true' - to remove the
|
||||
* default filtering input box and retain filtering abilities, please use
|
||||
* @ref{sDom}.
|
||||
* @type boolean
|
||||
* @default true
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "bFilter": false
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"bFilter": true,
|
||||
|
||||
|
||||
/**
|
||||
* Enable or disable the table information display. This shows information
|
||||
* about the data that is currently visible on the page, including information
|
||||
* about filtered data if that action is being performed.
|
||||
* @type boolean
|
||||
* @default true
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "bInfo": false
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"bInfo": true,
|
||||
|
||||
|
||||
/**
|
||||
* Enable jQuery UI ThemeRoller support (required as ThemeRoller requires some
|
||||
* slightly different and additional mark-up from what DataTables has
|
||||
* traditionally used).
|
||||
* @type boolean
|
||||
* @default false
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "bJQueryUI": true
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"bJQueryUI": false,
|
||||
|
||||
|
||||
/**
|
||||
* Allows the end user to select the size of a formatted page from a select
|
||||
* menu (sizes are 10, 25, 50 and 100). Requires pagination (bPaginate).
|
||||
* @type boolean
|
||||
* @default true
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "bLengthChange": false
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"bLengthChange": true,
|
||||
|
||||
|
||||
/**
|
||||
* Enable or disable pagination.
|
||||
* @type boolean
|
||||
* @default true
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "bPaginate": false
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"bPaginate": true,
|
||||
|
||||
|
||||
/**
|
||||
* Enable or disable the display of a 'processing' indicator when the table is
|
||||
* being processed (e.g. a sort). This is particularly useful for tables with
|
||||
* large amounts of data where it can take a noticeable amount of time to sort
|
||||
* the entries.
|
||||
* @type boolean
|
||||
* @default false
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "bProcessing": true
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"bProcessing": false,
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve the DataTables object for the given selector. Note that if the
|
||||
* table has already been initialised, this parameter will cause DataTables
|
||||
* to simply return the object that has already been set up - it will not take
|
||||
* account of any changes you might have made to the initialisation object
|
||||
* passed to DataTables (setting this parameter to true is an acknowledgement
|
||||
* that you understand this). bDestroy can be used to reinitialise a table if
|
||||
* you need.
|
||||
* @type boolean
|
||||
* @default false
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* initTable();
|
||||
* tableActions();
|
||||
* } );
|
||||
*
|
||||
* function initTable ()
|
||||
* {
|
||||
* return $('#example').dataTable( {
|
||||
* "sScrollY": "200px",
|
||||
* "bPaginate": false,
|
||||
* "bRetrieve": true
|
||||
* } );
|
||||
* }
|
||||
*
|
||||
* function tableActions ()
|
||||
* {
|
||||
* var oTable = initTable();
|
||||
* // perform API operations with oTable
|
||||
* }
|
||||
*/
|
||||
"bRetrieve": false,
|
||||
|
||||
|
||||
/**
|
||||
* When vertical (y) scrolling is enabled, DataTables will force the height of
|
||||
* the table's viewport to the given height at all times (useful for layout).
|
||||
* However, this can look odd when filtering data down to a small data set,
|
||||
* and the footer is left "floating" further down. This parameter (when
|
||||
* enabled) will cause DataTables to collapse the table's viewport down when
|
||||
* the result set will fit within the given Y height.
|
||||
* @type boolean
|
||||
* @default false
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "sScrollY": "200",
|
||||
* "bScrollCollapse": true
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"bScrollCollapse": false,
|
||||
|
||||
|
||||
/**
|
||||
* Enable infinite scrolling for DataTables (to be used in combination with
|
||||
* sScrollY). Infinite scrolling means that DataTables will continually load
|
||||
* data as a user scrolls through a table, which is very useful for large
|
||||
* dataset. This cannot be used with pagination, which is automatically
|
||||
* disabled.
|
||||
* @type boolean
|
||||
* @default false
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "bScrollInfinite": true,
|
||||
* "bScrollCollapse": true,
|
||||
* "sScrollY": "200px"
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"bScrollInfinite": false,
|
||||
|
||||
|
||||
/**
|
||||
* Configure DataTables to use server-side processing. Note that the
|
||||
* sAjaxSource parameter must also be given in order to give DataTables a
|
||||
* source to obtain the required data for each draw.
|
||||
* @type boolean
|
||||
* @default false
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "bServerSide": true,
|
||||
* "sAjaxSource": "xhr.php"
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"bServerSide": false,
|
||||
|
||||
|
||||
/**
|
||||
* Enable or disable sorting of columns. Sorting of individual columns can be
|
||||
* disabled by the "bSortable" option for each column.
|
||||
* @type boolean
|
||||
* @default true
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "bSort": false
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"bSort": true,
|
||||
|
||||
|
||||
/**
|
||||
* Allows control over whether DataTables should use the top (true) unique
|
||||
* cell that is found for a single column, or the bottom (false - default).
|
||||
* This is useful when using complex headers.
|
||||
* @type boolean
|
||||
* @default false
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "bSortCellsTop": true
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"bSortCellsTop": false,
|
||||
|
||||
|
||||
/**
|
||||
* Enable or disable the addition of the classes 'sorting_1', 'sorting_2' and
|
||||
* 'sorting_3' to the columns which are currently being sorted on. This is
|
||||
* presented as a feature switch as it can increase processing time (while
|
||||
* classes are removed and added) so for large data sets you might want to
|
||||
* turn this off.
|
||||
* @type boolean
|
||||
* @default true
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "bSortClasses": false
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"bSortClasses": true,
|
||||
|
||||
|
||||
/**
|
||||
* Enable or disable state saving. When enabled a cookie will be used to save
|
||||
* table display information such as pagination information, display length,
|
||||
* filtering and sorting. As such when the end user reloads the page the
|
||||
* display display will match what thy had previously set up.
|
||||
* @type boolean
|
||||
* @default false
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "bStateSave": true
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"bStateSave": false,
|
||||
|
||||
|
||||
/**
|
||||
* Customise the cookie and / or the parameters being stored when using
|
||||
* DataTables with state saving enabled. This function is called whenever
|
||||
* the cookie is modified, and it expects a fully formed cookie string to be
|
||||
* returned. Note that the data object passed in is a Javascript object which
|
||||
* must be converted to a string (JSON.stringify for example).
|
||||
* @type function
|
||||
* @param {string} sName Name of the cookie defined by DataTables
|
||||
* @param {object} oData Data to be stored in the cookie
|
||||
* @param {string} sExpires Cookie expires string
|
||||
* @param {string} sPath Path of the cookie to set
|
||||
* @returns {string} Cookie formatted string (which should be encoded by
|
||||
* using encodeURIComponent())
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "fnCookieCallback": function (sName, oData, sExpires, sPath) {
|
||||
* // Customise oData or sName or whatever else here
|
||||
* return sName + "="+JSON.stringify(oData)+"; expires=" + sExpires +"; path=" + sPath;
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"fnCookieCallback": null,
|
||||
|
||||
|
||||
/**
|
||||
* This function is called on every 'draw' event, and allows you to
|
||||
* dynamically modify any aspect you want about the created DOM.
|
||||
* @type function
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "fnDrawCallback": function() {
|
||||
* alert( 'DataTables has redrawn the table' );
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"fnDrawCallback": null,
|
||||
|
||||
|
||||
/**
|
||||
* Identical to fnHeaderCallback() but for the table footer this function
|
||||
* allows you to modify the table footer on every 'draw' even.
|
||||
* @type function
|
||||
* @param {node} nFoot "TR" element for the footer
|
||||
* @param {array} aData Full table data (as derived from the original HTML)
|
||||
* @param {int} iStart Index for the current display starting point in the
|
||||
* display array
|
||||
* @param {int} iEnd Index for the current display ending point in the
|
||||
* display array
|
||||
* @param {array int} aiDisplay Index array to translate the visual position
|
||||
* to the full data array
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "fnFooterCallback": function( nFoot, aData, iStart, iEnd, aiDisplay ) {
|
||||
* nFoot.getElementsByTagName('th')[0].innerHTML = "Starting index is "+iStart;
|
||||
* }
|
||||
* } );
|
||||
* } )
|
||||
*/
|
||||
"fnFooterCallback": null,
|
||||
|
||||
|
||||
/**
|
||||
* When rendering large numbers in the information element for the table
|
||||
* (i.e. "Showing 1 to 10 of 57 entries") DataTables will render large numbers
|
||||
* to have a comma separator for the 'thousands' units (e.g. 1 million is
|
||||
* rendered as "1,000,000") to help readability for the end user. This
|
||||
* function will override the default method DataTables uses.
|
||||
* @type function
|
||||
* @param {int} iIn number to be formatted
|
||||
* @returns {string} formatted string for DataTables to show the number
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "fnFormatNumber": function ( iIn ) {
|
||||
* if ( iIn < 1000 ) {
|
||||
* 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 = "'"+out;
|
||||
* }
|
||||
* out = a[iLen-i-1]+out;
|
||||
* }
|
||||
* }
|
||||
* return out;
|
||||
* };
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"fnFormatNumber": function ( iIn ) {
|
||||
if ( iIn < 1000 )
|
||||
{
|
||||
// A small optimisation for what is likely to be the 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;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* This function is called on every 'draw' event, and allows you to
|
||||
* dynamically modify the header row. This can be used to calculate and
|
||||
* display useful information about the table.
|
||||
* @type function
|
||||
* @param {node} nHead "TR" element for the header
|
||||
* @param {array} aData Full table data (as derived from the original HTML)
|
||||
* @param {int} iStart Index for the current display starting point in the
|
||||
* display array
|
||||
* @param {int} iEnd Index for the current display ending point in the
|
||||
* display array
|
||||
* @param {array int} aiDisplay Index array to translate the visual position
|
||||
* to the full data array
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "fnHeaderCallback": function( nHead, aData, iStart, iEnd, aiDisplay ) {
|
||||
* nHead.getElementsByTagName('th')[0].innerHTML = "Displaying "+(iEnd-iStart)+" records";
|
||||
* }
|
||||
* } );
|
||||
* } )
|
||||
*/
|
||||
"fnHeaderCallback": null,
|
||||
|
||||
|
||||
/**
|
||||
* The information element can be used to convey information about the current
|
||||
* state of the table. Although the internationalisation options presented by
|
||||
* DataTables are quite capable of dealing with most customisations, there may
|
||||
* be times where you wish to customise the string further. This callback
|
||||
* allows you to do exactly that.
|
||||
* @type function
|
||||
* @param {object} oSettings DataTables settings object
|
||||
* @param {int} iStart Starting position in data for the draw
|
||||
* @param {int} iEnd End position in data for the draw
|
||||
* @param {int} iMax Total number of rows in the table (regardless of
|
||||
* filtering)
|
||||
* @param {int} iTotal Total number of rows in the data set, after filtering
|
||||
* @param {string} sPre The string that DataTables has formatted using it's
|
||||
* own rules
|
||||
* @returns {string} The string to be displayed in the information element.
|
||||
*
|
||||
* @example
|
||||
* $('#example').dataTable( {
|
||||
* "fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) {
|
||||
* return iStart +" to "+ iEnd;
|
||||
* }
|
||||
* } );
|
||||
*/
|
||||
"fnInfoCallback": null,
|
||||
|
||||
|
||||
/**
|
||||
* Called when the table has been initialised. Normally DataTables will
|
||||
* initialise sequentially and there will be no need for this function,
|
||||
* however, this does not hold true when using external language information
|
||||
* since that is obtained using an async XHR call.
|
||||
* @type function
|
||||
* @param {object} oSettings DataTables settings object
|
||||
* @param {object} json The JSON object request from the server - only
|
||||
* present if client-side Ajax sourced data is used</li></ol>
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "fnInitComplete": function(oSettings, json) {
|
||||
* alert( 'DataTables has finished its initialisation.' );
|
||||
* }
|
||||
* } );
|
||||
* } )
|
||||
*/
|
||||
"fnInitComplete": null,
|
||||
|
||||
|
||||
/**
|
||||
* Called at the very start of each table draw and can be used to cancel the
|
||||
* draw by returning false, any other return (including undefined) results in
|
||||
* the full draw occurring).
|
||||
* @type function
|
||||
* @param {object} oSettings DataTables settings object
|
||||
* @returns {boolean} False will cancel the draw, anything else (including no
|
||||
* return) will allow it to complete.
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "fnPreDrawCallback": function( oSettings ) {
|
||||
* if ( $('#test').val() == 1 ) {
|
||||
* return false;
|
||||
* }
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"fnPreDrawCallback": null,
|
||||
|
||||
|
||||
/**
|
||||
* This function allows you to 'post process' each row after it have been
|
||||
* generated for each table draw, but before it is rendered on screen. This
|
||||
* function might be used for setting the row class name etc.
|
||||
* @type function
|
||||
* @param {node} nRow "TR" element for the current row
|
||||
* @param {array} aData Raw data array for this row
|
||||
* @param {int} iDisplayIndex The display index for the current table draw
|
||||
* @param {int} iDisplayIndexFull The index of the data in the full list of
|
||||
* rows (after filtering)
|
||||
* @returns {node} "TR" element for the current row
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
||||
* // Bold the grade for all 'A' grade browsers
|
||||
* if ( aData[4] == "A" )
|
||||
* {
|
||||
* $('td:eq(4)', nRow).html( '<b>A</b>' );
|
||||
* }
|
||||
* return nRow;
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"fnRowCallback": null,
|
||||
|
||||
|
||||
/**
|
||||
* This parameter allows you to override the default function which obtains
|
||||
* the data from the server ($.getJSON) so something more suitable for your
|
||||
* application. For example you could use POST data, or pull information from
|
||||
* a Gears or AIR database.
|
||||
* @type function
|
||||
* @param {string} sSource HTTP source to obtain the data from (sAjaxSource)
|
||||
* @param {array} aoData A key/value pair object containing the data to send
|
||||
* to the server
|
||||
* @param {function} fnCallback to be called on completion of the data get
|
||||
* process that will draw the data on the page.
|
||||
* @param {object} oSettings DataTables settings object
|
||||
*
|
||||
* @example
|
||||
* // POST data to server
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "bProcessing": true,
|
||||
* "bServerSide": true,
|
||||
* "sAjaxSource": "xhr.php",
|
||||
* "fnServerData": function ( sSource, aoData, fnCallback ) {
|
||||
* $.ajax( {
|
||||
* "dataType": 'json',
|
||||
* "type": "POST",
|
||||
* "url": sSource,
|
||||
* "data": aoData,
|
||||
* "success": fnCallback
|
||||
* } );
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"fnServerData": function ( sUrl, aoData, fnCallback, oSettings ) {
|
||||
oSettings.jqXHR = $.ajax( {
|
||||
"url": sUrl,
|
||||
"data": aoData,
|
||||
"success": function (json) {
|
||||
$(oSettings.oInstance).trigger('xhr', oSettings);
|
||||
fnCallback( json );
|
||||
},
|
||||
"dataType": "json",
|
||||
"cache": false,
|
||||
"type": oSettings.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." );
|
||||
}
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* It is often useful to send extra data to the server when making an Ajax
|
||||
* request - for example custom filtering information, and this callback
|
||||
* function makes it trivial to send extra information to the server. The
|
||||
* passed in parameter is the data set that has been constructed by
|
||||
* DataTables, and you can add to this or modify it as you require.
|
||||
* @type function
|
||||
* @param {array} aoData Data array (array of objects which are name/value
|
||||
* pairs) that has been constructed by DataTables and will be sent to the
|
||||
* server. In the case of Ajax sourced data with server-side processing
|
||||
* this will be an empty array, for server-side processing there will be a
|
||||
* significant number of parameters!.
|
||||
* @returns {undefined} Ensure that you modify the aoData array passed in,
|
||||
* as this is passed by reference.
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "bProcessing": true,
|
||||
* "bServerSide": true,
|
||||
* "sAjaxSource": "scripts/server_processing.php",
|
||||
* "fnServerParams": function ( aoData ) {
|
||||
* aoData.push( { "name": "more_data", "value": "my_value" } );
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"fnServerParams": null,
|
||||
|
||||
|
||||
/**
|
||||
* State saving in DataTables is very useful, but it does a blanket save on
|
||||
* all properties that the user can modify, so the table is restored. This
|
||||
* callback method can be used to modify the saved properties as you require,
|
||||
* just prior to them being loaded. This method can also be used to override
|
||||
* the state loading altogether by returning false.
|
||||
* @type function
|
||||
* @param {object} oSettings DataTables settings object
|
||||
* @param {object} oData Object containing information retrieved from the
|
||||
* state saving cookie which should be restored. For the exact properties
|
||||
* please refer to the DataTables code.
|
||||
* @returns {boolean} false if the state should not be loaded, true otherwise
|
||||
*
|
||||
* @example
|
||||
* // Remove a previously saved filter
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "bStateSave": true,
|
||||
* "fnStateLoadCallback": function ( oSettings, oData ) {
|
||||
* oData.sFilter = "";
|
||||
* return true;
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*
|
||||
* @example
|
||||
* // Override state loading
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "bStateSave": true,
|
||||
* "fnStateLoadCallback": function ( oSettings, oData ) {
|
||||
* return false;
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"fnStateLoadCallback": null,
|
||||
|
||||
|
||||
/**
|
||||
* When using state saving it can be useful to store your own custom
|
||||
* parameters in the state saving cookie that DataTables uses, or to modify
|
||||
* the settings that DataTables uses. Note that this function can be quite
|
||||
* involved to use since it uses JSON notation in a string, given that jQuery
|
||||
* does not provide a "stringify" option for JSON objects.
|
||||
* @type function
|
||||
* @param {object} oSettings DataTables settings object
|
||||
* @param {string} sValue a JSON string (without the final closing brace)
|
||||
* which should be stored in the state saving cookie.
|
||||
* @returns {string} The full string that should be used to save the state
|
||||
*
|
||||
* @example
|
||||
* // Add a custom parameter
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "bStateSave": true,
|
||||
* "fnStateSaveCallback": function ( oSettings, sValue ) {
|
||||
* sValue += ',"myCustomParameter": "myValue"';
|
||||
* return sValue;
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*
|
||||
* @example
|
||||
* // Modify saved filter to be blank
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "bStateSave": true,
|
||||
* "fnStateSaveCallback": function ( oSettings, sValue ) {
|
||||
* sValue = sValue.replace( /"sFilter":".*?"/, '"sFilter":""' );
|
||||
* return sValue;
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*
|
||||
* @example
|
||||
* // Modify saved filter to be blank - using JSON2.js
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "bStateSave": true,
|
||||
* "fnStateSaveCallback": function ( oSettings, sValue ) {
|
||||
* var oData = JSON.parse( sValue+"}" );
|
||||
* oData.sFilter = "";
|
||||
* return JSON.stringify( oData ).slice( 0, -1 );
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"fnStateSaveCallback": null,
|
||||
|
||||
|
||||
/**
|
||||
* Duration of the cookie which is used for storing session information. This
|
||||
* value is given in seconds.
|
||||
* @type int
|
||||
* @default 7200 <i>(2 hours)</i>
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "iCookieDuration": 60*60*24 // 1 day
|
||||
* } );
|
||||
* } )
|
||||
*/
|
||||
"iCookieDuration": 7200,
|
||||
|
||||
|
||||
/**
|
||||
* When enabled DataTables will not make a request to the server for the first
|
||||
* page draw - rather it will use the data already on the page (no sorting etc
|
||||
* will be applied to it), thus saving on an XHR at load time. iDeferLoading
|
||||
* is used to indicate that deferred loading is required, but it is also used
|
||||
* to tell DataTables how many records there are in the full table (allowing
|
||||
* the information element and pagination to be displayed correctly).
|
||||
* @type int
|
||||
* @default null
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "bServerSide": true,
|
||||
* "sAjaxSource": "scripts/server_processing.php",
|
||||
* "iDeferLoading": 57
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"iDeferLoading": null,
|
||||
|
||||
|
||||
/**
|
||||
* Number of rows to display on a single page when using pagination. If
|
||||
* feature enabled (bLengthChange) then the end user will be able to override
|
||||
* this to a custom setting using a pop-up menu.
|
||||
* @type int
|
||||
* @default 10
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "iDisplayLength": 50
|
||||
* } );
|
||||
* } )
|
||||
*/
|
||||
"iDisplayLength": 10,
|
||||
|
||||
|
||||
/**
|
||||
* Define the starting point for data display when using DataTables with
|
||||
* pagination. Note that this parameter is the number of records, rather than
|
||||
* the page number, so if you have 10 records per page and want to start on
|
||||
* the third page, it should be "20".
|
||||
* @type int
|
||||
* @default 0
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "iDisplayStart": 20
|
||||
* } );
|
||||
* } )
|
||||
*/
|
||||
"iDisplayStart": 0,
|
||||
|
||||
|
||||
/**
|
||||
* The scroll gap is the amount of scrolling that is left to go before
|
||||
* DataTables will load the next 'page' of data automatically. You typically
|
||||
* want a gap which is big enough that the scrolling will be smooth for the
|
||||
* user, while not so large that it will load more data than need.
|
||||
* @type int
|
||||
* @default 100
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "bScrollInfinite": true,
|
||||
* "bScrollCollapse": true,
|
||||
* "sScrollY": "200px",
|
||||
* "iScrollLoadGap": 50
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"iScrollLoadGap": 100,
|
||||
|
||||
|
||||
/**
|
||||
* All strings that DataTables uses in the user interface that it creates
|
||||
* are defined in this object, allowing you to modifed them individually or
|
||||
* completely replace them all as required.
|
||||
* @namespace
|
||||
*/
|
||||
"oLanguage": {
|
||||
/**
|
||||
* Pnagation string used by DataTables for the two built-in pagination
|
||||
* control types ("two_button" and "full_numbers")
|
||||
* @namespace
|
||||
*/
|
||||
"oPaginate": {
|
||||
/**
|
||||
* Text to use when using the 'full_numbers' type of pagination for the
|
||||
* button
|
||||
* to take the user to the first page.
|
||||
* @type string
|
||||
* @default First
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "oLanguage": {
|
||||
* "oPaginate": {
|
||||
* "sFirst": "First page"
|
||||
* }
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sFirst": "First",
|
||||
|
||||
|
||||
/**
|
||||
* Text to use when using the 'full_numbers' type of pagination for the
|
||||
* button to take the user to the last page.
|
||||
* @type string
|
||||
* @default Last
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "oLanguage": {
|
||||
* "oPaginate": {
|
||||
* "sLast": "Last page"
|
||||
* }
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sLast": "Last",
|
||||
|
||||
|
||||
/**
|
||||
* Text to use when using the 'full_numbers' type of pagination for the
|
||||
* button to take the user to the next page.
|
||||
* @type string
|
||||
* @default Next
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "oLanguage": {
|
||||
* "oPaginate": {
|
||||
* "sNext": "Next page"
|
||||
* }
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sNext": "Next",
|
||||
|
||||
|
||||
/**
|
||||
* Text to use when using the 'full_numbers' type of pagination for the
|
||||
* button to take the user to the previous page.
|
||||
* @type string
|
||||
* @default Previous
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "oLanguage": {
|
||||
* "oPaginate": {
|
||||
* "sPrevious": "Previous page"
|
||||
* }
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sPrevious": "Previous",
|
||||
},
|
||||
|
||||
/**
|
||||
* This string is shown in preference to sZeroRecords when the table is
|
||||
* empty of data (regardless of filtering). Note that this is an optional
|
||||
* parameter - if it is not given, the value of sZeroRecords will be used
|
||||
* instead (either the default or given value).
|
||||
* @type string
|
||||
* @default No data available in table
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "oLanguage": {
|
||||
* "sEmptyTable": "No data available in table"
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sEmptyTable": "No data available in table",
|
||||
|
||||
|
||||
/**
|
||||
* This string gives information to the end user about the information that
|
||||
* is current on display on the page. The _START_, _END_ and _TOTAL_
|
||||
* variables are all dynamically replaced as the table display updates, and
|
||||
* can be freely moved or removed as the language requirements change.
|
||||
* @type string
|
||||
* @default Showing _START_ to _END_ of _TOTAL_ entries
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "oLanguage": {
|
||||
* "sInfo": "Got a total of _TOTAL_ entries to show (_START_ to _END_)"
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
|
||||
|
||||
|
||||
/**
|
||||
* Display information string for when the table is empty. Typically the
|
||||
* format of this string should match sInfo.
|
||||
* @type string
|
||||
* @default Showing 0 to 0 of 0 entries
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "oLanguage": {
|
||||
* "sInfoEmpty": "No entries to show"
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sInfoEmpty": "Showing 0 to 0 of 0 entries",
|
||||
|
||||
|
||||
/**
|
||||
* When a user filters the information in a table, this string is appended
|
||||
* to the information (sInfo) to give an idea of how strong the filtering
|
||||
* is. The variable _MAX_ is dynamically updated.
|
||||
* @type string
|
||||
* @default (filtered from _MAX_ total entries)
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "oLanguage": {
|
||||
* "sInfoFiltered": " - filtering from _MAX_ records"
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sInfoFiltered": "(filtered from _MAX_ total entries)",
|
||||
|
||||
|
||||
/**
|
||||
* If can be useful to append extra information to the info string at times,
|
||||
* and this variable does exactly that. This information will be appended to
|
||||
* the sInfo (sInfoEmpty and sInfoFiltered in whatever combination they are
|
||||
* being used) at all times.
|
||||
* @type string
|
||||
* @default <i>Empty string</i>
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "oLanguage": {
|
||||
* "sInfoPostFix": "All records shown are derived from real information."
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sInfoPostFix": "",
|
||||
|
||||
|
||||
/**
|
||||
* DataTables has a build in number formatter (fnFormatNumber) which is used
|
||||
* to format large numbers that are used in the table information. By
|
||||
* default a comma is used, but this can be trivially changed to any
|
||||
* character you wish with this parameter.
|
||||
* @type string
|
||||
* @default ,
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "oLanguage": {
|
||||
* "sInfoThousands": "'"
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sInfoThousands": ",",
|
||||
|
||||
|
||||
/**
|
||||
* Detail the action that will be taken when the drop down menu for the
|
||||
* pagination length option is changed. The '_MENU_' variable is replaced
|
||||
* with a default select list of 10, 25, 50 and 100, and can be replaced
|
||||
* with a custom select box if required.
|
||||
* @type string
|
||||
* @default Show _MENU_ entries
|
||||
*
|
||||
* @example
|
||||
* // Language change only
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "oLanguage": {
|
||||
* "sLengthMenu": "Display _MENU_ records"
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*
|
||||
* @example
|
||||
* // Language and options change
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "oLanguage": {
|
||||
* "sLengthMenu": 'Display <select>'+
|
||||
* '<option value="10">10</option>'+
|
||||
* '<option value="20">20</option>'+
|
||||
* '<option value="30">30</option>'+
|
||||
* '<option value="40">40</option>'+
|
||||
* '<option value="50">50</option>'+
|
||||
* '<option value="-1">All</option>'+
|
||||
* '</select> records'
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sLengthMenu": "Show _MENU_ entries",
|
||||
|
||||
|
||||
/**
|
||||
* When using Ajax sourced data and during the first draw when DataTables is
|
||||
* gathering the data, this message is shown in an empty row in the table to
|
||||
* indicate to the end user the the data is being loaded. Note that this
|
||||
* parameter is not used when loading data by server-side processing, just
|
||||
* Ajax sourced data with client-side processing.
|
||||
* @type string
|
||||
* @default Loading...
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "oLanguage": {
|
||||
* "sLoadingRecords": "Please wait - loading..."
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sLoadingRecords": "Loading...",
|
||||
|
||||
|
||||
/**
|
||||
* Text which is displayed when the table is processing a user action
|
||||
* (usually a sort command or similar).
|
||||
* @type string
|
||||
* @default Processing...
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "oLanguage": {
|
||||
* "sProcessing": "DataTables is currently busy"
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sProcessing": "Processing...",
|
||||
|
||||
|
||||
/**
|
||||
* Details the actions that will be taken when the user types into the
|
||||
* filtering input text box. The variable "_INPUT_", if used in the string,
|
||||
* is replaced with the HTML text box for the filtering input allowing
|
||||
* control over where it appears in the string. If "_INPUT_" is not given
|
||||
* then the input box is appended to the string automatically.
|
||||
* @type string
|
||||
* @default Search:
|
||||
*
|
||||
* @example
|
||||
* // Input text box will be appended at the end automatically
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "oLanguage": {
|
||||
* "sSearch": "Filter records:"
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*
|
||||
* @example
|
||||
* // Specify where the filter should appear
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "oLanguage": {
|
||||
* "sSearch": "Apply filter _INPUT_ to table"
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sSearch": "Search:",
|
||||
|
||||
|
||||
/**
|
||||
* All of the language information can be stored in a file on the
|
||||
* server-side, which DataTables will look up if this parameter is passed.
|
||||
* It must store the URL of the language file, which is in a JSON format,
|
||||
* and the object has the same properties as the oLanguage object in the
|
||||
* initialiser object (i.e. the above parameters). Please refer to one of
|
||||
* the example language files to see how this works in action.
|
||||
* @type string
|
||||
* @default <i>Empty string - i.e. disabled</i>
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "oLanguage": {
|
||||
* "sUrl": "http://www.sprymedia.co.uk/dataTables/lang.txt"
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sUrl": "",
|
||||
|
||||
|
||||
/**
|
||||
* Text shown inside the table records when the is no information to be
|
||||
* displayed after filtering. sEmptyTable is shown when there is simply no
|
||||
* information in the table at all (regardless of filtering).
|
||||
* @type string
|
||||
* @default No matching records found
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "oLanguage": {
|
||||
* "sZeroRecords": "No records to display"
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sZeroRecords": "No matching records found",
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* This parameter allows you to have define the global filtering state at
|
||||
* initialisation time. As an object the "sSearch" parameter must be
|
||||
* defined, but the "bRegex" and "bSmart" parameters are optional. When
|
||||
* "bRegex" is true, the search string will be treated as a regular
|
||||
* expression, when false (default) it will be treated as a straight string.
|
||||
* When "bSmart" DataTables will use it's smart filtering methods (to word
|
||||
* match at any point in the data), when false this will not be done.
|
||||
* @type string
|
||||
* @default { "sSearch": "", "bRegex": false, "bSmart": true }
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "oSearch": {"sSearch": "Initial search"}
|
||||
* } );
|
||||
* } )
|
||||
*/
|
||||
"oSearch": {
|
||||
"sSearch": "",
|
||||
"bRegex": false,
|
||||
"bSmart": true
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* By default DataTables will look for the property 'aaData' when obtaining
|
||||
* data from an Ajax source or for server-side processing - this parameter
|
||||
* allows that property to be changed. You can use Javascript dotted object
|
||||
* notation to get a data source for multiple levels of nesting.
|
||||
* @type string
|
||||
* @default aaData
|
||||
*
|
||||
* @example
|
||||
* // Get data from { "data": [...] }
|
||||
* $(document).ready(function() {
|
||||
* var oTable = $('#example').dataTable( {
|
||||
* "sAjaxSource": "sources/data.txt",
|
||||
* "sAjaxDataProp": "data"
|
||||
* } );
|
||||
* } );
|
||||
*
|
||||
* @example
|
||||
* // Get data from { "data": { "inner": [...] } }
|
||||
* $(document).ready(function() {
|
||||
* var oTable = $('#example').dataTable( {
|
||||
* "sAjaxSource": "sources/data.txt",
|
||||
* "sAjaxDataProp": "data.inner"
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sAjaxDataProp": "aaData",
|
||||
|
||||
|
||||
/**
|
||||
* You can instruct DataTables to load data from an external source using this
|
||||
* parameter (use aData if you want to pass data in you already have). Simply
|
||||
* provide a url a JSON object can be obtained from. This object must include
|
||||
* the parameter 'aaData' which is a 2D array with the source data.
|
||||
* @type string
|
||||
* @default null
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "sAjaxSource": "http://www.sprymedia.co.uk/dataTables/json.php"
|
||||
* } );
|
||||
* } )
|
||||
*/
|
||||
"sAjaxSource": null,
|
||||
|
||||
|
||||
/**
|
||||
* Address from which DataTables should load the remote data from when using
|
||||
* server-side processing. Note that sAjaxSource can also be used without
|
||||
* server-side processing to indicate a "one time get" of JSON formatted data.
|
||||
* @type string
|
||||
* @default null
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "bProcessing": false,
|
||||
* "sAjaxSource": "xhr.php"
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sAjaxSource": null,
|
||||
|
||||
|
||||
/**
|
||||
* This parameter can be used to override the default prefix that DataTables
|
||||
* assigns to a cookie when state saving is enabled.
|
||||
* @type string
|
||||
* @default SpryMedia_DataTables_
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "sCookiePrefix": "my_datatable_",
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sCookiePrefix": "SpryMedia_DataTables_",
|
||||
|
||||
|
||||
/**
|
||||
* This initialisation variable allows you to specify exactly where in the
|
||||
* DOM you want DataTables to inject the various controls it adds to the page
|
||||
* (for example you might want the pagination controls at the top of the
|
||||
* table). DIV elements (with or without a custom class) can also be added to
|
||||
* aid styling. The follow syntax is used:
|
||||
* <ul>
|
||||
* <li>The following options are allowed:
|
||||
* <ul>
|
||||
* <li>'l' - Length changing</li
|
||||
* <li>'f' - Filtering input</li>
|
||||
* <li>'t' - The table!</li>
|
||||
* <li>'i' - Information</li>
|
||||
* <li>'p' - Pagination</li>
|
||||
* <li>'r' - pRocessing</li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* <li>The following constants are allowed:
|
||||
* <ul>
|
||||
* <li>'H' - jQueryUI theme "header" classes ('fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix')</li>
|
||||
* <li>'F' - jQueryUI theme "footer" classes ('fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix')</li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* <li>The following syntax is expected:
|
||||
* <ul>
|
||||
* <li>'<' and '>' - div elements</li>
|
||||
* <li>'<"class" and '>' - div with a class</li>
|
||||
* <li>'<"#id" and '>' - div with an ID</li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* <li>Examples:
|
||||
* <ul>
|
||||
* <li>'<"wrapper"flipt>'</li>
|
||||
* <li>'<lf<t>ip>'</li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* </ul>
|
||||
* @type string
|
||||
* @default lfrtip <i>(when bJQueryUI is false)</i> <b>or</b>
|
||||
* <"H"lfr>t<"F"ip> <i>(when bJQueryUI is true)</i>
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "sDom": '<"top"i>rt<"bottom"flp><"clear"&lgt;'
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sDom": "lfrtip",
|
||||
|
||||
|
||||
/**
|
||||
* DataTables features two different built-in pagination interaction methods
|
||||
* ('two_button' or 'full_numbers') which present different page controls to
|
||||
* the end user. Further methods can be added using the API (see below).
|
||||
* @type string
|
||||
* @default two_button
|
||||
*
|
||||
* @example
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "sPaginationType": "full_numbers"
|
||||
* } );
|
||||
* } )
|
||||
*/
|
||||
"sPaginationType": "two_button",
|
||||
|
||||
|
||||
/**
|
||||
* Enable horizontal scrolling. When a table is too wide to fit into a certain
|
||||
* layout, or you have a large number of columns in the table, you can enable
|
||||
* x-scrolling to show the table in a viewport, which can be scrolled. This
|
||||
* property can by any CSS unit, or a number (in which case it will be treated
|
||||
* as a pixel measurement).
|
||||
* @type string
|
||||
* @default <i>blank string - i.e. disabled</i>
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "sScrollX": "100%",
|
||||
* "bScrollCollapse": true
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sScrollX": "",
|
||||
|
||||
|
||||
/**
|
||||
* This property can be used to force a DataTable to use more width than it
|
||||
* might otherwise do when x-scrolling is enabled. For example if you have a
|
||||
* table which requires to be well spaced, this parameter is useful for
|
||||
* "over-sizing" the table, and thus forcing scrolling. This property can by
|
||||
* any CSS unit, or a number (in which case it will be treated as a pixel
|
||||
* measurement).
|
||||
* @type string
|
||||
* @default <i>blank string - i.e. disabled</i>
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "sScrollX": "100%",
|
||||
* "sScrollXInner": "110%"
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sScrollXInner": "",
|
||||
|
||||
/**
|
||||
* Enable vertical scrolling. Vertical scrolling will constrain the DataTable
|
||||
* to the given height, an enable scrolling for any data which overflows the
|
||||
* current viewport. This can be used as an alternative to paging to display
|
||||
* a lot of data in a small area (although paging and scrolling can both be
|
||||
* enabled at the same time). This property can by any CSS unit, or a number
|
||||
* (in which case it will be treated as a pixel measurement).
|
||||
* @type string
|
||||
* @default <i>blank string - i.e. disabled</i>
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "sScrollY": "200px",
|
||||
* "bPaginate": false
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sScrollY": ""
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Variable: dataTableSettings
|
||||
* Purpose: Store the settings for each dataTables instance
|
||||
* Scope: jQuery.fn
|
||||
*/
|
||||
var _aoSettings = [];
|
||||
|
||||
/*
|
||||
* Function: classSettings
|
||||
* Purpose: Settings container function for all 'class' properties which are required
|
||||
* by dataTables
|
||||
* Returns: -
|
||||
* Inputs: -
|
||||
*/
|
||||
DataTable.models.oSettings = {
|
||||
|
||||
/*
|
||||
* Variable: oFeatures
|
||||
* Purpose: Indicate the enablement of key dataTable features
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
oFeatures: {
|
||||
"bPaginate": true,
|
||||
"bLengthChange": true,
|
||||
"bFilter": true,
|
||||
"bSort": true,
|
||||
"bInfo": true,
|
||||
"bAutoWidth": true,
|
||||
"bProcessing": false,
|
||||
"bSortClasses": true,
|
||||
"bStateSave": false,
|
||||
"bServerSide": false,
|
||||
"bDeferRender": false
|
||||
},
|
||||
|
||||
/*
|
||||
* Variable: oScroll
|
||||
* Purpose: Container for scrolling options
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
oScroll: {
|
||||
"sX": "",
|
||||
"sXInner": "",
|
||||
"sY": "",
|
||||
"bCollapse": false,
|
||||
"bInfinite": false,
|
||||
"iLoadGap": 100,
|
||||
"iBarWidth": 0,
|
||||
"bAutoCss": true
|
||||
},
|
||||
|
||||
/*
|
||||
* Variable: aanFeatures
|
||||
* Purpose: Array referencing the nodes which are used for the features
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* 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: [],
|
||||
|
||||
/*
|
||||
* Variable: oLanguage
|
||||
* Purpose: Store the language strings used by dataTables
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* 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
|
||||
},
|
||||
|
||||
/*
|
||||
* Variable: aoData
|
||||
* Purpose: Store data information
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* Notes: This is an array of objects with the following parameters:
|
||||
* int: _iId - internal id for tracking
|
||||
* array: _aData - internal data - used for sorting / filtering etc
|
||||
* node: nTr - display node
|
||||
* array node: _anHidden - hidden TD nodes
|
||||
* string: _sRowStripe
|
||||
*/
|
||||
aoData: [],
|
||||
|
||||
/*
|
||||
* Variable: aiDisplay
|
||||
* Purpose: Array of indexes which are in the current display (after filtering etc)
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
aiDisplay: [],
|
||||
|
||||
/*
|
||||
* Variable: aiDisplayMaster
|
||||
* Purpose: Array of indexes for display - no filtering
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
aiDisplayMaster: [],
|
||||
|
||||
/*
|
||||
* 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: iNextId
|
||||
* Purpose: Store the next unique id to be used for a new row
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
iNextId: 0,
|
||||
|
||||
/*
|
||||
* Variable: asDataSearch
|
||||
* Purpose: Search data array for regular expression searching
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
asDataSearch: [],
|
||||
|
||||
/*
|
||||
* Variable: oPreviousSearch
|
||||
* Purpose: Store the previous search incase we want to force a re-search
|
||||
* or compare the old search to a new one
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
oPreviousSearch: {
|
||||
"sSearch": "",
|
||||
"bRegex": false,
|
||||
"bSmart": true
|
||||
},
|
||||
|
||||
/*
|
||||
* Variable: aoPreSearchCols
|
||||
* Purpose: Store the previous search for each column
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
aoPreSearchCols: [],
|
||||
|
||||
/*
|
||||
* Variable: aaSorting
|
||||
* Purpose: Sorting information
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* Notes: Index 0 - column number
|
||||
* Index 1 - current sorting direction
|
||||
* Index 2 - index of asSorting for this column
|
||||
*/
|
||||
aaSorting: [ [0, 'asc', 0] ],
|
||||
|
||||
/*
|
||||
* Variable: aaSortingFixed
|
||||
* Purpose: Sorting information that is always applied
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
aaSortingFixed: null,
|
||||
|
||||
/*
|
||||
* Variable: asStripeClasses
|
||||
* Purpose: Classes to use for the striping of a table
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
asStripeClasses: [],
|
||||
|
||||
/*
|
||||
* Variable: asDestroyStripes
|
||||
* Purpose: If restoring a table - we should restore its striping classes as well
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
asDestroyStripes: [],
|
||||
|
||||
/*
|
||||
* Variable: sDestroyWidth
|
||||
* Purpose: If restoring a table - we should restore its width
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
sDestroyWidth: 0,
|
||||
|
||||
/*
|
||||
* Variable: fnRowCallback
|
||||
* Purpose: Call this function every time a row is inserted (draw)
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
fnRowCallback: null,
|
||||
|
||||
/*
|
||||
* Variable: fnHeaderCallback
|
||||
* Purpose: Callback function for the header on each draw
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
fnHeaderCallback: null,
|
||||
|
||||
/*
|
||||
* Variable: fnFooterCallback
|
||||
* Purpose: Callback function for the footer on each draw
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
fnFooterCallback: null,
|
||||
|
||||
/*
|
||||
* Variable: aoDrawCallback
|
||||
* Purpose: Array of callback functions for draw callback functions
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* 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: [],
|
||||
|
||||
/*
|
||||
* Variable: fnPreDrawCallback
|
||||
* Purpose: Callback function for just before the table is redrawn. A return of false
|
||||
* will be used to cancel the draw.
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
fnPreDrawCallback: null,
|
||||
|
||||
/*
|
||||
* Variable: fnInitComplete
|
||||
* Purpose: Callback function for when the table has been initialised
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
fnInitComplete: null,
|
||||
|
||||
/*
|
||||
* Variable: sTableId
|
||||
* Purpose: Cache the table ID for quick access
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
sTableId: "",
|
||||
|
||||
/*
|
||||
* Variable: nTable
|
||||
* Purpose: Cache the table node for quick access
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
nTable: null,
|
||||
|
||||
/*
|
||||
* Variable: nTHead
|
||||
* Purpose: Permanent ref to the thead element
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
nTHead: null,
|
||||
|
||||
/*
|
||||
* Variable: nTFoot
|
||||
* Purpose: Permanent ref to the tfoot element - if it exists
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
nTFoot: null,
|
||||
|
||||
/*
|
||||
* Variable: nTBody
|
||||
* Purpose: Permanent ref to the tbody element
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
nTBody: null,
|
||||
|
||||
/*
|
||||
* Variable: nTableWrapper
|
||||
* Purpose: Cache the wrapper node (contains all DataTables controlled elements)
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
nTableWrapper: null,
|
||||
|
||||
/*
|
||||
* Variable: bDeferLoading
|
||||
* Purpose: Indicate if when using server-side processing the loading of data
|
||||
* should be deferred until the second draw
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
bDeferLoading: false,
|
||||
|
||||
/*
|
||||
* Variable: bInitialised
|
||||
* Purpose: Indicate if all required information has been read in
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
bInitialised: false,
|
||||
|
||||
/*
|
||||
* Variable: aoOpenRows
|
||||
* Purpose: Information about open rows
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* Notes: Has the parameters 'nTr' and 'nParent'
|
||||
*/
|
||||
aoOpenRows: [],
|
||||
|
||||
/*
|
||||
* Variable: sDom
|
||||
* Purpose: Dictate the positioning that the created elements will take
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* 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',
|
||||
|
||||
/*
|
||||
* Variable: sPaginationType
|
||||
* Purpose: Note which type of sorting should be used
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
sPaginationType: "two_button",
|
||||
|
||||
/*
|
||||
* Variable: iCookieDuration
|
||||
* Purpose: The cookie duration (for bStateSave) in seconds - default 2 hours
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
iCookieDuration: 60 * 60 * 2,
|
||||
|
||||
/*
|
||||
* Variable: sCookiePrefix
|
||||
* Purpose: The cookie name prefix
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
sCookiePrefix: "SpryMedia_DataTables_",
|
||||
|
||||
/*
|
||||
* Variable: fnCookieCallback
|
||||
* Purpose: Callback function for cookie creation
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
fnCookieCallback: null,
|
||||
|
||||
/*
|
||||
* Variable: aoStateSave
|
||||
* Purpose: Array of callback functions for state saving
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* 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: [],
|
||||
|
||||
/*
|
||||
* Variable: aoStateLoad
|
||||
* Purpose: Array of callback functions for state loading
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* 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: [],
|
||||
|
||||
/*
|
||||
* Variable: oLoadedState
|
||||
* Purpose: State that was loaded from the cookie. Useful for back reference
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
oLoadedState: null,
|
||||
|
||||
/*
|
||||
* Variable: sAjaxSource
|
||||
* Purpose: Source url for AJAX data for the table
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
sAjaxSource: null,
|
||||
|
||||
/*
|
||||
* Variable: sAjaxDataProp
|
||||
* Purpose: Property from a given object from which to read the table data from. This can
|
||||
* be an empty string (when not server-side processing), in which case it is
|
||||
* assumed an an array is given directly.
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
sAjaxDataProp: 'aaData',
|
||||
|
||||
/*
|
||||
* Variable: bAjaxDataGet
|
||||
* Purpose: Note if draw should be blocked while getting data
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
bAjaxDataGet: true,
|
||||
|
||||
/*
|
||||
* Variable: jqXHR
|
||||
* Purpose: The last jQuery XHR object that was used for server-side data gathering.
|
||||
* This can be used for working with the XHR information in one of the callbacks
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
jqXHR: null,
|
||||
|
||||
/*
|
||||
* Variable: fnServerData
|
||||
* Purpose: Function to get the server-side data - can be overruled by the developer
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
fnServerData: function ( url, data, callback, settings ) {
|
||||
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
|
||||
* Purpose: Functions which are called prior to sending an Ajax request so extra parameters
|
||||
* can easily be sent to the server
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* Notes: Each array element is an object with the following parameters:
|
||||
* function:fn - function to call
|
||||
* string:sName - name callback - useful for knowing where it came from (plugin etc)
|
||||
*/
|
||||
aoServerParams: [],
|
||||
|
||||
/*
|
||||
* Variable: sServerType
|
||||
* Purpose: Send the XHR HTTP method - GET or POST (could be PUT or DELETE if required)
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
sServerMethod: "GET",
|
||||
|
||||
/*
|
||||
* Variable: fnFormatNumber
|
||||
* Purpose: Format numbers for display
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
fnFormatNumber: function ( iIn )
|
||||
{
|
||||
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
|
||||
* Purpose: List of options that can be used for the user selectable length menu
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* 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 ],
|
||||
|
||||
/*
|
||||
* Variable: iDraw
|
||||
* Purpose: Counter for the draws that the table does. Also used as a tracker for
|
||||
* server-side processing
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
iDraw: 0,
|
||||
|
||||
/*
|
||||
* Variable: bDrawing
|
||||
* Purpose: Indicate if a redraw is being done - useful for Ajax
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
bDrawing: 0,
|
||||
|
||||
/*
|
||||
* Variable: iDrawError
|
||||
* Purpose: Last draw error
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
iDrawError: -1,
|
||||
|
||||
/*
|
||||
* Variable: _iDisplayLength, _iDisplayStart, _iDisplayEnd
|
||||
* Purpose: Display length variables
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* Notes: These variable must NOT be used externally to get the data length. Rather, use
|
||||
* the fnRecordsTotal() (etc) functions.
|
||||
*/
|
||||
_iDisplayLength: 10,
|
||||
_iDisplayStart: 0,
|
||||
_iDisplayEnd: 10,
|
||||
|
||||
/*
|
||||
* Variable: _iRecordsTotal, _iRecordsDisplay
|
||||
* Purpose: Display length variables used for server side processing
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
* Notes: These variable must NOT be used externally to get the data length. Rather, use
|
||||
* the fnRecordsTotal() (etc) functions.
|
||||
*/
|
||||
_iRecordsTotal: 0,
|
||||
_iRecordsDisplay: 0,
|
||||
|
||||
/*
|
||||
* Variable: bJUI
|
||||
* Purpose: Should we add the markup needed for jQuery UI theming?
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
bJUI: false,
|
||||
|
||||
/*
|
||||
* Variable: oClasses
|
||||
* Purpose: Should we add the markup needed for jQuery UI theming?
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
oClasses: null,
|
||||
|
||||
/*
|
||||
* Variable: bFiltered and bSorted
|
||||
* Purpose: Flags to allow callback functions to see what actions have been performed
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
bFiltered: false,
|
||||
bSorted: false,
|
||||
|
||||
/*
|
||||
* Variable: bSortCellsTop
|
||||
* Purpose: 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
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
bSortCellsTop: false,
|
||||
|
||||
/*
|
||||
* Variable: oInit
|
||||
* Purpose: Initialisation object that is used for the table
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
oInit: null,
|
||||
|
||||
/*
|
||||
* Variable: aoDestroyCallback
|
||||
* Purpose: Destroy callback functions
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
aoDestroyCallback: [],
|
||||
|
||||
|
||||
fnRecordsTotal: function ()
|
||||
{
|
||||
if ( this.oFeatures.bServerSide ) {
|
||||
return parseInt(this._iRecordsTotal, 10);
|
||||
} else {
|
||||
return this.aiDisplayMaster.length;
|
||||
}
|
||||
},
|
||||
|
||||
fnRecordsDisplay: function ()
|
||||
{
|
||||
if ( this.oFeatures.bServerSide ) {
|
||||
return parseInt(this._iRecordsDisplay, 10);
|
||||
} else {
|
||||
return this.aiDisplay.length;
|
||||
}
|
||||
},
|
||||
|
||||
fnDisplayEnd: function ()
|
||||
{
|
||||
if ( this.oFeatures.bServerSide ) {
|
||||
if ( this.oFeatures.bPaginate === false || this._iDisplayLength == -1 ) {
|
||||
return this._iDisplayStart+this.aiDisplay.length;
|
||||
} else {
|
||||
return Math.min( this._iDisplayStart+this._iDisplayLength,
|
||||
this._iRecordsDisplay );
|
||||
}
|
||||
} else {
|
||||
return this._iDisplayEnd;
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* Variable: oInstance
|
||||
* Purpose: The DataTables object for this table
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
oInstance: null,
|
||||
|
||||
/*
|
||||
* Variable: sInstance
|
||||
* Purpose: Unique idendifier for each instance of the DataTables object
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
sInstance: null,
|
||||
|
||||
oClasses: null
|
||||
};
|
||||
var modelRow = {
|
||||
"nTr": null,
|
||||
"_iId": null,
|
||||
"_aData": null,
|
||||
"_aSortData": [],
|
||||
"_anHidden": [],
|
||||
"_sRowStripe": ""
|
||||
};
|
||||
var modelColumn = {
|
||||
"sType": null,
|
||||
"_bAutoType": true,
|
||||
"bVisible": true,
|
||||
"bSearchable": true,
|
||||
"bSortable": true,
|
||||
"asSorting": [ 'asc', 'desc' ],
|
||||
"sSortingClass": null,
|
||||
"sSortingClassJUI": null,
|
||||
"sTitle": '',
|
||||
"sName": '',
|
||||
"sWidth": null,
|
||||
"sWidthOrig": null,
|
||||
"sClass": null,
|
||||
"fnRender": null,
|
||||
"bUseRendered": true,
|
||||
"aDataSort": [],
|
||||
"mDataProp": null,
|
||||
"fnGetData": null,
|
||||
"fnSetData": null,
|
||||
"sSortDataType": 'std',
|
||||
"sDefaultContent": null,
|
||||
"sContentPadding": "",
|
||||
"nTh": null,
|
||||
"nTf": null
|
||||
};
|
||||
|
||||
DataTable.ext = {};
|
||||
|
||||
// jQuery aliases
|
||||
$.fn.dataTable = DataTable;
|
||||
$.fn.dataTableSettings = _aoSettings;
|
||||
|
@ -42,9 +42,7 @@ for ( i=0, iLen=_aoSettings.length ; i<iLen ; i++ )
|
||||
}
|
||||
|
||||
/* Make a complete and independent copy of the settings object */
|
||||
var oSettings = $.extend( true, classSettings, {
|
||||
"oClasses": _oExt.oStdClasses
|
||||
} );
|
||||
var oSettings = $.extend( true, {}, DataTable.models.oSettings );
|
||||
|
||||
_aoSettings.push( oSettings );
|
||||
|
||||
@ -87,10 +85,15 @@ oSettings.oApi = _that.oApi;
|
||||
/* State the table's width for if a destroy is called at a later time */
|
||||
oSettings.sDestroyWidth = $(this).width();
|
||||
|
||||
/* Store the features that we have available */
|
||||
if ( typeof oInit != 'undefined' && oInit !== null )
|
||||
{
|
||||
|
||||
/* Store the initialisation object that was passed in, useful for debugging */
|
||||
oSettings.oInit = oInit;
|
||||
|
||||
oInit = (typeof oInit === 'undefined' || oInit === null) ?
|
||||
$( true, {}, DataTable.models.oInit ) :
|
||||
$( true, {}, DataTable.models.oInit, oInit );
|
||||
|
||||
|
||||
_fnMap( oSettings.oFeatures, oInit, "bPaginate" );
|
||||
_fnMap( oSettings.oFeatures, oInit, "bLengthChange" );
|
||||
_fnMap( oSettings.oFeatures, oInit, "bFilter" );
|
||||
@ -201,6 +204,10 @@ if ( typeof oInit != 'undefined' && oInit !== null )
|
||||
oSettings.sDom = '<"H"lfr>t<"F"ip>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
oSettings.oClasses = _oExt.oStdClasses;
|
||||
}
|
||||
|
||||
/* Calculate the scroll bar width and cache it for use later on */
|
||||
if ( oSettings.oScroll.sX !== "" || oSettings.oScroll.sY !== "" )
|
||||
@ -267,12 +274,11 @@ if ( typeof oInit != 'undefined' && oInit !== null )
|
||||
* below is complete. The reason for spliting it like this is optimisation - we can fire
|
||||
* off the XHR (if needed) and then continue processing the data.
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Create a dummy object for quick manipulation later on. */
|
||||
oInit = {};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Stripes
|
||||
|
@ -13,7 +13,7 @@ var _aoSettings = [];
|
||||
* Returns: -
|
||||
* Inputs: -
|
||||
*/
|
||||
var classSettings = {
|
||||
DataTable.models.oSettings = {
|
||||
|
||||
/*
|
||||
* Variable: oFeatures
|
||||
|
Loading…
x
Reference in New Issue
Block a user