Description
The main component of the module, used to display a datatable.

Props

Name Type Default value Required? Description
name string - No The name of the datatable. It should be unique per page.
columns Array.<ColumnDef> - Yes List of columns definitions displayed by this datatable.
data Array.<*>|function - Yes The list of items to display, or a getter function.
filter string - No Value to match in rows for display filtering.
rowClasses string|Array.<string>|function - No Class(es) or getter function to get row classes.

Data

Name Type Default value Description
sortBy Column|null - Column used for data sorting.
sortDir 'asc'|'desc'|null - Direction of the sort. A null value is equivalent to 'asc'.
totalRows number - Total number of rows contained by this data table.
page number - Current page index.
perPage number|null - Maximum number of rows displayed per page.
displayedRows Array.<Row> - Array of rows displayed by the table.
pagers Array.<datatable-pager> - Array of pagers that are linked to this table.

Computed

Name Type Description
rows Array.<*> Array of rows currently managed by the datatable.
settings Settings Reference to the Settings object linked to this datatable instance.
handler Handler Reference to the Handler object linked to this datatable instance.
normalizedColumns Array.<Column> Array of columns definitions casted as Column objects.
tableClass string Base CSS class to apply to the `<table>` element.

Methods


getSortDirectionForColumn( columnDefinition ) → {'asc'|'desc'|null}

Description
Get the sort direction for a specific column.
Parameters
Name Type Description
columnDefinition Column The column to check sorting direction for.
Returns
The sort direction for the specified column.
Details

setSortDirectionForColumn( direction, column ) → {void}

Description
Defines the sort direction for a specific column.
Parameters
Name Type Description
direction 'asc' | 'desc' | null The direction of the sort.
column Column The column to check sorting direction for.
Returns
Nothing.
Details

processRows() → {Promise.<void>}

Description
Using data (or its return value if it is a function), filter, sort, paginate & display rows in the table.
Returns
Nothing.
Details

DataFnParams Parameters provided to the `data` function.


setRows( rows ) → {void}

Description
Set the displayed rows.
Parameters
Name Type Description
rows Array.<Row> The rows to display.
Returns
Nothing.
Details

setTotalRowCount( value ) → {void}

Description
Set the displayed rows count.
Parameters
Name Type Description
value number The number of displayed rows.
Returns
Nothing.
Details

getRowClasses( row ) → {string}

Description
Get the classes to add on the row
Parameters
Name Type Description
row Row The row to get classes for.
Returns
The classes string to set on the row.
Details

initWatchCriterions() → {void}

Description
Starts the watching of following properties: `filter`, `perPage`, `page`, `sortBy`, `sortDir`. When a change is detected, the component runs datatable#processRows. Because the watch is immediate, datatable#processRows is run immediately when this method is called.
Returns
Nothing.
Details