File: columns%28%29.visible%28%29.xml

package info (click to toggle)
datatables.js 1.11.5%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 22,848 kB
  • sloc: javascript: 65,075; xml: 10,712; php: 4,741; sh: 544; makefile: 18
file content (52 lines) | stat: -rw-r--r-- 2,440 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
41
42
43
44
45
46
47
48
49
50
51
52
<?xml version="1.0" encoding="UTF-8" ?>
<dt-api group="columns">
	<name>columns().visible()</name>
	<summary>Get / set the visibility of the selected columns.</summary>
	<since>1.10</since>

	<type type="function">
		<signature>columns().visible()</signature>
		<description>Get the visibility of the selected columns.</description>
		<returns type="DataTables.Api">API instance with the result set containing a boolean value for each column the selector matched. The boolean values indicate: `true` if the column is visible, `false` if it is not.</returns>
	</type>

	<type type="function">
		<signature>columns().visible( show [, redrawCalculations ] )</signature>
		<description>Set the visibility of the selected columns.</description>
		<parameter type="boolean" name="show">
			Specify if the columns should be visible (`true`) or not (`false`).
		</parameter>
		<parameter type="boolean" name="redrawCalculations" default="true">
			Indicate if DataTables should recalculate the column layout (`true` - default) or not (`false`). Typically this would be left as the default value, but it can be useful to disable when using the method in a loop - so the calculations are performed on every call as they can hamper performance.
		</parameter>
		<returns type="DataTables.Api">DataTables API instance with selected columns in the result set.</returns>
	</type>

	<description>
		Showing and hiding columns in a DataTable can be quite handy, particularly when showing tables with a large information density. This method allows the visibility of columns to be changed on-the-fly, or the visibility state of the columns to be read.
	</description>

	<example title="Set column visibility for two columns"><![CDATA[
var table = $('#example').DataTable();

// Hide two columns
table.columns( [1,2] ).visible( false );

alert( 'Table\'s column visibility are set to: '+table.columns().visible().join(', ') );
]]></example>

	<example title="Hide all columns with a class of '.detail'"><![CDATA[
var table = $('#example').DataTable();

table.columns( '.detail' ).visible( false );
]]></example>

	<example title="Hide multiple columns using `redrawCalculations` to improve performance"><![CDATA[
var table = $('#example').DataTable();

table.columns( [ 0, 1, 2, 3 ] ).visible( false, false );
table.columns.adjust().draw( false ); // adjust column sizing and redraw
]]></example>

	<related type="api">column().visible()</related>
</dt-api>