columns()
Select multiple columns from a table.
Description
Often you will wish to work with one or more columns in a DataTables - this method provides the ability to select multiple columns from tables, with its chained methods providing the ability to get work with the column, such as getting its data or toggling its visibility.
While column()
provides access to a single column, this columns()
method is used to allow multiple columns to be manipulated or modified at the same time.
The method has two forms, reflecting the fact the columns can be selected in multiple different ways as your implementation demands:
- All columns (no parameters, or just a
selector-modifier
option) - Columns selector (and optional
selector-modifier
)
Types
function columns( [ modifier ] )
- Description:
Select all columns
- Parameters:
Name Type Optional 1 modifier
Yes - default: Option used to specify how the content's of the selected columns should be ordered, and if paging or filtering in the table should be taken into account. This is only useful for operations which involve rows, such as
columns().nodes()
andcolumns().data()
.- Returns:
DataTables API instance with selected columns in the result set.
function columns( columnSelector [, modifier ] )
- Description:
Select columns found by a column selector
- Parameters:
Name Type Optional 1 columnSelector
No Column selector.
2 modifier
Yes - default: Option used to specify how the content's of the selected columns should be ordered, and if paging or filtering in the table should be taken into account. This is only useful for operations which involve rows, such as
columns().nodes()
andcolumns().data()
.- Returns:
DataTables API instance with selected columns
Related
The following options are directly related and may also be useful in your application development.