cardView().displayed()

Since: CardView 1.0.0

Determine if the cards or table is shown.
Please note - this property requires the CardView extension for DataTables.

Description

This method can be used to determine if the DataTable is displaying the cards or table at any specific point. This is useful as CardView can operate in an "auto" mode, whereby the DataTable can show either the cards or table based on the content width available and responsive configuration of CardView.

Type

cardView().displayed()

Determine if the DataTable is operating in card or table view.

Returns:

boolean:
true if in card view, false if the table is displayed.

Example

Immediately set the operating mode when the table is initialised:

let table = new DataTable('#myTable', {
	cardView: true
});

console.log('Are cards shown?: ,table.cardView().displayed());