Namespace: oColumn

Ancestry: DataTable » .models. » oColumn

DataTables v1.9.4 documentation

Navigation

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

Template object for the column information object in DataTables. This object is held in the settings aoColumns array and contains all the information that DataTables needs about each individual column.

Note that this object is related to DataTable.defaults.columns but this one is the internal data store for DataTables's cache of columns. It should NOT be manipulated outside of DataTables. Any configuration should be done through the initialisation options.

Summary

Properties - static

<static> aDataSort :array

A list of the columns that sorting should occur on when this column is sorted. That this property is an array allows multi-column sorting to be defined for a column (for example first name / last name columns would benefit from this). The values are integers pointing to the columns to be sorted on (typically it will be a single integer pointing at itself, but that doesn't need to be the case).

<static> asSorting :array

Define the sorting directions that are applied to the column, in sequence as the column is repeatedly sorted upon - i.e. the first value is used as the sorting direction when the column if first sorted (clicked on). Sort it again (click again) and it will move on to the next index. Repeat until loop.

<static> bSearchable :boolean

Flag to indicate if the column is searchable, and thus should be included in the filtering or not.

<static> bSortable :boolean

Flag to indicate if the column is sortable or not.

<static> bUseRendered :boolean

Deprecated When using fnRender, you have two options for what to do with the data, and this property serves as the switch. Firstly, you can have the sorting and filtering use the rendered value (true - default), or you can have the sorting and filtering us the original value (false). [...]

<static> bVisible :boolean

Flag to indicate if the column is currently visible in the table or not

<static> fnCreatedCell :function

Developer definable function that is called whenever a cell is created (Ajax source, etc) or processed for input (DOM source). This can be used as a compliment to mRender allowing you to modify the DOM element (add background colour for example) when the element is available.

<static> fnGetData :function

Function to get data from a cell in a column. You should never access data directly through _aData internally in DataTables - always use the method attached to this property. It allows mData to function as required. This function is automatically assigned by the column initialisation method

<static> fnRender :function

Deprecated Custom display function that will be called for the display of each cell in this column. [...]

<static> fnSetData :function

Function to set data for a cell in the column. You should never set the data directly to _aData internally in DataTables - always use this method. It allows mData to function as required. This function is automatically assigned by the column initialisation method

<static> mData :function|int|string|null

Property to read the value for the cells in the column from the data source array / object. If null, then the default content is used, if a function is given then the return from the function is used.

<static> mRender :function|int|string|null

Partner property to mData which is used (only when defined) to get the data - i.e. it is basically the same as mData, but without the 'set' option, and also the data fed to it is the result from mData. This is the rendering method to match the data method of mData.

<static> nTf :node

Unique footer TH/TD element for this column (if there is one). Not used in DataTables as such, but can be used for plug-ins to reference the footer for each column.

<static> nTh :node

Unique header TH/TD element for this column - this is what the sorting listener is attached to (if sorting is enabled.)

<static> sClass :string

The class to apply to all TD elements in the table's TBODY for the column

<static> sContentPadding :string

When DataTables calculates the column widths to assign to each column, it finds the longest string in each column and then constructs a temporary table and reads the widths from that. The problem with this is that "mmm" is much wider then "iiii", but the latter is a longer string - thus the calculation can go wrong (doing it properly and putting it into an DOM object and measuring that is horribly(!) slow). Thus as a "work around" we provide this option. It will append its value to the text that is found to be the longest string for the column - i.e. padding.

<static> sDefaultContent :string

Allows a default value to be given for a column's data, and will be used whenever a null data source is encountered (this can be because mData is set to null, or because the data source itself is null).

<static> sName :string

Name for the column, allowing reference to the column by name as well as by index (needs a lookup to work by name).

<static> sSortDataType :string

Custom sorting data type - defines which of the available plug-ins in afnSortData the custom sorting will use - if any is defined.

<static> sSortingClass :string

Class to be applied to the header element when sorting on this column

<static> sSortingClassJUI :string

Class to be applied to the header element when sorting on this column - when jQuery UI theming is used.

<static> sTitle :string

Title of the column - what is seen in the TH element (nTh).

<static> sType :string

Column sorting and filtering type

<static> sWidth :string

Width of the column

<static> sWidthOrig :string

Width of the column when it was first "encountered"

Details

Properties - static

<static> aDataSort :array

A list of the columns that sorting should occur on when this column is sorted. That this property is an array allows multi-column sorting to be defined for a column (for example first name / last name columns would benefit from this). The values are integers pointing to the columns to be sorted on (typically it will be a single integer pointing at itself, but that doesn't need to be the case).

<static> asSorting :array

Define the sorting directions that are applied to the column, in sequence as the column is repeatedly sorted upon - i.e. the first value is used as the sorting direction when the column if first sorted (clicked on). Sort it again (click again) and it will move on to the next index. Repeat until loop.

<static> bSearchable :boolean

Flag to indicate if the column is searchable, and thus should be included in the filtering or not.

<static> bSortable :boolean

Flag to indicate if the column is sortable or not.

<static> bUseRendered :boolean

Deprecated When using fnRender, you have two options for what to do with the data, and this property serves as the switch. Firstly, you can have the sorting and filtering use the rendered value (true - default), or you can have the sorting and filtering us the original value (false).

Please note that this option has now been deprecated and will be removed in the next version of DataTables. Please use mRender / mData rather than fnRender.

Deprecated
Yes
<static> bVisible :boolean

Flag to indicate if the column is currently visible in the table or not

<static> fnCreatedCell :function

Developer definable function that is called whenever a cell is created (Ajax source, etc) or processed for input (DOM source). This can be used as a compliment to mRender allowing you to modify the DOM element (add background colour for example) when the element is available.

Parameters:
Name Type Attributes Default Description
1
nTdelement

The TD node that has been created

2
sData*

The Data for the cell

3
oDataarray | object

The data for the whole row

4
iRowint

The row index for the aoData data store

<static> fnGetData :function

Function to get data from a cell in a column. You should never access data directly through _aData internally in DataTables - always use the method attached to this property. It allows mData to function as required. This function is automatically assigned by the column initialisation method

Parameters:
Name Type Attributes Default Description
1
oDataarray | object

The data array/object for the array (i.e. aoData[]._aData)

2
sSpecificstring

The specific data type you want to get - 'display', 'type' 'filter' 'sort'

Returns:

The data for the cell from the given row's data

<static> fnRender :function

Deprecated Custom display function that will be called for the display of each cell in this column.

Please note that this option has now been deprecated and will be removed in the next version of DataTables. Please use mRender / mData rather than fnRender.

Deprecated
Yes
Parameters:
Name Type Attributes Default Description
1
oobject

Object with the following parameters:

o.iDataRowint

The row in aoData

o.iDataColumnint

The column in question

o.aDataarray

The data for the row in question

o.oSettingsobject

The settings object for this DataTables instance

Returns:

The string you which to use in the display

<static> fnSetData :function

Function to set data for a cell in the column. You should never set the data directly to _aData internally in DataTables - always use this method. It allows mData to function as required. This function is automatically assigned by the column initialisation method

Parameters:
Name Type Attributes Default Description
1
oDataarray | object

The data array/object for the array (i.e. aoData[]._aData)

2
sValue*

Value to set

<static> mData :function|int|string|null

Property to read the value for the cells in the column from the data source array / object. If null, then the default content is used, if a function is given then the return from the function is used.

<static> mRender :function|int|string|null

Partner property to mData which is used (only when defined) to get the data - i.e. it is basically the same as mData, but without the 'set' option, and also the data fed to it is the result from mData. This is the rendering method to match the data method of mData.

<static> nTf :node

Unique footer TH/TD element for this column (if there is one). Not used in DataTables as such, but can be used for plug-ins to reference the footer for each column.

<static> nTh :node

Unique header TH/TD element for this column - this is what the sorting listener is attached to (if sorting is enabled.)

<static> sClass :string

The class to apply to all TD elements in the table's TBODY for the column

<static> sContentPadding :string

When DataTables calculates the column widths to assign to each column, it finds the longest string in each column and then constructs a temporary table and reads the widths from that. The problem with this is that "mmm" is much wider then "iiii", but the latter is a longer string - thus the calculation can go wrong (doing it properly and putting it into an DOM object and measuring that is horribly(!) slow). Thus as a "work around" we provide this option. It will append its value to the text that is found to be the longest string for the column - i.e. padding.

<static> sDefaultContent :string

Allows a default value to be given for a column's data, and will be used whenever a null data source is encountered (this can be because mData is set to null, or because the data source itself is null).

<static> sName :string

Name for the column, allowing reference to the column by name as well as by index (needs a lookup to work by name).

<static> sSortDataType :string

Custom sorting data type - defines which of the available plug-ins in afnSortData the custom sorting will use - if any is defined.

<static> sSortingClass :string

Class to be applied to the header element when sorting on this column

<static> sSortingClassJUI :string

Class to be applied to the header element when sorting on this column - when jQuery UI theming is used.

<static> sTitle :string

Title of the column - what is seen in the TH element (nTh).

<static> sType :string

Column sorting and filtering type

<static> sWidth :string

Width of the column

<static> sWidthOrig :string

Width of the column when it was first "encountered"