Class: TableHeader

Drupal. TableHeader

new Drupal.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.

Name Type Description
table HTMLElement

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

Listens to Events:

Members

staticDrupal.TableHeader.tablesArray.<Drupal.TableHeader>

This will store the state of all processed tables.

$originalTableHTMLElement

minHeightnumber

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

stickyVisiblebool

Boolean storing the sticky header visibility state.

nullabletableHeightnumber

Absolute position of the table on the page.

nullabletableOffsetDrupal~displaceOffset

Absolute position of the table on the page.

Methods

checkStickyVisible(){bool}

Returns true if sticky is currently visible.

Returns:
Type Description
bool The visibility status.

createSticky()

Create the duplicate header.

Check if sticky header should be displayed.

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

Name Type Description
e jQuery.Event

The scroll event.

recalculateSticky(event)

Event handler: recalculates position of the sticky table header.

Name Type Description
event jQuery.Event

Event being triggered.

stickyPosition(offsetTop, offsetLeft){jQuery}

Set absolute position of sticky.

Name Type Description
offsetTop number

The top offset for the sticky header.

offsetLeft number

The left offset for the sticky header.

Returns:
Type Description
jQuery The sticky table as a jQuery collection.