Class: TableHeader

Drupal.TableHeader(table)

new TableHeader(table)

Constructor for the tableHeader object. Provides sticky table headers.

TableHeader will make the current table header stick to the top of the page if the table is very long.

Parameters:
Name Type Description
table HTMLElement

DOM object for the table to add a sticky header to.

Source:
Listens to Events:

Members

(static) tables :Array.<Drupal.TableHeader>

This will store the state of all processed tables.

Type:
Source:

$originalTable :HTMLElement

Type:
  • HTMLElement
Source:

minHeight :number

Minimum height in pixels for the table to have a sticky header.

Type:
  • number
Source:

stickyVisible :bool

Boolean storing the sticky header visibility state.

Type:
  • bool
Source:

(nullable) tableHeight :number

Absolute position of the table on the page.

Type:
  • number
Source:

(nullable) tableOffset :Drupal~displaceOffset

Absolute position of the table on the page.

Type:
Source:

Methods

checkStickyVisible() → {bool}

Returns true if sticky is currently visible.

Source:
Returns:

The visibility status.

Type
bool

createSticky()

Create the duplicate header.

Source:

onScroll(e)

Check if sticky header should be displayed.

This function is throttled to once every 250ms to avoid unnecessary calls.

Parameters:
Name Type Description
e jQuery.Event

The scroll event.

Source:

recalculateSticky(event)

Event handler: recalculates position of the sticky table header.

Parameters:
Name Type Description
event jQuery.Event

Event being triggered.

Source:

stickyPosition(offsetTop, offsetLeft) → {jQuery}

Set absolute position of sticky.

Parameters:
Name Type Description
offsetTop number

The top offset for the sticky header.

offsetLeft number

The left offset for the sticky header.

Source:
Returns:

The sticky table as a jQuery collection.

Type
jQuery