DatatableComponent¶
declare class DatatableComponent<TRow extends Row = any> implements DoCheck, AfterViewInit, OnDestroy
Constructor¶
constructor¶
Constructs a new instance of the DatatableComponent class
Inputs¶
checkRowListChanges¶
Controls whether the datatable runs an IterableDiffer against the rows input on every change detection cycle to detect additions, removals and reorderings that happen in-place on the same array reference.
Enabled by default. Set to false as a performance optimization when you always pass a new rows array reference on updates.
checkRowPropertyChanges¶
Controls whether each rendered row runs a KeyValueDiffer against its row object on every change detection cycle to detect in-place property mutations (e.g. row.name = 'new' without replacing the row reference).
Enabled by default. Set to false as a performance optimization when row objects are treated as immutable.
columnMode¶
Column width distribution mode. standard uses configured widths, flex uses the flex-grow algorithm, and force distributes space proportionally.
columns¶
Columns to be displayed.
count¶
The total count of all rows. Default value: 0
cssClasses¶
CSS class overrides for sort and pager icons.
enableClearingSortState¶
A flag to controll behavior of sort states. By default sort on column toggles between ascending and descending without getting removed. Set true to clear sorting of column after performing ascending and descending sort on that column.
externalPaging¶
If the table should use external paging otherwise its assumed that all data is preloaded.
externalSorting¶
If the table should use external sorting or the built-in basic sorting.
footerHeight¶
The minimum footer height in pixels. Pass falsey for no footer
ghostLoadingIndicator¶
Show ghost loaders on each cell. Default value: false
groupedRows¶
This attribute allows the user to set a grouped array in the following format: [ {groupid=1} [ {id=1 name="test1"}, {id=2 name="test2"}, {id=3 name="test3"} ]}, {groupid=2>[ {id=4 name="test4"}, {id=5 name="test5"}, {id=6 name="test6"} ]} ]
groupExpansionDefault¶
A boolean you can use to set the detault behaviour of rows and groups whether they will start expanded or not. If ommited the default is NOT expanded.
groupRowsBy¶
This attribute allows the user to set the name of the column to group the data with
headerHeight¶
The minimum header height in pixels. Pass a falsey for no header
limit¶
The page size to be shown. Default value: undefined
loadingIndicator¶
Show the linear loading bar. Default value: false
messages¶
Message overrides for localization
offset¶
The current offset ( page - 1 ) shown. Default value: 0
reorderable¶
Enable/Disable ability to re-order columns by dragging them.
rowDraggable¶
A flag to enable drag behavior of native HTML5 drag and drop API on rows. If set to true, rowDragEvents will emit dragstart and dragend events.
rows¶
Rows that are displayed in the table.
scrollbarH¶
Enable horz scrollbars
scrollbarV¶
Enable vertical scrollbars
scrollbarVDynamic¶
Enable vertical scrollbars dynamically on demand. Property scrollbarV needs to be set true too. Width that is gained when no scrollbar is needed is added to the inner table width.
selectAllRowsOnPage¶
Property to which you can use for determining select all rows on current page or not.
selected¶
List of row objects that should be represented as selected in the grid. Default value: []
selectionType¶
Type of row selection. Options are:
single-multi-checkbox-multiClick-cell
For no selection pass a falsey. Default value: undefined
sorts¶
Array of sorted columns by property and type. Default value: []
sortType¶
Sorting mode. In single mode, sorting a new column replaces existing sorts; in multi mode, it adds an additional column sort.
summaryHeight¶
A height of summary row
summaryPosition¶
A property holds a summary row position: top/bottom
summaryRow¶
A flag for switching summary row on / off
swapColumns¶
Swap columns on re-order columns or move them.
targetMarkerTemplate¶
Template for the target marker of drag target columns.
trackByProp¶
Property to which you can use for custom tracking of rows. Example: 'name'
treeFromRelation¶
Tree from relation
treeToRelation¶
Tree to relation
virtualization¶
A flag for row virtualization on / off
Outputs¶
activate¶
A cell or row was focused via keyboard or mouse click.
page¶
The table was paged either triggered by the pager or the body scroll.
reorder¶
Columns were re-ordered.
resize¶
Column was resized.
rowDragEvents¶
Emits HTML5 native drag events. Only emits dragenter, dragover, drop events by default. Set rowDraggable to true for dragstart and dragend.
scroll¶
Body was scrolled typically in a scrollbarV:true scenario.
tableContextmenu¶
The context menu was invoked on the table. type indicates whether the header or the body was clicked. content contains either the column or the row that was clicked.
treeAction¶
A row was expanded ot collapsed for tree
Properties¶
allRowsSelected¶
Returns if all rows are selected.
bodyHeight¶
columnTemplates¶
Column templates gathered from ContentChildren if described in your markup.
correctedOffset¶
Computed signal that returns the corrected offset value. It ensures the offset is within valid bounds based on rowCount and pageSize.
disableRowCheck¶
A function you can use to check whether you want to disable a row. Example:
(row) => { return row.name !== 'Ethel Price'; }
displayCheck¶
readonly displayCheck: InputSignal<((row: TRow, column: TableColumn, value?: any) => boolean) | undefined>
A function you can use to check whether you want to show the checkbox for a particular row based on a criteria. Example:
(row, column, value) => { return row.name !== 'Ethel Price'; }
element¶
groupHeader¶
Group Header templates gathered from the ContentChild
pageSize¶
rowClass¶
A function which is called with the row and should return either: - a string: "class-1 class-2 - a Record{ 'class-1': true, 'class-2': false }
rowCount¶
rowDetail¶
Row Detail templates gathered from the ContentChild
rowDiffer¶
rowHeight¶
Height of each row. When virtual scrolling is disabled, use 'auto' for fluid heights. With virtual scrolling enabled, provide a number or a function that calculates each row's height.
rowIdentity¶
This will be used when displaying or selecting rows. when tracking/comparing them, we'll use the value of this fn,
(fn(x) === fn(y) instead of x === y)
selectCheck¶
readonly selectCheck: InputSignal<((value: TRow, index: number, array: TRow[]) => boolean) | undefined>
A boolean/function you can use to check whether you want to select a particular row based on a criteria. Example:
(selection) => { return selection !== 'Ethel Price'; }
summaryRowDirective¶
Custom summary row template gathered from the ContentChild
totalColumnGroupWidths¶
verticalScrollVisible¶
Functions¶
calcPageSize¶
Recalculates the sizes of the page
calcRowCount¶
Calculates the row count.
groupArrayBy¶
groupArrayBy(originalArray: (TRow | undefined)[], groupBy: keyof TRow): {
key: TRow[keyof TRow];
value: TRow[];
}[]
Creates a map with the data grouped by the user choice of grouping index
ngAfterViewInit¶
Lifecycle hook that is called after a component's view has been fully initialized.
ngDoCheck¶
ngOnDestroy¶
onBodyPage¶
Body triggered a page event.
onBodyScroll¶
The body triggered a scroll event.
onColumnContextmenu¶
The header triggered a contextmenu event.
onColumnReorder¶
The header triggered a column re-order event.
onColumnResize¶
The header triggered a column resize event.
onColumnResizing¶
onColumnSort¶
The header triggered a column sort event.
onFooterPage¶
The footer triggered a page event.
onHeaderSelect¶
Toggle all row selection
onRowContextmenu¶
The body triggered a contextmenu event.
onTreeAction¶
A row was expanded or collapsed for tree
onWindowResize¶
recalculate¶
recalculateColumns¶
Recalulcates the column widths based on column width distribution mode and scrollbar offsets.