rowGroup
Enable and configure the RowGroup extension for DataTables.
Please note - this property requires the RowGroup extension for DataTables.
Description
RowGroup is an extension for DataTables that provides grouping capabilities (like all other DataTables extensions, the clue is in the name!). A data point in the table's data is used to group information and then display grouping rows before and / or after the group, with options to customise the display of those rows.
This option provides the ability to enable and configure RowGroup for DataTables. In its simplest form as the boolean true
it will enable RowGroup with the default configuration options (as defined by $.fn.dataTable.RowGroup.defaults
). However, it is more likely that you will wish to use it as an object to provide custom configuration options, particularly for the data parameter to use for the grouping (rowGroup.dataSrc
).
Please note that as with all other configuration options for RowGroup, this option is an extension to the default set of DataTables options. This property should be set in the DataTables initialisation object.
Types
boolean
- Description:
As a boolean value this property will enable RowGroup on the DataTable that is being created.
true
will enable RowGroup using the default data source of0
, whilefalse
will not.This is a short-cut option to enable RowGroup with the default configuration options. Customisations can be made by giving this parameter as an object, see below.
object
- Description:
If given as an object, RowGroup will be enabled on the target DataTable, with the RowGroup defaults (
$.fn.dataTable.RowGroup.defaults
) extended, and potentially overwritten, by the options provided in this object. This is how RowGroup can be configured on an individual table basis, or through the defaults.
Default
- Value:
undefined
RowGroup will not be initialised by default
Examples
Enable row grouping:
new DataTable('#myTable', {
rowGroup: true
});
Enable row grouping with a grouping data property specified:
new DataTable('#myTable', {
rowGroup: {
dataSrc: 'group'
}
});