{hero}

scrollCollapse

Since: DataTables 1.10

Allow the table to reduce in height when a limited number of rows are shown.

Description

When vertical (y) scrolling is enabled through the use of the scrollY option, DataTables will force the height of the table's viewport to the given height at all times (useful for layout). However, this can look odd when filtering data down to a small data set, and the footer is left "floating" further down. This parameter (when enabled) will cause DataTables to collapse the table's viewport when the result set fits within the given Y height.

Type

This option can be given in the following type(s):

Default

false

Example

Enable the automatic resize of the table container when scrolling enabled:

new DataTable('#myTable', {
	scrollY: 300,
	scrollCollapse: true
});

Related

The following options are directly related and may also be useful in your application development.