Namespace: oApi

Ancestry: DataTable# ยป oApi

DataTables v1.9.0 documentation

Navigation

Hiding private elements (toggle)
Showing extended elements (toggle)

Reference to internal functions for use by plug-in developers. Note that these methods are references to internal functions and are considered to be private. If you use these methods, be aware that they are liable to change between versions (check the upgrade notes).

Summary

Properties

<static> _fnJsonString
JSON stringify. If JSON.stringify it provided by the browser, json2.js or any other library, then we use that as it is fast, safe and accurate. If the function isn't available then we need to built it ourselves - the insperation for this function comes from Craig Buckler ( http://www.sitepoint.com/javascript-json-serialization/ ). It is not perfect and absolutely should not be used as a replacement to json2.js - but it does do what we need, without requiring a dependency for DataTables.

Methods

<static> _fnAddColumn(oSettings, nTh)
Add a column to the list used for the table with default values
<static> _fnAddData(oSettings, aData) → {int}
Add a data array to the table, creating DOM node etc. This is the parallel to _fnGatherData, but for adding rows from a Javascript source, rather than a DOM source.
<static> _fnAddOptionsHtml(oSettings)
Add the options to the page HTML for the table
<static> _fnAdjustColumnSizing(oSettings)
Adjust the table column widths for new data. Note: you would probably want to do a redraw after calling this function!
<static> _fnAjaxParameters(oSettings) → {bool}
Build up the parameters in an object needed for a server-side processing request
<static> _fnAjaxUpdate(oSettings) → {boolean}
Update the table using an Ajax call
<static> _fnAjaxUpdateDraw(oSettings, json)
Data the data from the server (nuking the old) and redraw the table
<static> _fnApplyColumnDefs(oSettings, aoColDefs, aoCols, fn)
Take the column definitions and static columns arrays and calculate how they relate to column indexes. The callback function will then apply the definition found for a column to a suitable configuration object.
<static> _fnApplyToChildren(fn, array, array)
Apply a given function to the display child nodes of an element array (typically TD children of TR rows
<static> _fnBindAction(n, oData, {function))
Bind an event handers to allow a click or return key to activate the callback. This is good for accessability since a return on the keyboard will have the same effect as a click, if the element has focus.
<static> _fnBuildHead(oSettings)
Create the HTML header for the table
<static> _fnBuildSearchArray(oSettings, iMaster)
Create an array which can be quickly search through
<static> _fnBuildSearchRow(oSettings, aData)
Create a searchable string from a single data row
<static> _fnCalculateColumnWidths(oSettings)
Calculate the width of columns for the table
<static> _fnCalculateEnd(oSettings)
Rcalculate the end point based on the start point
<static> _fnCallbackFire(oSettings, sStore, sTrigger, {array))
Fire callback functions and trigger events. Note that the loop over the callback array store is done backwards! Further note that you do not want to fire off triggers in time sensitive applications (for example cell creation) as its slow.
<static> _fnCallbackReg(oSettings, sStore, fn, {string))
Register a callback function. Easily allows a callback function to be added to an array store of callback functions that can then all be called together.
<static> _fnClearTable(oSettings)
Nuke the table
<static> _fnColumnIndexToVisible(iMatch, oSettings) → {int}
Covert the index of an index in the data array and convert it to the visible column index (take account of hidden columns)
<static> _fnColumnOptions(oSettings, iCol, oOptions)
Apply options for a column
<static> _fnColumnOrdering(oSettings) → {string}
Get the column ordering that DataTables expects
<static> _fnConvertToWidth(sWidth, nParent) → {int}
Convert a CSS unit width to pixels (e.g. 2em)
<static> _fnCreateCookie(sName, sValue, iSecs, sBaseName, fnCallback)
Create a new cookie with a value to store the state of a table
<static> _fnCreateTr(oSettings, iRow)
Create a new TR element (and it's TD children) for a row
<static> _fnDataToSearch(sData, sType) → {string}
Convert raw data into something that the user can search on
<static> _fnDeleteIndex(a, iTarget)
Take an array of integers (index array) and remove a target integer (value - not the key!)
<static> _fnDetectHeader(array, nThead)
Use the DOM source to create up an array of header cells. The idea here is to create a layout grid (array) of rows x columns, which contains a reference to the cell that that point in the grid (regardless of col/rowspan), such that any column / row could be removed and the new grid constructed
<static> _fnDetectType(sData) → {string}
Get the sort type based on an input string
<static> _fnDraw(oSettings)
Insert the required TR nodes into the table for display
<static> _fnDrawHead(oSettings, array, bIncludeHidden)
Draw the header (or footer) element based on the column visibility states. The methodology here is to use the layout array from _fnDetectHeader, modified for the instantaneous column visibility, to construct the new layout. The grid is traversed over cell at a time in a rows x columns grid fashion, although each cell insert can cover multiple elements in the grid - which is tracks using the aApplied array. Cell inserts in the grid will only occur where there isn't already a cell in that position.
<static> _fnEscapeRegex(sVal) → {string}
scape a string stuch that it can be used in a regular expression
<static> _fnExtend(oOut, oExtender) → {object}
Extend objects - very similar to jQuery.extend, but deep copy objects, and shallow copy arrays. The reason we need to do this, is that we don't want to deep copy array init values (such as aaSorting) since the dev wouldn't be able to override them, but we do want to deep copy arrays.
<static> _fnExternApiFunc(sFunc) → {function}
Create a wrapper function for exporting an internal functions to an external API.
<static> _fnFeatureHtmlFilter(oSettings) → {node}
Generate the node required for filtering text
<static> _fnFeatureHtmlInfo(oSettings) → {node}
Generate the node required for the info display
<static> _fnFeatureHtmlLength(oSettings) → {node}
Generate the node required for user display length changing
<static> _fnFeatureHtmlPaginate(oSettings) → {node}
Generate the node required for default pagination
<static> _fnFeatureHtmlProcessing(oSettings) → {node}
Generate the node required for the processing node
<static> _fnFeatureHtmlTable(oSettings) → {node}
Add any control elements for the table - specifically scrolling
<static> _fnFilter(oSettings, sInput, iForce, bRegex, bSmart, bCaseInsensitive)
Filter the data table based on user input and draw the table
<static> _fnFilterColumn(oSettings, sInput, iColumn, bRegex, bSmart, bCaseInsensitive)
Filter the table on a per-column basis
<static> _fnFilterComplete(oSettings, oSearch, iForce)
Filter the table using both the global filter and column based filtering
<static> _fnFilterCreateSearch(sSearch, bRegex, bSmart, bCaseInsensitive) → {RegExp}
Build a regular expression object suitable for searching a table
<static> _fnFilterCustom(oSettings)
Apply custom filtering functions
<static> _fnGatherData(oSettings)
Read in the data from the target table from the DOM
<static> _fnGetCellData(oSettings, iRow, iCol, sSpecific) → {*}
Get the data for a given cell from the internal cache, taking into account data mapping
<static> _fnGetDataMaster(oSettings)
Return an array with the full table data
<static> _fnGetMaxLenString(oSettings, iCol) → {string}
Get the maximum strlen for each data column
<static> _fnGetObjectDataFn(mSource) → {function}
Return a function that can be used to get data from a source object, taking into account the ability to use nested objects as a source
<static> _fnGetRowData(oSettings, iRow, sSpecific) → {array}
Get an array of data for a given row from the internal data cache
<static> _fnGetTdNodes(oSettings, iIndividualRow) → {array}
Return an flat array with all TD nodes for the table, or row
<static> _fnGetTrNodes(oSettings) → {array}
Return an array with the TR nodes for the table
<static> _fnGetUniqueThs(oSettings, nHeader, aLayout)
Get an array of unique th elements, one for each column
<static> _fnGetWidestNode(oSettings, iCol) → {string}
Get the widest node
<static> _fnInitComplete(oSettings, json)
Draw the table for the first time, adding all required features
<static> _fnInitialise(oSettings)
Draw the table for the first time, adding all required features
<static> _fnLanguageCompat(oSettings)
Language compatibility - when certain options are given, and others aren't, we need to duplicate the values over, in order to provide backwards compatibility with older language files.
<static> _fnLoadState(oSettings, oInit)
Attempt to load a saved table state from a cookie
<static> _fnLog(oSettings, iLevel, sMesg)
Log an error message
<static> _fnMap(oRet, oSrc, sName, sMappedName)
See if a property is defined on one object, if so assign it to the other object
<static> _fnNodeToColumnIndex(oSettings, iRow, n) → {int}
Take a TD element and convert it into a column data index (not the visible index)
<static> _fnNodeToDataIndex(oSettings, n) → {int}
Take a TR element and convert it to an index in aoData
<static> _fnPageChange(oSettings, mAction) → {bool}
Alter the display settings to change the page
<static> _fnProcessingDisplay(oSettings, bShow)
Display or hide the processing indicator
<static> _fnReadCookie(sName) → {string}
Read an old cookie to get a cookie with an old table state
<static> _fnReDraw(oSettings)
Redraw the table - taking account of the various features which are enabled
<static> _fnRender(oSettings, iRow, iCol) → {*}
Call the developer defined fnRender function for a given cell (row/column) with the required parameters and return the result.
<static> _fnReOrderIndex(oSettings)
Figure out how to reorder a display list
<static> _fnSaveState(oSettings)
Save the state of a table in a cookie such that the page can be reloaded
<static> _fnScrollBarWidth() → {int}
Get the width of a scroll bar in this browser being used
<static> _fnScrollDraw(o) → {node}
Update the various tables for resizing. It's a bit of a pig this function, but basically the idea to: 1. Re-create the table inside the scrolling div 2. Take live measurements from the DOM 3. Apply the measurements 4. Clean up
<static> _fnScrollingWidthAdjust(oSettings, n)
Adjust a table's width to take account of scrolling
<static> _fnServerParams(oSettings, array)
Add Ajax parameters from plugins
<static> _fnSetCellData(oSettings, iRow, iCol, val)
Set the value for a specific cell, into the internal data cache
<static> _fnSetObjectDataFn(mSource) → {function}
Return a function that can be used to set data from a source object, taking into account the ability to use nested objects as a source
<static> _fnSettingsFromNode(nTable) → {object}
Return the settings object for a particular table
<static> _fnSort(oSettings, bApplyClasses)
Change the order of the table
<static> _fnSortAttachListener(oSettings, nNode, iDataIndex, fnCallback)
Attach a sort handler (click) to a node
<static> _fnSortingClasses(oSettings)
Set the sorting classes on the header, Note: it is safe to call this function when bSort and bSortClasses are false
<static> _fnStringToCss(aArray1, aArray2) → {int}
Append a CSS unit (only if required) to a string
<static> _fnUpdateInfo(oSettings)
Update the information elements in the display
<static> _fnVisbleColumns(oS) → {int}
Get the number of visible columns
<static> _fnVisibleToColumnIndex(oSettings, iMatch) → {int}
Covert the index of a visible column to the index in the data array (take account of hidden columns)

Details

Properties

<static> _fnJsonString

JSON stringify. If JSON.stringify it provided by the browser, json2.js or any other library, then we use that as it is fast, safe and accurate. If the function isn't available then we need to built it ourselves - the insperation for this function comes from Craig Buckler ( http://www.sitepoint.com/javascript-json-serialization/ ). It is not perfect and absolutely should not be used as a replacement to json2.js - but it does do what we need, without requiring a dependency for DataTables.

Methods

<static> _fnAddColumn(oSettings, nTh)

Add a column to the list used for the table with default values

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
nThnodeThe th element for this column
<static> _fnAddData(oSettings, aData) → {int}

Add a data array to the table, creating DOM node etc. This is the parallel to _fnGatherData, but for adding rows from a Javascript source, rather than a DOM source.

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
aDataarraydata array to be added
Returns:

>=0 if successful (index of new aoData entry), -1 if failed

<static> _fnAddOptionsHtml(oSettings)

Add the options to the page HTML for the table

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
<static> _fnAdjustColumnSizing(oSettings)

Adjust the table column widths for new data. Note: you would probably want to do a redraw after calling this function!

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
<static> _fnAjaxParameters(oSettings) → {bool}

Build up the parameters in an object needed for a server-side processing request

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
Returns:

block the table drawing or not

<static> _fnAjaxUpdate(oSettings) → {boolean}

Update the table using an Ajax call

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
Returns:

Block the table drawing or not

<static> _fnAjaxUpdateDraw(oSettings, json)

Data the data from the server (nuking the old) and redraw the table

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
jsonobjectjson data return from the server.
json.sEchostringTracking flag for DataTables to match requests
json.iTotalRecordsintNumber of records in the data set, not accounting for filtering
json.iTotalDisplayRecordsintNumber of records in the data set, accounting for filtering
json.aaDataarrayThe data to display on this page
json.sColumnsstring<optional>
Column ordering (sName, comma separated)
<static> _fnApplyColumnDefs(oSettings, aoColDefs, aoCols, fn)

Take the column definitions and static columns arrays and calculate how they relate to column indexes. The callback function will then apply the definition found for a column to a suitable configuration object.

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
aoColDefsarrayThe aoColumnDefs array that is to be applied
3
aoColsarrayThe aoColumns array that defines columns individually
4
fnfunctionCallback function - takes two parameters, the calculated column index and the definition for that column.
<static> _fnApplyToChildren(fn, array, array)

Apply a given function to the display child nodes of an element array (typically TD children of TR rows

Parameters:
Name Type Attributes Default Description
1
fnfunctionMethod to apply to the objects
2
array{nodes} an1 List of elements to look through for display children
3
array{nodes} an2 Another list (identical structure to the first) - optional
<static> _fnBindAction(n, oData, {function))

Bind an event handers to allow a click or return key to activate the callback. This is good for accessability since a return on the keyboard will have the same effect as a click, if the element has focus.

Parameters:
Name Type Attributes Default Description
1
nelementElement to bind the action to
2
oDataobjectData object to pass to the triggered function
3
{function)fn Callback function for when the event is triggered
<static> _fnBuildHead(oSettings)

Create the HTML header for the table

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
<static> _fnBuildSearchArray(oSettings, iMaster)

Create an array which can be quickly search through

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
iMasterintuse the master data array - optional
<static> _fnBuildSearchRow(oSettings, aData)

Create a searchable string from a single data row

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
aDataarrayRow data array to use for the data to search
<static> _fnCalculateColumnWidths(oSettings)

Calculate the width of columns for the table

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
<static> _fnCalculateEnd(oSettings)

Rcalculate the end point based on the start point

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
<static> _fnCallbackFire(oSettings, sStore, sTrigger, {array))

Fire callback functions and trigger events. Note that the loop over the callback array store is done backwards! Further note that you do not want to fire off triggers in time sensitive applications (for example cell creation) as its slow.

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
sStorestringName of the array storeage for the callbacks in oSettings
3
sTriggerstringName of the jQuery custom event to trigger. If null no trigger is fired
4
{array)aArgs Array of arguments to pass to the callback function / trigger
<static> _fnCallbackReg(oSettings, sStore, fn, {string))

Register a callback function. Easily allows a callback function to be added to an array store of callback functions that can then all be called together.

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
sStorestringName of the array storeage for the callbacks in oSettings
3
fnfunctionFunction to be called back
4
{string)sName Identifying name for the callback (i.e. a label)
<static> _fnClearTable(oSettings)

Nuke the table

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
<static> _fnColumnIndexToVisible(iMatch, oSettings) → {int}

Covert the index of an index in the data array and convert it to the visible column index (take account of hidden columns)

Parameters:
Name Type Attributes Default Description
1
iMatchintColumn index to lookup
2
oSettingsobjectdataTables settings object
Returns:

i the data index

<static> _fnColumnOptions(oSettings, iCol, oOptions)

Apply options for a column

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
iColintcolumn index to consider
3
oOptionsobjectobject with sType, bVisible and bSearchable
<static> _fnColumnOrdering(oSettings) → {string}

Get the column ordering that DataTables expects

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
Returns:

comma separated list of names

<static> _fnConvertToWidth(sWidth, nParent) → {int}

Convert a CSS unit width to pixels (e.g. 2em)

Parameters:
Name Type Attributes Default Description
1
sWidthstringwidth to be converted
2
nParentnodeparent to get the with for (required for relative widths) - optional
Returns:

iWidth width in pixels

<static> _fnCreateCookie(sName, sValue, iSecs, sBaseName, fnCallback)

Create a new cookie with a value to store the state of a table

Parameters:
Name Type Attributes Default Description
1
sNamestringname of the cookie to create
2
sValuestringthe value the cookie should take
3
iSecsintduration of the cookie
4
sBaseNamestringsName is made up of the base + file name - this is the base
5
fnCallbackfunctionUser definable function to modify the cookie
<static> _fnCreateTr(oSettings, iRow)

Create a new TR element (and it's TD children) for a row

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
iRowintRow to consider
<static> _fnDataToSearch(sData, sType) → {string}

Convert raw data into something that the user can search on

Parameters:
Name Type Attributes Default Description
1
sDatastringdata to be modified
2
sTypestringdata type
Returns:

search string

<static> _fnDeleteIndex(a, iTarget)

Take an array of integers (index array) and remove a target integer (value - not the key!)

Parameters:
Name Type Attributes Default Description
1
aarrayIndex array to target
2
iTargetintvalue to find
<static> _fnDetectHeader(array, nThead)

Use the DOM source to create up an array of header cells. The idea here is to create a layout grid (array) of rows x columns, which contains a reference to the cell that that point in the grid (regardless of col/rowspan), such that any column / row could be removed and the new grid constructed

Parameters:
Name Type Attributes Default Description
1
array{object} aLayout Array to store the calculated layout in
2
nTheadnodeThe header/footer element for the table
<static> _fnDetectType(sData) → {string}

Get the sort type based on an input string

Parameters:
Name Type Attributes Default Description
1
sDatastringdata we wish to know the type of
Returns:

type (defaults to 'string' if no type can be detected)

<static> _fnDraw(oSettings)

Insert the required TR nodes into the table for display

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
<static> _fnDrawHead(oSettings, array, bIncludeHidden)

Draw the header (or footer) element based on the column visibility states. The methodology here is to use the layout array from _fnDetectHeader, modified for the instantaneous column visibility, to construct the new layout. The grid is traversed over cell at a time in a rows x columns grid fashion, although each cell insert can cover multiple elements in the grid - which is tracks using the aApplied array. Cell inserts in the grid will only occur where there isn't already a cell in that position.

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
array{objects} aoSource Layout array from _fnDetectHeader
3
bIncludeHiddenbooleanOptionalfalseIf true then include the hidden columns in the calc,
<static> _fnEscapeRegex(sVal) → {string}

scape a string stuch that it can be used in a regular expression

Parameters:
Name Type Attributes Default Description
1
sValstringstring to escape
Returns:

escaped string

<static> _fnExtend(oOut, oExtender) → {object}

Extend objects - very similar to jQuery.extend, but deep copy objects, and shallow copy arrays. The reason we need to do this, is that we don't want to deep copy array init values (such as aaSorting) since the dev wouldn't be able to override them, but we do want to deep copy arrays.

Parameters:
Name Type Attributes Default Description
1
oOutobjectObject to extend
2
oExtenderobjectObject from which the properties will be applied to oOut
Returns:

oOut Reference, just for convenience - oOut === the return.

<static> _fnExternApiFunc(sFunc) → {function}

Create a wrapper function for exporting an internal functions to an external API.

Parameters:
Name Type Attributes Default Description
1
sFuncstringAPI function name
Returns:

wrapped function

<static> _fnFeatureHtmlFilter(oSettings) → {node}

Generate the node required for filtering text

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
Returns:

Filter control element

<static> _fnFeatureHtmlInfo(oSettings) → {node}

Generate the node required for the info display

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
Returns:

Information element

<static> _fnFeatureHtmlLength(oSettings) → {node}

Generate the node required for user display length changing

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
Returns:

Display length feature node

<static> _fnFeatureHtmlPaginate(oSettings) → {node}

Generate the node required for default pagination

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
Returns:

Pagination feature node

<static> _fnFeatureHtmlProcessing(oSettings) → {node}

Generate the node required for the processing node

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
Returns:

Processing element

<static> _fnFeatureHtmlTable(oSettings) → {node}

Add any control elements for the table - specifically scrolling

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
Returns:

Node to add to the DOM

<static> _fnFilter(oSettings, sInput, iForce, bRegex, bSmart, bCaseInsensitive)

Filter the data table based on user input and draw the table

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
sInputstringstring to filter on
3
iForceintoptional - force a research of the master array (1) or not (undefined or 0)
4
bRegexbooltreat as a regular expression or not
5
bSmartboolperform smart filtering or not
6
bCaseInsensitiveboolDo case insenstive matching or not
<static> _fnFilterColumn(oSettings, sInput, iColumn, bRegex, bSmart, bCaseInsensitive)

Filter the table on a per-column basis

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
sInputstringstring to filter on
3
iColumnintcolumn to filter
4
bRegexbooltreat search string as a regular expression or not
5
bSmartbooluse smart filtering or not
6
bCaseInsensitiveboolDo case insenstive matching or not
<static> _fnFilterComplete(oSettings, oSearch, iForce)

Filter the table using both the global filter and column based filtering

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
oSearchobjectsearch information
3
iForceintOptionalforce a research of the master array (1) or not (undefined or 0)
<static> _fnFilterCreateSearch(sSearch, bRegex, bSmart, bCaseInsensitive) → {RegExp}

Build a regular expression object suitable for searching a table

Parameters:
Name Type Attributes Default Description
1
sSearchstringstring to search for
2
bRegexbooltreat as a regular expression or not
3
bSmartboolperform smart filtering or not
4
bCaseInsensitiveboolDo case insenstive matching or not
Returns:

constructed object

<static> _fnFilterCustom(oSettings)

Apply custom filtering functions

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
<static> _fnGatherData(oSettings)

Read in the data from the target table from the DOM

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
<static> _fnGetCellData(oSettings, iRow, iCol, sSpecific) → {*}

Get the data for a given cell from the internal cache, taking into account data mapping

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
iRowintaoData row id
3
iColintColumn index
4
sSpecificstringdata get type ('display', 'type' 'filter' 'sort')
Returns:

Cell data

<static> _fnGetDataMaster(oSettings)

Return an array with the full table data

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
Returns:

array {array} aData Master data array

<static> _fnGetMaxLenString(oSettings, iCol) → {string}

Get the maximum strlen for each data column

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
iColintcolumn of interest
Returns:

max strlens for each column

<static> _fnGetObjectDataFn(mSource) → {function}

Return a function that can be used to get data from a source object, taking into account the ability to use nested objects as a source

Parameters:
Name Type Attributes Default Description
1
mSourcestring | int | functionThe data source for the object
Returns:

Data get function

<static> _fnGetRowData(oSettings, iRow, sSpecific) → {array}

Get an array of data for a given row from the internal data cache

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
iRowintaoData row id
3
sSpecificstringdata get type ('type' 'filter' 'sort')
Returns:

Data array

<static> _fnGetTdNodes(oSettings, iIndividualRow) → {array}

Return an flat array with all TD nodes for the table, or row

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
iIndividualRowintOptionalaoData index to get the nodes for - optional if not given then the return array will contain all nodes for the table
Returns:

TD array

<static> _fnGetTrNodes(oSettings) → {array}

Return an array with the TR nodes for the table

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
Returns:

TR array

<static> _fnGetUniqueThs(oSettings, nHeader, aLayout)

Get an array of unique th elements, one for each column

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
nHeadernodeautomatically detect the layout from this node - optional
3
aLayoutarraythead/tfoot layout from _fnDetectHeader - optional
Returns:

array {node} aReturn list of unique ths

<static> _fnGetWidestNode(oSettings, iCol) → {string}

Get the widest node

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
iColintcolumn of interest
Returns:

max strlens for each column

<static> _fnInitComplete(oSettings, json)

Draw the table for the first time, adding all required features

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
jsonobjectOptionalJSON from the server that completed the table, if using Ajax source with client-side processing (optional)
<static> _fnInitialise(oSettings)

Draw the table for the first time, adding all required features

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
<static> _fnLanguageCompat(oSettings)

Language compatibility - when certain options are given, and others aren't, we need to duplicate the values over, in order to provide backwards compatibility with older language files.

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
<static> _fnLoadState(oSettings, oInit)

Attempt to load a saved table state from a cookie

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
oInitobjectDataTables init object so we can override settings
<static> _fnLog(oSettings, iLevel, sMesg)

Log an error message

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
iLevelintlog error messages, or display them to the user
3
sMesgstringerror message
<static> _fnMap(oRet, oSrc, sName, sMappedName)

See if a property is defined on one object, if so assign it to the other object

Parameters:
Name Type Attributes Default Description
1
oRetobjecttarget object
2
oSrcobjectsource object
3
sNamestringproperty
4
sMappedNamestringOptionalname to map too - optional, sName used if not given
<static> _fnNodeToColumnIndex(oSettings, iRow, n) → {int}

Take a TD element and convert it into a column data index (not the visible index)

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
iRowintThe row number the TD/TH can be found in
3
nnodeThe TD/TH element to find
Returns:

index if the node is found, -1 if not

<static> _fnNodeToDataIndex(oSettings, n) → {int}

Take a TR element and convert it to an index in aoData

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
nnodethe TR element to find
Returns:

index if the node is found, null if not

<static> _fnPageChange(oSettings, mAction) → {bool}

Alter the display settings to change the page

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
mActionstring | intPaging action to take: "first", "previous", "next" or "last" or page number to jump to (integer)
Returns:

true page has changed, false - no change (no effect) eg 'first' on page 1

<static> _fnProcessingDisplay(oSettings, bShow)

Display or hide the processing indicator

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
bShowboolShow the processing indicator (true) or not (false)
<static> _fnReadCookie(sName) → {string}

Read an old cookie to get a cookie with an old table state

Parameters:
Name Type Attributes Default Description
1
sNamestringname of the cookie to read
Returns:

contents of the cookie - or null if no cookie with that name found

<static> _fnReDraw(oSettings)

Redraw the table - taking account of the various features which are enabled

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
<static> _fnRender(oSettings, iRow, iCol) → {*}

Call the developer defined fnRender function for a given cell (row/column) with the required parameters and return the result.

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
iRowintaoData index for the row
3
iColintaoColumns index for the column
Returns:

Return of the developer's fnRender function

<static> _fnReOrderIndex(oSettings)

Figure out how to reorder a display list

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
Returns:

array {int} aiReturn index list for reordering

<static> _fnSaveState(oSettings)

Save the state of a table in a cookie such that the page can be reloaded

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
<static> _fnScrollBarWidth() → {int}

Get the width of a scroll bar in this browser being used

Returns:

width in pixels

<static> _fnScrollDraw(o) → {node}

Update the various tables for resizing. It's a bit of a pig this function, but basically the idea to: 1. Re-create the table inside the scrolling div 2. Take live measurements from the DOM 3. Apply the measurements 4. Clean up

Parameters:
Name Type Attributes Default Description
1
oobjectdataTables settings object
Returns:

Node to add to the DOM

<static> _fnScrollingWidthAdjust(oSettings, n)

Adjust a table's width to take account of scrolling

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
nnodetable node
<static> _fnServerParams(oSettings, array)

Add Ajax parameters from plugins

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
array{objects} aoData name/value pairs to send to the server
<static> _fnSetCellData(oSettings, iRow, iCol, val)

Set the value for a specific cell, into the internal data cache

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
iRowintaoData row id
3
iColintColumn index
4
val*Value to set
<static> _fnSetObjectDataFn(mSource) → {function}

Return a function that can be used to set data from a source object, taking into account the ability to use nested objects as a source

Parameters:
Name Type Attributes Default Description
1
mSourcestring | int | functionThe data source for the object
Returns:

Data set function

<static> _fnSettingsFromNode(nTable) → {object}

Return the settings object for a particular table

Parameters:
Name Type Attributes Default Description
1
nTablenodetable we are using as a dataTable
Returns:

Settings object - or null if not found

<static> _fnSort(oSettings, bApplyClasses)

Change the order of the table

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
bApplyClassesbooloptional - should we apply classes or not
<static> _fnSortAttachListener(oSettings, nNode, iDataIndex, fnCallback)

Attach a sort handler (click) to a node

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
nNodenodenode to attach the handler to
3
iDataIndexintcolumn sorting index
4
fnCallbackfunctionOptionalcallback function
<static> _fnSortingClasses(oSettings)

Set the sorting classes on the header, Note: it is safe to call this function when bSort and bSortClasses are false

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
<static> _fnStringToCss(aArray1, aArray2) → {int}

Append a CSS unit (only if required) to a string

Parameters:
Name Type Attributes Default Description
1
aArray1arrayfirst array
2
aArray2arraysecond array
Returns:

0 if match, 1 if length is different, 2 if no match

<static> _fnUpdateInfo(oSettings)

Update the information elements in the display

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
<static> _fnVisbleColumns(oS) → {int}

Get the number of visible columns

Parameters:
Name Type Attributes Default Description
1
oSobjectdataTables settings object
Returns:

i the number of visible columns

<static> _fnVisibleToColumnIndex(oSettings, iMatch) → {int}

Covert the index of a visible column to the index in the data array (take account of hidden columns)

Parameters:
Name Type Attributes Default Description
1
oSettingsobjectdataTables settings object
2
iMatchintVisible column index to lookup
Returns:

i the data index