MCPcopy Create free account
hub / github.com/breck7/scroll / _fnColumnOptions

Function _fnColumnOptions

external/.datatables.js:1909–1995  ·  view source on GitHub ↗

* Apply options for a column * @param {object} oSettings dataTables settings object * @param {int} iCol column index to consider * @param {object} oOptions object with sType, bVisible and bSearchable etc * @memberof DataTable#oApi

(oSettings, iCol, oOptions)

Source from the content-addressed store, hash-verified

1907 * @memberof DataTable#oApi
1908 */
1909 function _fnColumnOptions(oSettings, iCol, oOptions) {
1910 var oCol = oSettings.aoColumns[iCol]
1911
1912 /* User specified column options */
1913 if (oOptions !== undefined && oOptions !== null) {
1914 // Backwards compatibility
1915 _fnCompatCols(oOptions)
1916
1917 // Map camel case parameters to their Hungarian counterparts
1918 _fnCamelToHungarian(DataTable.defaults.column, oOptions, true)
1919
1920 /* Backwards compatibility for mDataProp */
1921 if (oOptions.mDataProp !== undefined && !oOptions.mData) {
1922 oOptions.mData = oOptions.mDataProp
1923 }
1924
1925 if (oOptions.sType) {
1926 oCol._sManualType = oOptions.sType
1927 }
1928
1929 // `class` is a reserved word in Javascript, so we need to provide
1930 // the ability to use a valid name for the camel case input
1931 if (oOptions.className && !oOptions.sClass) {
1932 oOptions.sClass = oOptions.className
1933 }
1934
1935 var origClass = oCol.sClass
1936
1937 $.extend(oCol, oOptions)
1938 _fnMap(oCol, oOptions, "sWidth", "sWidthOrig")
1939
1940 // Merge class from previously defined classes with this one, rather than just
1941 // overwriting it in the extend above
1942 if (origClass !== oCol.sClass) {
1943 oCol.sClass = origClass + " " + oCol.sClass
1944 }
1945
1946 /* iDataSort to be applied (backwards compatibility), but aDataSort will take
1947 * priority if defined
1948 */
1949 if (oOptions.iDataSort !== undefined) {
1950 oCol.aDataSort = [oOptions.iDataSort]
1951 }
1952 _fnMap(oCol, oOptions, "aDataSort")
1953 }
1954
1955 /* Cache the data get and set functions for speed */
1956 var mDataSrc = oCol.mData
1957 var mData = _fnGetObjectDataFn(mDataSrc)
1958
1959 // The `render` option can be given as an array to access the helper rendering methods.
1960 // The first element is the rendering method to use, the rest are the parameters to pass
1961 if (oCol.mRender && Array.isArray(oCol.mRender)) {
1962 var copy = oCol.mRender.slice()
1963 var name = copy.shift()
1964
1965 oCol.mRender = DataTable.render[name].apply(window, copy)
1966 }

Callers 2

DataTableFunction · 0.85
_fnDetectHeaderFunction · 0.85

Calls 8

_fnCompatColsFunction · 0.85
_fnCamelToHungarianFunction · 0.85
_fnMapFunction · 0.85
attrTestFunction · 0.85
extendMethod · 0.80
sliceMethod · 0.80
shiftMethod · 0.80
_renderMethod · 0.45

Tested by

no test coverage detected