File: columns.width.xml

package info (click to toggle)
datatables.js 1.10.13%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,232 kB
  • ctags: 1,329
  • sloc: xml: 10,249; php: 4,387; sh: 492; makefile: 21
file content (40 lines) | stat: -rw-r--r-- 1,439 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?xml version="1.0" encoding="UTF-8" ?>
<dt-option group="columns">
	<name>columns.width</name>
	<summary>Column width assignment</summary>
	<since>1.10</since>

	<type type="string" />
  <default>
    Auto-detected from the table's content.
  </default>

	<description>
    This parameter can be used to define the width of a column, and may take any CSS value (3em, 20px etc).

    Please note that pixel perfect column width is virtually impossible to achieve in tables with dynamic content, so do not be surprised if the width of the column if off by a few pixels from what you assign using this property. Column width in tables depends upon many properties such as cell borders, table borders, the `border-collapse` property, the content of the table and many other properties. Both DataTables and the browsers attempt to lay the table out in an optimal manner taking this options all into account.
	</description>

	<example title="Set the first column's width to 20% with `dt-init columnDefs`"><![CDATA[
$('#example').dataTable( {
  "columnDefs": [
    { "width": "20%", "targets": 0 }
  ]
} );
]]></example>

	<example title="Set the first column's width to 20% with `dt-init columns`"><![CDATA[
$('#example').dataTable( {
  "columns": [
    { "width": "20%" },
    null,
    null,
    null,
    null
  ]
} );
]]></example>

  <related type="option">autoWidth</related>
  <related type="api">columns.adjust()</related>
</dt-option>