annotate DataTables-1.9.4/docs/DataTable.defaults.columns.html @ 6:42076db43d42 draft

Fixed auto resizing plus various other minor bugs
author saskia-hiltemann
date Mon, 16 Nov 2015 08:56:22 -0500
parents ac5f9272033b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
2 <html>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
3 <head>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
4 <meta http-equiv="Content-type" content="text/html; charset=utf-8">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
5 <title>Namespace: columns - documentation</title>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
6
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
7 <style type="text/css" media="screen">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
8 @import "media/css/doc.css";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
9 @import "media/css/shCore.css";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
10 @import "media/css/shThemeDataTables.css";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
11 </style>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
12
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
13 <script type="text/javascript" src="media/js/shCore.js"></script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
14 <script type="text/javascript" src="media/js/shBrushJScript.js"></script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
15 <script type="text/javascript" src="media/js/jquery.js"></script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
16 <script type="text/javascript" src="media/js/doc.js"></script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
17 </head>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
18 <body>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
19 <div class="fw_container">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
20
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
21 <a name="top"></a>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
22 <div class="fw_header">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
23 <h1 class="page-title">Namespace: columns</h1>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
24 <h2 class="ancestors">Ancestry: <span class="ancestors"><a href="DataTable.html">DataTable</a> » <a href="DataTable.defaults.html">.defaults</a>.</span> » columns</h2>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
25 <div class="page-info">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
26 DataTables v1.9.4 documentation
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
27 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
28 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
29
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
30
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
31
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
32 <div class="fw_nav">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
33 <h2>Navigation</h2>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
34 <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
35 <li><a href="#top">Overview</a></li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
36 <li><a href="#summary">Summary</a><div><table cellpadding="5" border="0" cellspacing="0" width="100%"><tbody><tr><td>Classes (0)</td><td>Namespaces (0)</td></tr><tr><td>Properties (0)</td><td><a href="#summary_properties_static">Static properties (21)</a></td></tr><tr><td>Methods (0)</td><td>Static methods (0)</td></tr><tr><td>Events (0)</td><td></td></tr></tbody></table></div></li><li><a href="#details">Details</a><div><table cellpadding="5" border="0" cellspacing="0" width="100%"><tbody><tr><td>Properties (0)</td><td><a href="#summary_properties_static">Static properties (21)</a></td></tr><tr><td>Methods (0)</td><td>Static methods (0)</td></tr><tr><td>Events (0)</td><td></td></tr></tbody></table></div></li></ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
37 <div style="margin-top: 10px;">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
38 <input type="hidden" name="show_private" value="0">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
39 <span id="private_label">Hiding</span> private elements
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
40 (<a id="private_toggle" href="">toggle</a>)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
41 </span>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
42 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
43 <div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
44 <input type="hidden" name="show_extended" value="1">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
45 <span id="extended_label">Showing</span> extended elements
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
46 (<a id="extended_toggle" href="">toggle</a>)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
47 </span>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
48 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
49 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
50
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
51 <div class="fw_content">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
52 <a name="overview"></a>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
53 <div class="doc_overview">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
54 <div class="nav_blocker"></div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
55 <p>Column options that can be given to DataTables at initialisation time.</p><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
56
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
57 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
58
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
59 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
60
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
61
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
62 <div class="doc_summary">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
63 <a name="summary"></a>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
64 <h2>Summary</h2>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
65
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
66 <div class="doc_group"><a name="summary_properties_static"></a><h3 class="subsection-title">Properties - static</h3>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
67
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
68 <dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
69 <dt class=" even"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#aDataSort">aDataSort</a></span><span class="type-sig"><span class="type-signature"> :array</span></span></dt><dd class=" even"><p>Allows a column's sorting to take multiple columns into account when
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
70 doing a sort. For example first name / last name columns make sense to
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
71 do a multi-column sort over the two columns.</p></dd><dt class=" odd"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#asSorting">asSorting</a></span><span class="type-sig"><span class="type-signature"> :array</span></span></dt><dd class=" odd"><p>You can control the default sorting direction, and even alter the behaviour
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
72 of the sort handler (i.e. only allow ascending sorting etc) using this
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
73 parameter.</p></dd><dt class=" even"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#bSearchable">bSearchable</a></span><span class="type-sig"><span class="type-signature"> :boolean</span></span></dt><dd class=" even"><p>Enable or disable filtering on the data in this column.</p></dd><dt class=" odd"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#bSortable">bSortable</a></span><span class="type-sig"><span class="type-signature"> :boolean</span></span></dt><dd class=" odd"><p>Enable or disable sorting on this column.</p></dd><dt class=" even"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#bUseRendered">bUseRendered</a></span><span class="type-sig"><span class="type-signature"> :boolean</span></span></dt><dd class=" even"><p><code>Deprecated</code> When using fnRender() for a column, you may wish
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
74 to use the original data (before rendering) for sorting and filtering
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
75 (the default is to used the rendered data that the user can see). This
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
76 may be useful for dates etc. [<a href-"#bUseRendered">...</a>] </p></dd><dt class=" odd"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#bVisible">bVisible</a></span><span class="type-sig"><span class="type-signature"> :boolean</span></span></dt><dd class=" odd"><p>Enable or disable the display of this column.</p></dd><dt class=" even"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#fnCreatedCell">fnCreatedCell</a></span><span class="type-sig"><span class="type-signature"> :function</span></span></dt><dd class=" even"><p>Developer definable function that is called whenever a cell is created (Ajax source,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
77 etc) or processed for input (DOM source). This can be used as a compliment to mRender
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
78 allowing you to modify the DOM element (add background colour for example) when the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
79 element is available.</p></dd><dt class=" odd"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#fnRender">fnRender</a></span><span class="type-sig"><span class="type-signature"> :function</span></span></dt><dd class=" odd"><p><code>Deprecated</code> Custom display function that will be called for the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
80 display of each cell in this column. [<a href-"#fnRender">...</a>] </p></dd><dt class=" even"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#iDataSort">iDataSort</a></span><span class="type-sig"><span class="type-signature"> :int</span></span></dt><dd class=" even"><p>The column index (starting from 0!) that you wish a sort to be performed
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
81 upon when this column is selected for sorting. This can be used for sorting
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
82 on hidden columns for example.</p></dd><dt class=" odd"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#mData">mData</a></span><span class="type-sig"><span class="type-signature"> :string|int|function|null</span></span></dt><dd class=" odd"><p>This property can be used to read data from any JSON data source property,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
83 including deeply nested objects / properties. mData can be given in a
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
84 number of different ways which effect its behaviour:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
85 <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
86 <li>integer - treated as an array index for the data source. This is the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
87 default that DataTables uses (incrementally increased for each column).</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
88 <li>string - read an object property from the data source. Note that you can
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
89 use Javascript dotted notation to read deep properties / arrays from the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
90 data source.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
91 <li>null - the sDefaultContent option will be used for the cell (null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
92 by default, so you will need to specify the default content you want -
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
93 typically an empty string). This can be useful on generated columns such
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
94 as edit / delete action columns.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
95 <li>function - the function given will be executed whenever DataTables
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
96 needs to set or get the data for a cell in the column. The function
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
97 takes three parameters:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
98 <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
99 <li>{array|object} The data source for the row</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
100 <li>{string} The type call data requested - this will be 'set' when
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
101 setting data or 'filter', 'display', 'type', 'sort' or undefined when
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
102 gathering data. Note that when <i>undefined</i> is given for the type
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
103 DataTables expects to get the raw data for the object back</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
104 <li>{*} Data to set when the second parameter is 'set'.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
105 </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
106 The return value from the function is not required when 'set' is the type
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
107 of call, but otherwise the return is what will be used for the data
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
108 requested.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
109 </ul> [<a href-"#mData">...</a>] </p></dd><dt class=" even"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#mDataProp">mDataProp</a></span><span class="type-sig"><span class="type-signature"></span></span></dt><dd class=" even"><p>This parameter has been replaced by mData in DataTables to ensure naming
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
110 consistency. mDataProp can still be used, as there is backwards compatibility
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
111 in DataTables for this option, but it is strongly recommended that you use
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
112 mData in preference to mDataProp.</p></dd><dt class=" odd"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#mRender">mRender</a></span><span class="type-sig"><span class="type-signature"> :string|int|function|null</span></span></dt><dd class=" odd"><p>This property is the rendering partner to mData and it is suggested that
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
113 when you want to manipulate data for display (including filtering, sorting etc)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
114 but not altering the underlying data for the table, use this property. mData
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
115 can actually do everything this property can and more, but this parameter is
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
116 easier to use since there is no 'set' option. Like mData is can be given
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
117 in a number of different ways to effect its behaviour, with the addition of
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
118 supporting array syntax for easy outputting of arrays (including arrays of
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
119 objects):
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
120 <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
121 <li>integer - treated as an array index for the data source. This is the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
122 default that DataTables uses (incrementally increased for each column).</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
123 <li>string - read an object property from the data source. Note that you can
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
124 use Javascript dotted notation to read deep properties / arrays from the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
125 data source and also array brackets to indicate that the data reader should
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
126 loop over the data source array. When characters are given between the array
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
127 brackets, these characters are used to join the data source array together.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
128 For example: "accounts[, ].name" would result in a comma separated list with
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
129 the 'name' value from the 'accounts' array of objects.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
130 <li>function - the function given will be executed whenever DataTables
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
131 needs to set or get the data for a cell in the column. The function
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
132 takes three parameters:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
133 <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
134 <li>{array|object} The data source for the row (based on mData)</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
135 <li>{string} The type call data requested - this will be 'filter', 'display',
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
136 'type' or 'sort'.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
137 <li>{array|object} The full data source for the row (not based on mData)</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
138 </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
139 The return value from the function is what will be used for the data
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
140 requested.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
141 </ul></p></dd><dt class=" even"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#sCellType">sCellType</a></span><span class="type-sig"><span class="type-signature"> :string</span></span></dt><dd class=" even"><p>Change the cell type created for the column - either TD cells or TH cells. This
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
142 can be useful as TH cells have semantic meaning in the table body, allowing them
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
143 to act as a header for a row (you may wish to add scope='row' to the TH elements).</p></dd><dt class=" odd"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#sClass">sClass</a></span><span class="type-sig"><span class="type-signature"> :string</span></span></dt><dd class=" odd"><p>Class to give to each cell in this column.</p></dd><dt class=" even"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#sContentPadding">sContentPadding</a></span><span class="type-sig"><span class="type-signature"> :string</span></span></dt><dd class=" even"><p>When DataTables calculates the column widths to assign to each column,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
144 it finds the longest string in each column and then constructs a
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
145 temporary table and reads the widths from that. The problem with this
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
146 is that "mmm" is much wider then "iiii", but the latter is a longer
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
147 string - thus the calculation can go wrong (doing it properly and putting
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
148 it into an DOM object and measuring that is horribly(!) slow). Thus as
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
149 a "work around" we provide this option. It will append its value to the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
150 text that is found to be the longest string for the column - i.e. padding.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
151 Generally you shouldn't need this, and it is not documented on the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
152 general DataTables.net documentation</p></dd><dt class=" odd"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#sDefaultContent">sDefaultContent</a></span><span class="type-sig"><span class="type-signature"> :string</span></span></dt><dd class=" odd"><p>Allows a default value to be given for a column's data, and will be used
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
153 whenever a null data source is encountered (this can be because mData
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
154 is set to null, or because the data source itself is null).</p></dd><dt class=" even"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#sName">sName</a></span><span class="type-sig"><span class="type-signature"> :string</span></span></dt><dd class=" even"><p>This parameter is only used in DataTables' server-side processing. It can
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
155 be exceptionally useful to know what columns are being displayed on the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
156 client side, and to map these to database fields. When defined, the names
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
157 also allow DataTables to reorder information from the server if it comes
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
158 back in an unexpected order (i.e. if you switch your columns around on the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
159 client-side, your server-side code does not also need updating).</p></dd><dt class=" odd"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#sSortDataType">sSortDataType</a></span><span class="type-sig"><span class="type-signature"> :string</span></span></dt><dd class=" odd"><p>Defines a data source type for the sorting which can be used to read
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
160 real-time information from the table (updating the internally cached
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
161 version) prior to sorting. This allows sorting to occur on user editable
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
162 elements such as form inputs.</p></dd><dt class=" even"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#sTitle">sTitle</a></span><span class="type-sig"><span class="type-signature"> :string</span></span></dt><dd class=" even"><p>The title of this column.</p></dd><dt class=" odd"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#sType">sType</a></span><span class="type-sig"><span class="type-signature"> :string</span></span></dt><dd class=" odd"><p>The type allows you to specify how the data for this column will be sorted.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
163 Four types (string, numeric, date and html (which will strip HTML tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
164 before sorting)) are currently available. Note that only date formats
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
165 understood by Javascript's Date() object will be accepted as type date. For
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
166 example: "Mar 26, 2008 5:03 PM". May take the values: 'string', 'numeric',
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
167 'date' or 'html' (by default). Further types can be adding through
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
168 plug-ins.</p></dd><dt class=" even"><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#sWidth">sWidth</a></span><span class="type-sig"><span class="type-signature"> :string</span></span></dt><dd class=" even"><p>Defining the width of the column, this parameter may take any CSS value
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
169 (3em, 20px etc). DataTables apples 'smart' widths to columns which have not
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
170 been given a specific width through this interface ensuring that the table
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
171 remains readable.</p></dd>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
172 </dl></div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
173 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
174
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
175
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
176
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
177
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
178 <div class="doc_details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
179 <a name="details"></a>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
180 <h2>Details</h2>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
181 <div class="doc_group"><a name="details_properties"></a><h3 class="subsection-title">Properties - static</h3>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
182 <dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
183 <dt class=" even"><a name="aDataSort"></a><a name="aDataSort_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#aDataSort">aDataSort</a></span><span class="type-sig"><span class="type-signature"> :array</span></span></dt><dd class=" even"><p>Allows a column's sorting to take multiple columns into account when
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
184 doing a sort. For example first name / last name columns make sense to
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
185 do a multi-column sort over the two columns.</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
186
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
187 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
188 <h5>Examples</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
189 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
190 <pre class="brush: js"> // Using aoColumnDefs
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
191 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
192 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
193 "aoColumnDefs": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
194 { "aDataSort": [ 0, 1 ], "aTargets": [ 0 ] },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
195 { "aDataSort": [ 1, 0 ], "aTargets": [ 1 ] },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
196 { "aDataSort": [ 2, 3, 4 ], "aTargets": [ 2 ] }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
197 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
198 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
199 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
200
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
201 </pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
202 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
203
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
204 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
205 <pre class="brush: js"> // Using aoColumns
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
206 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
207 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
208 "aoColumns": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
209 { "aDataSort": [ 0, 1 ] },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
210 { "aDataSort": [ 1, 0 ] },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
211 { "aDataSort": [ 2, 3, 4 ] },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
212 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
213 null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
214 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
215 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
216 } );</pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
217 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
218 </div></dd><dt class=" odd"><a name="asSorting"></a><a name="asSorting_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#asSorting">asSorting</a></span><span class="type-sig"><span class="type-signature"> :array</span></span></dt><dd class=" odd"><p>You can control the default sorting direction, and even alter the behaviour
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
219 of the sort handler (i.e. only allow ascending sorting etc) using this
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
220 parameter.</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
221
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
222 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
223 <h5>Examples</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
224 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
225 <pre class="brush: js"> // Using aoColumnDefs
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
226 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
227 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
228 "aoColumnDefs": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
229 { "asSorting": [ "asc" ], "aTargets": [ 1 ] },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
230 { "asSorting": [ "desc", "asc", "asc" ], "aTargets": [ 2 ] },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
231 { "asSorting": [ "desc" ], "aTargets": [ 3 ] }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
232 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
233 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
234 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
235
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
236 </pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
237 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
238
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
239 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
240 <pre class="brush: js"> // Using aoColumns
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
241 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
242 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
243 "aoColumns": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
244 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
245 { "asSorting": [ "asc" ] },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
246 { "asSorting": [ "desc", "asc", "asc" ] },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
247 { "asSorting": [ "desc" ] },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
248 null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
249 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
250 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
251 } );</pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
252 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
253 </div></dd><dt class=" even"><a name="bSearchable"></a><a name="bSearchable_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#bSearchable">bSearchable</a></span><span class="type-sig"><span class="type-signature"> :boolean</span></span></dt><dd class=" even"><p>Enable or disable filtering on the data in this column.</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
254
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
255 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
256 <h5>Examples</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
257 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
258 <pre class="brush: js"> // Using aoColumnDefs
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
259 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
260 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
261 "aoColumnDefs": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
262 { "bSearchable": false, "aTargets": [ 0 ] }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
263 ] } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
264 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
265
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
266 </pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
267 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
268
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
269 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
270 <pre class="brush: js"> // Using aoColumns
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
271 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
272 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
273 "aoColumns": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
274 { "bSearchable": false },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
275 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
276 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
277 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
278 null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
279 ] } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
280 } );</pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
281 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
282 </div></dd><dt class=" odd"><a name="bSortable"></a><a name="bSortable_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#bSortable">bSortable</a></span><span class="type-sig"><span class="type-signature"> :boolean</span></span></dt><dd class=" odd"><p>Enable or disable sorting on this column.</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
283
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
284 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
285 <h5>Examples</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
286 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
287 <pre class="brush: js"> // Using aoColumnDefs
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
288 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
289 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
290 "aoColumnDefs": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
291 { "bSortable": false, "aTargets": [ 0 ] }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
292 ] } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
293 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
294
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
295 </pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
296 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
297
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
298 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
299 <pre class="brush: js"> // Using aoColumns
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
300 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
301 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
302 "aoColumns": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
303 { "bSortable": false },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
304 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
305 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
306 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
307 null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
308 ] } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
309 } );</pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
310 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
311 </div></dd><dt class=" even"><a name="bUseRendered"></a><a name="bUseRendered_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#bUseRendered">bUseRendered</a></span><span class="type-sig"><span class="type-signature"> :boolean</span></span></dt><dd class=" even"><p><code>Deprecated</code> When using fnRender() for a column, you may wish
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
312 to use the original data (before rendering) for sorting and filtering
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
313 (the default is to used the rendered data that the user can see). This
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
314 may be useful for dates etc.</p>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
315
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
316 <p>Please note that this option has now been deprecated and will be removed
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
317 in the next version of DataTables. Please use mRender / mData rather than
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
318 fnRender.</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
319 <dt class="important">Deprecated</dt><dd class="yes-def">Yes</dd>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
320 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
321 </div></dd><dt class=" odd"><a name="bVisible"></a><a name="bVisible_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#bVisible">bVisible</a></span><span class="type-sig"><span class="type-signature"> :boolean</span></span></dt><dd class=" odd"><p>Enable or disable the display of this column.</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
322
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
323 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
324 <h5>Examples</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
325 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
326 <pre class="brush: js"> // Using aoColumnDefs
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
327 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
328 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
329 "aoColumnDefs": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
330 { "bVisible": false, "aTargets": [ 0 ] }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
331 ] } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
332 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
333
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
334 </pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
335 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
336
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
337 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
338 <pre class="brush: js"> // Using aoColumns
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
339 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
340 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
341 "aoColumns": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
342 { "bVisible": false },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
343 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
344 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
345 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
346 null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
347 ] } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
348 } );</pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
349 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
350 </div></dd><dt id="DataTable.defaults.columns.fnCreatedCell" class=" even"><a name="fnCreatedCell"></a><a name="fnCreatedCell_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a>fnCreatedCell</a></span><span class="type-sig"><span class="type-signature"> :function</span></span></span></dt><dd class=" even"><p>Developer definable function that is called whenever a cell is created (Ajax source,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
351 etc) or processed for input (DOM source). This can be used as a compliment to mRender
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
352 allowing you to modify the DOM element (add background colour for example) when the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
353 element is available.</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
354
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
355 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
356 <h5>Parameters:</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
357
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
358 <table class="params">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
359 <thead>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
360 <tr>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
361 <th width="20"></th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
362 <th width="12%" class="bottom_border name">Name</th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
363 <th width="10%" class="bottom_border">Type</th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
364 <th width="10%" class="bottom_border">Attributes</th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
365 <th width="10%" class="bottom_border">Default</th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
366 <th class="last bottom_border">Description</th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
367 </tr>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
368 </thead>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
369
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
370 <tbody>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
371 <tr class="even"><td class="number right_border"><div>1</div></td><td class="name">nTd</td><td class="type type-param">element</td><td class="attributes"></td><td class="default"></td><td class="description last"><p>The TD node that has been created</p></td></tr><tr class="odd"><td class="number right_border"><div>2</div></td><td class="name">sData</td><td class="type type-param">*</td><td class="attributes"></td><td class="default"></td><td class="description last"><p>The Data for the cell</p></td></tr><tr class="even"><td class="number right_border"><div>3</div></td><td class="name">oData</td><td class="type type-param">array | object</td><td class="attributes"></td><td class="default"></td><td class="description last"><p>The data for the whole row</p></td></tr><tr class="odd"><td class="number right_border"><div>4</div></td><td class="name">iRow</td><td class="type type-param">int</td><td class="attributes"></td><td class="default"></td><td class="description last"><p>The row index for the aoData data store</p></td></tr><tr class="even"><td class="number right_border"><div>5</div></td><td class="name">iCol</td><td class="type type-param">int</td><td class="attributes"></td><td class="default"></td><td class="description last"><p>The column index for aoColumns</p></td></tr>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
372 </tbody>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
373 </table><h5>Example:</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
374 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
375 <pre class="brush: js"> $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
376 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
377 "aoColumnDefs": [ {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
378 "aTargets": [3],
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
379 "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
380 if ( sData == "1.7" ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
381 $(nTd).css('color', 'blue')
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
382 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
383 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
384 } ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
385 });
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
386 } );</pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
387 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
388 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
389 <dt id="DataTable.defaults.columns.fnRender" class=" odd"><a name="fnRender"></a><a name="fnRender_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a>fnRender</a></span><span class="type-sig"><span class="type-signature"> :function</span></span></span></dt><dd class=" odd"><p><code>Deprecated</code> Custom display function that will be called for the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
390 display of each cell in this column.</p>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
391
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
392 <p>Please note that this option has now been deprecated and will be removed
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
393 in the next version of DataTables. Please use mRender / mData rather than
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
394 fnRender.</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
395 <dt class="important">Deprecated</dt><dd class="yes-def">Yes</dd>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
396 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
397 <h5>Parameters:</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
398
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
399 <table class="params">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
400 <thead>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
401 <tr>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
402 <th width="20"></th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
403 <th width="12%" class="bottom_border name">Name</th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
404 <th width="10%" class="bottom_border">Type</th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
405 <th width="10%" class="bottom_border">Attributes</th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
406 <th width="10%" class="bottom_border">Default</th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
407 <th class="last bottom_border">Description</th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
408 </tr>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
409 </thead>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
410
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
411 <tbody>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
412 <tr class="even"><td class="number right_border"><div>1</div></td><td class="name">o</td><td class="type type-param">object</td><td class="attributes"></td><td class="default"></td><td class="description last"><p>Object with the following parameters:</p></td></tr><tr><td class="number right_border"></td><td class="name">o.iDataRow</td><td class="type type-param">int</td><td class="attributes"></td><td class="default"></td><td class="description last"><p>The row in aoData</p></td></tr><tr><td class="number right_border"></td><td class="name">o.iDataColumn</td><td class="type type-param">int</td><td class="attributes"></td><td class="default"></td><td class="description last"><p>The column in question</p></td></tr><tr><td class="number right_border"></td><td class="name">o.aData</td><td class="type type-param">array</td><td class="attributes"></td><td class="default"></td><td class="description last"><p>The data for the row in question</p></td></tr><tr><td class="number right_border"></td><td class="name">o.oSettings</td><td class="type type-param">object</td><td class="attributes"></td><td class="default"></td><td class="description last"><p>The settings object for this DataTables instance</p></td></tr><tr><td class="number right_border"></td><td class="name">o.mDataProp</td><td class="type type-param">object</td><td class="attributes"></td><td class="default"></td><td class="description last"><p>The data property used for this column</p></td></tr><tr class="even"><td class="number right_border"><div>7</div></td><td class="name">val</td><td class="type type-param">*</td><td class="attributes"></td><td class="default"></td><td class="description last"><p>The current cell value</p></td></tr>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
413 </tbody>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
414 </table><h5>Returns:</h5><p class="returns"><p>The string you which to use in the display</p></p></div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
415 <dt class=" even"><a name="iDataSort"></a><a name="iDataSort_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#iDataSort">iDataSort</a></span><span class="type-sig"><span class="type-signature"> :int</span></span></dt><dd class=" even"><p>The column index (starting from 0!) that you wish a sort to be performed
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
416 upon when this column is selected for sorting. This can be used for sorting
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
417 on hidden columns for example.</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
418
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
419 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
420 <h5>Examples</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
421 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
422 <pre class="brush: js"> // Using aoColumnDefs
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
423 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
424 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
425 "aoColumnDefs": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
426 { "iDataSort": 1, "aTargets": [ 0 ] }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
427 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
428 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
429 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
430
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
431 </pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
432 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
433
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
434 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
435 <pre class="brush: js"> // Using aoColumns
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
436 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
437 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
438 "aoColumns": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
439 { "iDataSort": 1 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
440 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
441 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
442 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
443 null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
444 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
445 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
446 } );</pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
447 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
448 </div></dd><dt class=" odd"><a name="mData"></a><a name="mData_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#mData">mData</a></span><span class="type-sig"><span class="type-signature"> :string|int|function|null</span></span></dt><dd class=" odd"><p>This property can be used to read data from any JSON data source property,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
449 including deeply nested objects / properties. mData can be given in a
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
450 number of different ways which effect its behaviour:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
451 <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
452 <li>integer - treated as an array index for the data source. This is the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
453 default that DataTables uses (incrementally increased for each column).</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
454 <li>string - read an object property from the data source. Note that you can
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
455 use Javascript dotted notation to read deep properties / arrays from the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
456 data source.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
457 <li>null - the sDefaultContent option will be used for the cell (null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
458 by default, so you will need to specify the default content you want -
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
459 typically an empty string). This can be useful on generated columns such
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
460 as edit / delete action columns.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
461 <li>function - the function given will be executed whenever DataTables
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
462 needs to set or get the data for a cell in the column. The function
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
463 takes three parameters:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
464 <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
465 <li>{array|object} The data source for the row</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
466 <li>{string} The type call data requested - this will be 'set' when
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
467 setting data or 'filter', 'display', 'type', 'sort' or undefined when
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
468 gathering data. Note that when <i>undefined</i> is given for the type
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
469 DataTables expects to get the raw data for the object back</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
470 <li>{*} Data to set when the second parameter is 'set'.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
471 </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
472 The return value from the function is not required when 'set' is the type
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
473 of call, but otherwise the return is what will be used for the data
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
474 requested.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
475 </ul></p>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
476
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
477 <p>Note that prior to DataTables 1.9.2 mData was called mDataProp. The name change
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
478 reflects the flexibility of this property and is consistent with the naming of
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
479 mRender. If 'mDataProp' is given, then it will still be used by DataTables, as
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
480 it automatically maps the old name to the new if required.</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
481
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
482 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
483 <h5>Examples</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
484 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
485 <pre class="brush: js"> // Read table data from objects
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
486 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
487 var oTable = $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
488 "sAjaxSource": "sources/deep.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
489 "aoColumns": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
490 { "mData": "engine" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
491 { "mData": "browser" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
492 { "mData": "platform.inner" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
493 { "mData": "platform.details.0" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
494 { "mData": "platform.details.1" }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
495 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
496 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
497 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
498
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
499 </pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
500 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
501
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
502 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
503 <pre class="brush: js"> // Using mData as a function to provide different information for
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
504 // sorting, filtering and display. In this case, currency (price)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
505 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
506 var oTable = $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
507 "aoColumnDefs": [ {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
508 "aTargets": [ 0 ],
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
509 "mData": function ( source, type, val ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
510 if (type === 'set') {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
511 source.price = val;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
512 // Store the computed dislay and filter values for efficiency
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
513 source.price_display = val=="" ? "" : "$"+numberFormat(val);
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
514 source.price_filter = val=="" ? "" : "$"+numberFormat(val)+" "+val;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
515 return;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
516 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
517 else if (type === 'display') {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
518 return source.price_display;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
519 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
520 else if (type === 'filter') {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
521 return source.price_filter;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
522 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
523 // 'sort', 'type' and undefined all just use the integer
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
524 return source.price;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
525 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
526 } ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
527 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
528 } );</pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
529 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
530 </div></dd><dt class=" even"><a name="mDataProp"></a><a name="mDataProp_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#mDataProp">mDataProp</a></span><span class="type-sig"><span class="type-signature"></span></span></dt><dd class=" even"><p>This parameter has been replaced by mData in DataTables to ensure naming
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
531 consistency. mDataProp can still be used, as there is backwards compatibility
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
532 in DataTables for this option, but it is strongly recommended that you use
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
533 mData in preference to mDataProp.</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
534
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
535 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
536 </div></dd><dt class=" odd"><a name="mRender"></a><a name="mRender_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#mRender">mRender</a></span><span class="type-sig"><span class="type-signature"> :string|int|function|null</span></span></dt><dd class=" odd"><p>This property is the rendering partner to mData and it is suggested that
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
537 when you want to manipulate data for display (including filtering, sorting etc)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
538 but not altering the underlying data for the table, use this property. mData
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
539 can actually do everything this property can and more, but this parameter is
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
540 easier to use since there is no 'set' option. Like mData is can be given
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
541 in a number of different ways to effect its behaviour, with the addition of
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
542 supporting array syntax for easy outputting of arrays (including arrays of
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
543 objects):
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
544 <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
545 <li>integer - treated as an array index for the data source. This is the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
546 default that DataTables uses (incrementally increased for each column).</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
547 <li>string - read an object property from the data source. Note that you can
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
548 use Javascript dotted notation to read deep properties / arrays from the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
549 data source and also array brackets to indicate that the data reader should
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
550 loop over the data source array. When characters are given between the array
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
551 brackets, these characters are used to join the data source array together.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
552 For example: "accounts[, ].name" would result in a comma separated list with
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
553 the 'name' value from the 'accounts' array of objects.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
554 <li>function - the function given will be executed whenever DataTables
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
555 needs to set or get the data for a cell in the column. The function
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
556 takes three parameters:
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
557 <ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
558 <li>{array|object} The data source for the row (based on mData)</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
559 <li>{string} The type call data requested - this will be 'filter', 'display',
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
560 'type' or 'sort'.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
561 <li>{array|object} The full data source for the row (not based on mData)</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
562 </ul>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
563 The return value from the function is what will be used for the data
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
564 requested.</li>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
565 </ul></p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
566
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
567 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
568 <h5>Examples</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
569 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
570 <pre class="brush: js"> // Create a comma separated list from an array of objects
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
571 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
572 var oTable = $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
573 "sAjaxSource": "sources/deep.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
574 "aoColumns": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
575 { "mData": "engine" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
576 { "mData": "browser" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
577 {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
578 "mData": "platform",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
579 "mRender": "[, ].name"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
580 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
581 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
582 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
583 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
584
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
585 </pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
586 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
587
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
588 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
589 <pre class="brush: js"> // Use as a function to create a link from the data source
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
590 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
591 var oTable = $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
592 "aoColumnDefs": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
593 {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
594 "aTargets": [ 0 ],
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
595 "mData": "download_link",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
596 "mRender": function ( data, type, full ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
597 return '<a href="'+data+'">Download</a>';
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
598 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
599 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
600 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
601 } );</pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
602 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
603 </div></dd><dt class=" even"><a name="sCellType"></a><a name="sCellType_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#sCellType">sCellType</a></span><span class="type-sig"><span class="type-signature"> :string</span></span></dt><dd class=" even"><p>Change the cell type created for the column - either TD cells or TH cells. This
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
604 can be useful as TH cells have semantic meaning in the table body, allowing them
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
605 to act as a header for a row (you may wish to add scope='row' to the TH elements).</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
606
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
607 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
608 <h5>Example</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
609 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
610 <pre class="brush: js"> // Make the first column use TH cells
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
611 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
612 var oTable = $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
613 "aoColumnDefs": [ {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
614 "aTargets": [ 0 ],
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
615 "sCellType": "th"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
616 } ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
617 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
618 } );</pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
619 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
620 </div></dd><dt class=" odd"><a name="sClass"></a><a name="sClass_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#sClass">sClass</a></span><span class="type-sig"><span class="type-signature"> :string</span></span></dt><dd class=" odd"><p>Class to give to each cell in this column.</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
621
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
622 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
623 <h5>Examples</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
624 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
625 <pre class="brush: js"> // Using aoColumnDefs
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
626 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
627 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
628 "aoColumnDefs": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
629 { "sClass": "my_class", "aTargets": [ 0 ] }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
630 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
631 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
632 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
633
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
634 </pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
635 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
636
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
637 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
638 <pre class="brush: js"> // Using aoColumns
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
639 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
640 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
641 "aoColumns": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
642 { "sClass": "my_class" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
643 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
644 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
645 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
646 null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
647 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
648 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
649 } );</pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
650 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
651 </div></dd><dt class=" even"><a name="sContentPadding"></a><a name="sContentPadding_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#sContentPadding">sContentPadding</a></span><span class="type-sig"><span class="type-signature"> :string</span></span></dt><dd class=" even"><p>When DataTables calculates the column widths to assign to each column,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
652 it finds the longest string in each column and then constructs a
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
653 temporary table and reads the widths from that. The problem with this
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
654 is that "mmm" is much wider then "iiii", but the latter is a longer
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
655 string - thus the calculation can go wrong (doing it properly and putting
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
656 it into an DOM object and measuring that is horribly(!) slow). Thus as
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
657 a "work around" we provide this option. It will append its value to the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
658 text that is found to be the longest string for the column - i.e. padding.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
659 Generally you shouldn't need this, and it is not documented on the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
660 general DataTables.net documentation</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
661
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
662 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
663 <h5>Example</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
664 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
665 <pre class="brush: js"> // Using aoColumns
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
666 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
667 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
668 "aoColumns": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
669 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
670 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
671 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
672 {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
673 "sContentPadding": "mmm"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
674 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
675 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
676 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
677 } );</pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
678 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
679 </div></dd><dt class=" odd"><a name="sDefaultContent"></a><a name="sDefaultContent_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#sDefaultContent">sDefaultContent</a></span><span class="type-sig"><span class="type-signature"> :string</span></span></dt><dd class=" odd"><p>Allows a default value to be given for a column's data, and will be used
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
680 whenever a null data source is encountered (this can be because mData
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
681 is set to null, or because the data source itself is null).</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
682
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
683 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
684 <h5>Examples</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
685 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
686 <pre class="brush: js"> // Using aoColumnDefs
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
687 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
688 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
689 "aoColumnDefs": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
690 {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
691 "mData": null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
692 "sDefaultContent": "Edit",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
693 "aTargets": [ -1 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
694 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
695 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
696 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
697 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
698
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
699 </pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
700 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
701
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
702 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
703 <pre class="brush: js"> // Using aoColumns
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
704 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
705 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
706 "aoColumns": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
707 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
708 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
709 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
710 {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
711 "mData": null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
712 "sDefaultContent": "Edit"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
713 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
714 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
715 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
716 } );</pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
717 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
718 </div></dd><dt class=" even"><a name="sName"></a><a name="sName_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#sName">sName</a></span><span class="type-sig"><span class="type-signature"> :string</span></span></dt><dd class=" even"><p>This parameter is only used in DataTables' server-side processing. It can
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
719 be exceptionally useful to know what columns are being displayed on the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
720 client side, and to map these to database fields. When defined, the names
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
721 also allow DataTables to reorder information from the server if it comes
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
722 back in an unexpected order (i.e. if you switch your columns around on the
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
723 client-side, your server-side code does not also need updating).</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
724
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
725 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
726 <h5>Examples</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
727 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
728 <pre class="brush: js"> // Using aoColumnDefs
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
729 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
730 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
731 "aoColumnDefs": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
732 { "sName": "engine", "aTargets": [ 0 ] },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
733 { "sName": "browser", "aTargets": [ 1 ] },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
734 { "sName": "platform", "aTargets": [ 2 ] },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
735 { "sName": "version", "aTargets": [ 3 ] },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
736 { "sName": "grade", "aTargets": [ 4 ] }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
737 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
738 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
739 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
740
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
741 </pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
742 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
743
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
744 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
745 <pre class="brush: js"> // Using aoColumns
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
746 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
747 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
748 "aoColumns": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
749 { "sName": "engine" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
750 { "sName": "browser" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
751 { "sName": "platform" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
752 { "sName": "version" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
753 { "sName": "grade" }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
754 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
755 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
756 } );</pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
757 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
758 </div></dd><dt class=" odd"><a name="sSortDataType"></a><a name="sSortDataType_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#sSortDataType">sSortDataType</a></span><span class="type-sig"><span class="type-signature"> :string</span></span></dt><dd class=" odd"><p>Defines a data source type for the sorting which can be used to read
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
759 real-time information from the table (updating the internally cached
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
760 version) prior to sorting. This allows sorting to occur on user editable
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
761 elements such as form inputs.</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
762
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
763 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
764 <h5>Examples</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
765 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
766 <pre class="brush: js"> // Using aoColumnDefs
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
767 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
768 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
769 "aoColumnDefs": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
770 { "sSortDataType": "dom-text", "aTargets": [ 2, 3 ] },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
771 { "sType": "numeric", "aTargets": [ 3 ] },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
772 { "sSortDataType": "dom-select", "aTargets": [ 4 ] },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
773 { "sSortDataType": "dom-checkbox", "aTargets": [ 5 ] }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
774 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
775 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
776 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
777
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
778 </pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
779 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
780
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
781 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
782 <pre class="brush: js"> // Using aoColumns
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
783 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
784 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
785 "aoColumns": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
786 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
787 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
788 { "sSortDataType": "dom-text" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
789 { "sSortDataType": "dom-text", "sType": "numeric" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
790 { "sSortDataType": "dom-select" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
791 { "sSortDataType": "dom-checkbox" }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
792 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
793 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
794 } );</pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
795 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
796 </div></dd><dt class=" even"><a name="sTitle"></a><a name="sTitle_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#sTitle">sTitle</a></span><span class="type-sig"><span class="type-signature"> :string</span></span></dt><dd class=" even"><p>The title of this column.</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
797
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
798 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
799 <h5>Examples</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
800 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
801 <pre class="brush: js"> // Using aoColumnDefs
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
802 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
803 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
804 "aoColumnDefs": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
805 { "sTitle": "My column title", "aTargets": [ 0 ] }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
806 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
807 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
808 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
809
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
810 </pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
811 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
812
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
813 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
814 <pre class="brush: js"> // Using aoColumns
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
815 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
816 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
817 "aoColumns": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
818 { "sTitle": "My column title" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
819 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
820 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
821 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
822 null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
823 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
824 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
825 } );</pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
826 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
827 </div></dd><dt class=" odd"><a name="sType"></a><a name="sType_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#sType">sType</a></span><span class="type-sig"><span class="type-signature"> :string</span></span></dt><dd class=" odd"><p>The type allows you to specify how the data for this column will be sorted.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
828 Four types (string, numeric, date and html (which will strip HTML tags
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
829 before sorting)) are currently available. Note that only date formats
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
830 understood by Javascript's Date() object will be accepted as type date. For
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
831 example: "Mar 26, 2008 5:03 PM". May take the values: 'string', 'numeric',
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
832 'date' or 'html' (by default). Further types can be adding through
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
833 plug-ins.</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
834
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
835 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
836 <h5>Examples</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
837 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
838 <pre class="brush: js"> // Using aoColumnDefs
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
839 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
840 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
841 "aoColumnDefs": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
842 { "sType": "html", "aTargets": [ 0 ] }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
843 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
844 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
845 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
846
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
847 </pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
848 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
849
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
850 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
851 <pre class="brush: js"> // Using aoColumns
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
852 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
853 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
854 "aoColumns": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
855 { "sType": "html" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
856 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
857 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
858 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
859 null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
860 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
861 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
862 } );</pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
863 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
864 </div></dd><dt class=" even"><a name="sWidth"></a><a name="sWidth_details"></a><span class="type-attr"><span class="type-signature">&lt;static> </span></span><span class="type-name"><a href="#sWidth">sWidth</a></span><span class="type-sig"><span class="type-signature"> :string</span></span></dt><dd class=" even"><p>Defining the width of the column, this parameter may take any CSS value
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
865 (3em, 20px etc). DataTables apples 'smart' widths to columns which have not
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
866 been given a specific width through this interface ensuring that the table
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
867 remains readable.</p><div class="collapse_details"><dl class="details">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
868
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
869 </dl>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
870 <h5>Examples</h5>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
871 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
872 <pre class="brush: js"> // Using aoColumnDefs
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
873 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
874 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
875 "aoColumnDefs": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
876 { "sWidth": "20%", "aTargets": [ 0 ] }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
877 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
878 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
879 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
880
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
881 </pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
882 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
883
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
884 <div class="example-code">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
885 <pre class="brush: js"> // Using aoColumns
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
886 $(document).ready( function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
887 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
888 "aoColumns": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
889 { "sWidth": "20%" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
890 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
891 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
892 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
893 null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
894 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
895 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
896 } );</pre>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
897 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
898 </div></dd>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
899 </dl></div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
900 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
901
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
902 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
903
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
904 <div class="fw_footer">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
905 DataTables: Copyright 2008-2012 Allan Jardine, all rights reserved<br>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
906
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
907 Documentation generated by <a href="https://github.com/micmath/JSDoc">JSDoc 3</a> on
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
908 23th Sep 2012 - 14:27
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
909 with the <a href="http://datatables.net/">DataTables</a> template.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
910 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
911 </body>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
912 </html>