Constructor
new HTMLTableWrapper(table)
Parameters:
Name | Type | Description |
---|---|---|
table |
HTMLTableElement | Table element this |
- Source:
Throws:
-
If
table
is not defined, or does not have any table body sections. - Type
- ReferenceError
Members
(static) filteredClassName :string
Class name added to the class list of filtered elements. Default value is 'data-table-filtered'
.
Type:
- string
- Source:
(private) initialOrder :Array
Cache of the initial state of the table's rows. Used when sort parameters are cleared.
Type:
- Array
- Source:
(private) table :HTMLTableElement
Backing HTMLTableElement
.
Type:
- HTMLTableElement
- Source:
Methods
(private, static) copy(src) → {Array}
Utility function to copy the elements from the given src
MinimalList into a new Array
.
Parameters:
Name | Type | Description |
---|---|---|
src |
MinimalList | List to be copied. |
- Source:
Returns:
An Array
containing the same elements of the given src
.
- Type
- Array
clearFilter()
Clears all filters.
- Source:
clearSort()
Clears the sorting for all columns. The original order for all rows (at the time this HTMLTableWrapper
was constructed) is restored.
- Source:
filter(…args)
Filters the first table body section of the backing table according to the given FilterDescriptors. This function can be called with a single
Array
of FilterDescriptors or in a variadic manner. If no arguments are provided or a zero-length Array
is provided for argument 0,
HTMLTableWrapper#clearFilter is implicitly called.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
FilterDescriptor |
<repeatable> |
FilterDescriptors to process. If the first argument is an |
- Source:
getRows(includeFilteredopt) → {MinimalList}
Returns the HTMLTableRowElement
s of the first table body section of the backing table. Rows that have been filtered are excluded unless
includeFiltered
is true
.
IMPLEMENTATION NOTE: Callers to this function should only rely on the interface defined by MinimalList, as this method may return
either an Array
or a NodeList
.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
includeFiltered |
boolean |
<optional> |
false | Whether to include rows that are filtered in the result. |
- Source:
Returns:
HTMLTableRowElement
s of the first table body section of the backing table.
- Type
- MinimalList
getTableElement() → {HTMLTableElement}
Returns the HTMLTableElement
backing this HTMLTableWrapper
.
- Source:
Returns:
The HTMLTableElement
backing this HTMLTableWrapper
.
- Type
- HTMLTableElement
sort(…args)
Sorts the first table body section of the backing table according to the given SortDescriptors. This function can be called with a single
Array
of SortDescriptors or in a variadic manner. If no arguments are provided, or a zero-length Array
is provided for argument 0,
HTMLTableWrapper#clearSort is implicitly called.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
SortDescriptor |
<repeatable> |
SortDescriptors to process. If the first argument is an |
- Source: