Namespace: oColumn - documentation

# Namespace: oColumn

## Ancestry: DataTable » .models. » oColumn

DataTables v1.9.1 documentation

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> 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
  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). NOTE* It is it is advisable now to use mDataProp as a function and make use of the 'type' that it gives, allowing (potentially) different data to be used for sorting, filtering, display and type detection.
<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 fnRender allowing you to modify the DOM element (add background colour for example) when the element is available (since it is not when fnRender is called).
<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 mDataProp to function as required. This function is automatically assigned by the column initialisation method
<static> fnRender :function
  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 mDataProp to function as required. This function is automatically assigned by the column initialisation method
<static> mDataProp :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> 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 mDataProp 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> 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

  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). NOTE* It is it is advisable now to use mDataProp as a function and make use of the 'type' that it gives, allowing (potentially) different data to be used for sorting, filtering, display and type detection.

  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 fnRender allowing you to modify the DOM element (add background colour for example) when the element is available (since it is not when fnRender is called).

  ##### Parameters:

  | Name | Type | Attributes | Default | Description
  --- | --- | --- | --- | --- | ---
  1 | nTd | element |  |  | The TD node that has been created
  2 | sData | * |  |  | The Data for the cell
  3 | oData | array | object |  |  | The data for the whole row
  4 | iRow | int |  |  | 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 mDataProp to function as required. This function is automatically assigned by the column initialisation method

  ##### Parameters:

  | Name | Type | Attributes | Default | Description
  --- | --- | --- | --- | --- | ---
  1 | oData | array | object |  |  | The data array/object for the array (i.e. aoData[]._aData)
  2 | sSpecific | string |  |  | 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

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

  ##### Parameters:

  | Name | Type | Attributes | Default | Description
  --- | --- | --- | --- | --- | ---
  1 | o | object |  |  | Object with the following parameters:
  | o.iDataRow | int |  |  | The row in aoData
  | o.iDataColumn | int |  |  | The column in question
  4 | {array |  |  |  | o.aData The data for the row in question
  5 | o.oSettings | object |  |  | 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 mDataProp to function as required. This function is automatically assigned by the column initialisation method

  ##### Parameters:

  | Name | Type | Attributes | Default | Description
  --- | --- | --- | --- | --- | ---
  1 | oData | array | object |  |  | The data array/object for the array (i.e. aoData[]._aData)
  2 | sValue | * |  |  | Value to set

<static> mDataProp :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> 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 mDataProp 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"