Emmited when the active node is changed.
<igx-grid [data]="data" [autoGenerate]="true" (activeNodeChange)="activeNodeChange($event)"></igx-grid>
Gets/Sets a custom template for adding row UI when grid is empty.
<igx-grid [id]="'igx-grid-1'" [data]="Data" [addRowEmptyTemplate]="myTemplate" [autoGenerate]="true"></igx-grid>
Emitted after advanced filtering is performed.
Returns the advanced filtering expressions tree.
<igx-grid #grid [data]="localData" [height]="'305px'" [autoGenerate]="true"
(advancedFilteringExpressionsTreeChange)="advancedFilteringExprTreeChange($event)"></igx-grid>
Gets/Sets whether to auto-generate the columns.
The default value is false. When set to true, it will override all columns declared through code or in markup.
<igx-grid [data]="Data" [autoGenerate]="true"></igx-grid>
Gets/Sets a list of property keys to be excluded from the generated column collection
The collection is only used during initialization and changing it will not cause any changes in the generated columns at runtime unless the grid is destroyed and recreated. To modify the columns visible in the UI at runtime, please use their hidden property.
<igx-grid data=[Data] [autoGenerate]="true" [autoGenerateExclude]="['ProductName', 'Count']"></igx-grid>
const Data = [{ 'Id': '1', 'ProductName': 'name1', 'Description': 'description1', 'Count': 5 }]
An
property indicating whether child records should be deleted when their parent gets deleted. By default it is set to true and deletes all children along with the parent.
<igx-tree-grid [data]="employeeData" [primaryKey]="'employeeID'" [foreignKey]="'parentID'" cascadeOnDelete="false">
</igx-tree-grid>
IgxTreeGridComponent
Readonly
cdrEmitted when a cell is clicked.
Returns the IgxGridCell
.
<igx-grid #grid (cellClick)="cellClick($event)" [data]="localData" [height]="'305px'" [autoGenerate]="true"></igx-grid>
Emitted when cell has been edited.
Event is fired after editing is completed, when the cell is exiting edit mode. This event is cancelable.
<igx-grid #grid3 (cellEdit)="editDone($event)" [data]="data" [primaryKey]="'ProductID'">
</igx-grid>
Emitted after cell has been edited and editing has been committed.
<igx-grid #grid3 (cellEditDone)="editDone($event)" [data]="data" [primaryKey]="'ProductID'">
</igx-grid>
Emitted when cell enters edit mode.
This event is cancelable.
<igx-grid #grid3 (cellEditEnter)="editStart($event)" [data]="data" [primaryKey]="'ProductID'">
</igx-grid>
Emitted when cell exits edit mode.
<igx-grid #grid3 (cellEditExit)="editExit($event)" [data]="data" [primaryKey]="'ProductID'">
</igx-grid>
An
property that sets the child data key of the IgxTreeGridComponent
.
<igx-tree-grid #grid [data]="employeeData" [childDataKey]="'employees'" [autoGenerate]="true"></igx-tree-grid>
IgxTreeGridComponent
Controls the copy behavior of the grid.
Apply the columns formatters (if any) on the data in the clipboard output.
Include the columns headers in the clipboard output.
Enables/disables the copy behavior
The separator used for formatting the copy output. Defaults to \t
.
Emitted when a column is initialized.
Returns the column object.
<igx-grid #grid [data]="localData" (columnInit)="initColumns($event)" [autoGenerate]="true"></igx-grid>
Emitted during the column moving operation.
Returns the source and target IgxColumnComponent
objects. This event is cancelable.
<igx-grid (columnMoving)="moving($event)"></igx-grid>
Emitted when column moving ends.
Returns the source and target IgxColumnComponent
objects.
<igx-grid (columnMovingEnd)="movingEnds($event)"></igx-grid>
Emitted when column moving starts.
Returns the moved IgxColumnComponent
object.
<igx-grid (columnMovingStart)="movingStart($event)"></igx-grid>
Emitted before IgxColumnComponent
is pinned.
The index at which to insert the column may be changed through the insertAtIndex
property.
public columnPinning(event) {
if (event.column.field === "Name") {
event.insertAtIndex = 0;
}
}
Emitted after IgxColumnComponent
is pinned.
The index that the column is inserted at may be changed through the insertAtIndex
property.
public columnPinning(event) {
if (event.column.field === "Name") {
event.insertAtIndex = 0;
}
}
Emitted after column is resized.
Returns the IgxColumnComponent
object's old and new width.
<igx-grid #grid [data]="localData" (columnResized)="resizing($event)" [autoGenerate]="true"></igx-grid>
Emitted when IgxColumnComponent
is selected.
<igx-grid #grid (columnSelectionChanging)="columnSelectionChanging($event)" [data]="localData" [autoGenerate]="true"></igx-grid>
Emitted after column visibility is changed.
Args: { column: IgxColumnComponent, newValue: boolean }
<igx-grid (columnVisibilityChanged)="visibilityChanged($event)"></igx-grid>
Emitted before column visibility is changed.
Args: { column: any, newValue: boolean }
<igx-grid (columnVisibilityChanging)="visibilityChanging($event)"></igx-grid>
Emitted when a cell is right clicked.
Returns the IgxGridCell
object.
<igx-grid #grid [data]="localData" (contextMenu)="contextMenu($event)" [autoGenerate]="true"></igx-grid>
Emitted after the grid's data view is changed because of a data operation, rebinding, etc.
<igx-grid #grid [data]="localData" [autoGenerate]="true" (dataChanged)='handleDataChangedEvent()'></igx-grid>
Emitted before the grid's data view is changed because of a data operation, rebinding, etc.
<igx-grid #grid [data]="localData" [autoGenerate]="true" (dataChanging)='handleDataChangingEvent()'></igx-grid>
Emitted when a cell is double clicked.
Returns the IgxGridCell
object.
<igx-grid #grid [data]="localData" (doubleClick)="dblClick($event)" [autoGenerate]="true"></igx-grid>
Gets/Sets a custom template when empty.
<igx-grid [id]="'igx-grid-1'" [data]="Data" [emptyGridTemplate]="myTemplate" [autoGenerate]="true"></igx-grid>
Emitted before filtering expressions are applied.
Returns an IFilteringEventArgs
object. filteringExpressions
key holds the filtering expressions for the column.
<igx-grid #grid [data]="localData" [height]="'305px'" [autoGenerate]="true" (filtering)="filtering($event)"></igx-grid>
Emitted after filtering is performed through the UI.
Returns the filtering expressions tree of the column for which filtering was performed.
<igx-grid #grid [data]="localData" [height]="'305px'" [autoGenerate]="true" (filteringDone)="filteringDone($event)"></igx-grid>
Emitted after filtering is performed.
Returns the filtering expressions tree of the column for which filtering was performed.
<igx-grid #grid [data]="localData" [height]="'305px'" [autoGenerate]="true"
(filteringExpressionsTreeChange)="filteringExprTreeChange($event)"></igx-grid>
An
property that sets the foreign key of the IgxTreeGridComponent
.
<igx-tree-grid #grid [data]="employeeData" [primaryKey]="'employeeID'" [foreignKey]="'parentID'" [autoGenerate]="true">
</igx-tree-grid>
IgxTreeGridComponent
Emitted when formGroup is created on edit of row/cell.
<igx-grid #grid (formGroupCreated)="formGroupCreated($event)" [data]="localData" [height]="'305px'" [autoGenerate]="true"></igx-grid>
Readonly
gridAPIEmitted when a copy operation is executed.
Fired only if copy behavior is enabled through the [clipboardOptions
]IgxGridBaseDirective#clipboardOptions.
Emitted when keydown is triggered over element inside grid's body.
This event is fired only if the key combination is supported in the grid. Return the target type, target object and the original event. This event is cancelable.
<igx-grid (gridKeydown)="customKeydown($event)"></igx-grid>
Emitted when grid is scrolled horizontally/vertically.
<igx-grid #grid [data]="localData" [height]="'305px'" [autoGenerate]="true"
(gridScroll)="onScroll($event)"></igx-grid>
An
property that sets the key indicating whether a row has children. This property is only used for load on demand scenarios.
<igx-tree-grid #grid [data]="employeeData" [primaryKey]="'employeeID'" [foreignKey]="'parentID'"
[loadChildrenOnDemand]="loadChildren"
[hasChildrenKey]="'hasEmployees'">
</igx-tree-grid>
IgxTreeGridComponent
An
property that sets the value of the id
attribute. If not provided it will be automatically generated.
<igx-tree-grid [id]="'igx-tree-grid-1'"></igx-tree-grid>
IgxTreeGridComponent
Represents the last search information.
An
property that provides a callback for loading child rows on demand.
<igx-tree-grid [data]="employeeData" [primaryKey]="'employeeID'" [foreignKey]="'parentID'" [loadChildrenOnDemand]="loadChildren">
</igx-tree-grid>
public loadChildren = (parentID: any, done: (children: any[]) => void) => {
this.dataService.getData(parentID, children => done(children));
}
IgxTreeGridComponent
Gets/Sets a custom template when loading.
<igx-grid [id]="'igx-grid-1'" [data]="Data" [loadingGridTemplate]="myTemplate" [autoGenerate]="true"></igx-grid>
Controls whether columns moving is enabled in the grid.
Gets/Sets the primary key.
<igx-grid #grid [data]="localData" [primaryKey]="'ProductID'" [autoGenerate]="true"></igx-grid>
Returns a map of all processed (filtered and sorted) ITreeGridRecord
s.
// gets the processed record with primaryKey=2
const states = this.grid.processedRecords.get(2);
IgxTreeGridComponent
Returns an array of processed (filtered and sorted) root ITreeGridRecord
s.
// gets the processed root record with index=2
const states = this.grid.processedRootRecords[2];
IgxTreeGridComponent
Emitted when making a range selection.
Range selection can be made either through drag selection or through keyboard selection.
Returns a map of all ITreeGridRecord
s.
// gets the record with primaryKey=2
const states = this.grid.records.get(2);
IgxTreeGridComponent
Emitted after the ngAfterViewInit hook. At this point the grid exists in the DOM
Returns an array of the root level ITreeGridRecord
s.
// gets the root record with index=2
const states = this.grid.rootRecords[2];
IgxTreeGridComponent
Emmited just before the newly added row is commited.
This event is cancelable.
Returns an IGridEditEventArgs
object.
<igx-grid #grid [data]="localData" (rowAdd)="rowAdd($event)" [height]="'305px'" [autoGenerate]="true"></igx-grid>
Emitted when a row is added.
Returns the data for the new IgxGridRowComponent
object.
<igx-grid #grid [data]="localData" (rowAdded)="rowAdded($event)" [height]="'305px'" [autoGenerate]="true"></igx-grid>
Sets a conditional class selector to the grid's row element. Accepts an object literal, containing key-value pairs, where the key is the name of the CSS class and the value is either a callback function that returns a boolean, or boolean, like so:
callback = (row: RowType) => { return row.selected > 6; }
rowClasses = { 'className' : this.callback };
<igx-grid #grid [data]="Data" [rowClasses] = "rowClasses" [autoGenerate]="true"></igx-grid>
IgxColumnComponent
Emmited when deleting a row.
This event is cancelable.
Returns an IGridEditEventArgs
object.
<igx-grid #grid [data]="localData" (rowDelete)="rowDelete($event)" [height]="'305px'" [autoGenerate]="true"></igx-grid>
Emitted when a row is deleted.
Returns an IRowDataEventArgs
object.
<igx-grid #grid [data]="localData" (rowDeleted)="rowDeleted($event)" [height]="'305px'" [autoGenerate]="true"></igx-grid>
Emitted when dropping a row.
Return the dropped row.
Emitted when start dragging a row.
Return the dragged row.
Emitted when exiting edit mode for a row.
Emitted when [rowEditable]="true" & endEdit(true)
is called.
Emitted when changing rows during edit mode, selecting an un-editable cell in the edited row,
performing paging operation, column resizing, pinning, moving or hitting Done
button inside of the rowEditingOverlay, or hitting the Enter
key while editing a cell.
This event is cancelable.
<igx-grid #grid3 (rowEdit)="editDone($event)" [data]="data" [primaryKey]="'ProductID'" [rowEditable]="true">
</igx-grid>
Emitted after exiting edit mode for a row and editing has been committed.
Emitted when [rowEditable]="true" & endEdit(true)
is called.
Emitted when changing rows during edit mode, selecting an un-editable cell in the edited row,
performing paging operation, column resizing, pinning, moving or hitting Done
button inside of the rowEditingOverlay, or hitting the Enter
key while editing a cell.
<igx-grid #grid3 (rowEditDone)="editDone($event)" [data]="data" [primaryKey]="'ProductID'" [rowEditable]="true">
</igx-grid>
Emitted when a row enters edit mode.
Emitted when [rowEditable]="true". This event is cancelable.
<igx-grid #grid3 (rowEditEnter)="editStart($event)" [primaryKey]="'ProductID'" [rowEditable]="true">
</igx-grid>
Emitted when row editing is canceled.
Emits when [rowEditable]="true" & endEdit(false)
is called.
Emitted when changing hitting Esc
key during cell editing and when click on the Cancel
button
in the row editing overlay.
<igx-grid #grid3 (rowEditExit)="editExit($event)" [data]="data" [primaryKey]="'ProductID'" [rowEditable]="true">
</igx-grid>
Emitted when the pinned state of a row is changed.
<igx-grid [data]="employeeData" (rowPinned)="rowPin($event)" [autoGenerate]="true"></igx-grid>
Emitted when the pinned state of a row is changed.
<igx-grid [data]="employeeData" (rowPinning)="rowPin($event)" [autoGenerate]="true"></igx-grid>
Emitted when IgxGridRowComponent
is selected.
<igx-grid #grid (rowSelectionChanging)="rowSelectionChanging($event)" [data]="localData" [autoGenerate]="true"></igx-grid>
Sets conditional style properties on the grid row element. It accepts an object literal where the keys are the style properties and the value is an expression to be evaluated.
styles = {
background: 'yellow',
color: (row: RowType) => row.selected : 'red': 'white'
}
<igx-grid #grid [data]="Data" [rowStyles]="styles" [autoGenerate]="true"></igx-grid>
IgxColumnComponent
Emitted when the expanded state of a row gets changed.
<igx-grid [data]="employeeData" (rowToggle)="rowToggle($event)" [autoGenerate]="true"></igx-grid>
Emitted when a cell is selected.
Returns the IgxGridCell
.
<igx-grid #grid (selected)="onCellSelect($event)" [data]="localData" [height]="'305px'" [autoGenerate]="true"></igx-grid>
Gets/Sets whether the columns should be auto-generated once again after the initialization of the grid
This will allow to bind the grid to remote data and having auto-generated columns at the same time. Note that after generating the columns, this property would be disabled to avoid re-creating columns each time a new data is assigned.
this.grid.shouldGenerate = true;
Gets/Sets the display time for the row adding snackbar notification.
By default it is 6000ms.
Emitted before sorting expressions are applied.
Returns an ISortingEventArgs
object. sortingExpressions
key holds the sorting expressions.
<igx-grid #grid [data]="localData" [autoGenerate]="true" (sorting)="sorting($event)"></igx-grid>
Emitted after sorting is completed.
Returns the sorting expression.
<igx-grid #grid [data]="localData" [autoGenerate]="true" (sortingDone)="sortingDone($event)"></igx-grid>
Emitted before sorting is performed.
Returns the sorting expressions.
<igx-grid #grid [data]="localData" [autoGenerate]="true" (sortingExpressionsChange)="sortingExprChange($event)"></igx-grid>
Emitted when an export process is initiated by the user.
toolbarExporting(event: IGridToolbarExportEventArgs){
const toolbarExporting = event;
}
Gets/Sets a unique values strategy used by the Excel Style Filtering
Provides a callback for loading unique column values on demand. If this property is provided, the unique values it generates will be used by the Excel Style Filtering.
<igx-grid [data]="localData" [filterMode]="'excelStyleFilter'" [uniqueColumnValuesStrategy]="columnValuesStrategy"></igx-grid>
Readonly
validationEmitted when grid's validation status changes.
<igx-grid #grid (validationStatusChange)="validationStatusChange($event)" [data]="localData" [height]="'305px'" [autoGenerate]="true"></igx-grid>
Gets/Sets the trigger for validators used when editing the grid.
<igx-grid #grid validationTrigger='blur'></igx-grid>
Gets/Sets the advanced filtering state.
let advancedFilteringExpressionsTree = this.grid.advancedFilteringExpressionsTree;
this.grid.advancedFilteringExpressionsTree = logic;
Gets/Sets a value indicating whether the advanced filtering is enabled.
<igx-grid #grid [data]="localData" [allowAdvancedFiltering]="true" [autoGenerate]="true"></igx-grid>
Gets/Sets if the filtering is enabled.
<igx-grid #grid [data]="localData" [allowFiltering]="true" [height]="'305px'" [autoGenerate]="true"></igx-grid>
Gets/Sets whether the grid has batch editing enabled.
When batch editing is enabled, changes are not made directly to the underlying data.
Instead, they are stored as transactions, which can later be committed w/ the commit
method.
<igx-grid [batchEditing]="true" [data]="someData">
</igx-grid>
Gets/Sets cell selection mode.
By default the cell selection mode is multiple
Gets/Sets column selection mode
By default the row selection mode is none
Gets/Sets the default width of the columns.
<igx-grid #grid [data]="localData" [columnWidth]="100" [autoGenerate]="true"></igx-grid>
Gets an array of IgxColumnComponent
s.
const colums = this.grid.columns.
An
property that lets you fill the IgxTreeGridComponent
with an array of data.
<igx-tree-grid [data]="Data" [autoGenerate]="true"></igx-tree-grid>
IgxTreeGridComponent
Gets/Sets the data clone strategy of the grid when in edit mode.
<igx-grid #grid [data]="localData" [dataCloneStrategy]="customCloneStrategy"></igx-grid>
A list of currently rendered IgxGridRowComponent
's.
const dataList = this.grid.dataRowList;
Returns the currently transformed paged/filtered/sorted/grouped/pinned/unpinned row data, displayed in the grid.
const dataView = this.grid.dataView;
Returns the IgxGridHeaderGroupComponent
's minimum allowed width.
Used internally for restricting header group component width. The values below depend on the header cell default right/left padding values.
Gets the default row height.
const rowHeigh = this.grid.defaultRowHeight;
Returns the theme of the component.
The default theme is comfortable
.
Available options are comfortable
, cosy
, compact
.
let componentTheme = this.component.displayDensity;
Sets the theme of the component.
Gets the custom template, if any, used for row drag ghost.
Sets a custom template for the row drag ghost.
<ng-template #template igxRowDragGhost>
<igx-icon>menu</igx-icon>
</ng-template>
@ViewChild("'template'", {read: TemplateRef })
public template: TemplateRef<any>;
this.grid.dragGhostCustomTemplate = this.template;
The custom template, if any, that should be used when rendering the row drag indicator icon
Sets a custom template that should be used when rendering the row drag indicator icon.
<ng-template #template igxDragIndicatorIcon>
<igx-icon>expand_less</igx-icon>
</ng-template>
@ViewChild("'template'", {read: TemplateRef })
public template: TemplateRef<any>;
this.grid.dragIndicatorIconTemplate = this.template;
Gets/Sets the message displayed when there are no records and the grid is filtered.
<igx-grid #grid [data]="Data" [emptyGridMessage]="'The grid is empty'" [autoGenerate]="true"></igx-grid>
Get/Sets the message displayed when there are no records.
<igx-grid #grid [data]="Data" [emptyGridMessage]="'The grid is empty'" [autoGenerate]="true"></igx-grid>
Gets the excel style header icon.
Sets the excel style header icon.
<ng-template #template igxExcelStyleHeaderIcon>
<igx-icon>filter_alt</igx-icon>
</ng-template>
@ViewChild('template', {read: TemplateRef })
public template: TemplateRef<any>;
this.grid.excelStyleHeaderIconTemplate = this.template;
An
property that sets the count of levels to be expanded in the IgxTreeGridComponent
. By default it is
set to Infinity
which means all levels would be expanded.
<igx-tree-grid #grid [data]="employeeData" [childDataKey]="'employees'" expansionDepth="1" [autoGenerate]="true"></igx-tree-grid>
IgxTreeGridComponent
Gets/Sets a list of key-value pairs [row ID, expansion state].
Includes only states that differ from the default one. Supports two-way binding.
<igx-grid #grid [data]="data" [(expansionStates)]="model.expansionStates">
</igx-grid>
Gets/Sets the filter mode.
<igx-grid #grid [data]="localData" [filterMode]="'quickFilter'" [height]="'305px'" [autoGenerate]="true"></igx-grid>
By default it's set to FilterMode.quickFilter.
Gets/Sets the filtering strategy of the grid.
<igx-grid #grid [data]="localData" [filterStrategy]="filterStrategy"></igx-grid>
Returns an array of objects containing the filtered data.
let filteredData = this.grid.filteredData;
Returns an array containing the filtered sorted data.
const filteredSortedData = this.grid1.filteredSortedData;
Gets/Sets the filtering state.
<igx-grid #grid [data]="Data" [autoGenerate]="true" [(filteringExpressionsTree)]="model.filteringExpressions"></igx-grid>
Supports two-way binding.
Gets/Sets the filtering logic of the IgxGridComponent
.
The default is AND.
<igx-grid [data]="Data" [autoGenerate]="true" [filteringLogic]="filtering"></igx-grid>
Gets the header row selector template.
Sets the header row selector template.
<ng-template #template igxHeadSelector let-headContext>
{{ headContext.selectedCount }} / {{ headContext.totalCount }}
</ng-template>
@ViewChild("'template'", {read: TemplateRef })
public template: TemplateRef<any>;
this.grid.headSelectorTemplate = this.template;
Gets the row collapse indicator template.
Sets the row collapse indicator template.
<ng-template igxHeaderCollapsedIndicator>
<igx-icon role="button">add</igx-icon>
</ng-template>
@ViewChild('template', {read: TemplateRef })
public template: TemplateRef<any>;
this.grid.headerCollapsedIndicatorTemplate = this.template;
Gets the header expand indicator template.
Sets the header expand indicator template.
<ng-template igxHeaderExpandedIndicator>
<igx-icon role="button">remove</igx-icon>
</ng-template>
@ViewChild('template', {read: TemplateRef })
public template: TemplateRef<any>;
this.grid.headerExpandedIndicatorTemplate = this.template;
Gets/Sets the height.
<igx-grid #grid [data]="Data" [height]="'305px'" [autoGenerate]="true"></igx-grid>
Gets the number of hidden columns.
const hiddenCol = this.grid.hiddenColumnsCount;
``
Gets/Sets if the row selectors are hidden.
By default row selectors are shown
Gets/Sets whether the grid is going to show a loading indicator.
<igx-grid #grid [data]="Data" [isLoading]="true" [autoGenerate]="true"></igx-grid>
Gets/Sets the locale.
If not set, returns browser's language.
Gets the native element.
const nativeEl = this.grid.nativeElement.
Gets/Sets the outlet used to attach the grid's overlays to.
If set, returns the outlet defined outside the grid. Otherwise returns the grid's internal outlet directive.
Gets an array of the pinned IgxColumnComponent
s.
const pinnedColumns = this.grid.pinnedColumns.
Gets the number of pinned columns.
Gets an array of the pinned IgxRowComponent
s.
const pinnedRow = this.grid.pinnedRows;
Gets/Sets the initial pinning configuration.
Allows to apply pinning the columns to the start or the end. Note that pinning to both sides at a time is not allowed.
<igx-grid [pinning]="pinningConfig"></igx-grid>
Gets/Sets the resource strings.
By default it uses EN resources.
Gets the row add text template.
Sets the row add text template.
<ng-template #template igxRowAddText>
Adding Row
</ng-template>
@ViewChild('template', {read: TemplateRef })
public template: TemplateRef<any>;
this.grid.rowAddTextTemplate = this.template;
Gets the row collapse indicator template.
Sets the row collapse indicator template.
<ng-template igxRowCollapsedIndicator>
<igx-icon role="button">add</igx-icon>
</ng-template>
@ViewChild('template', {read: TemplateRef })
public template: TemplateRef<any>;
this.grid.rowCollapsedIndicatorTemplate = this.template;
Gets/Sets whether rows can be moved.
<igx-grid #grid [rowDraggable]="true"></igx-grid>
Gets the row edit actions template.
Sets the row edit actions template.
<ng-template #template igxRowEditActions let-endRowEdit>
<button igxButton igxRowEditTabStop (click)="endRowEdit(false)">Cancel</button>
<button igxButton igxRowEditTabStop (click)="endRowEdit(true)">Apply</button>
</ng-template>
@ViewChild('template', {read: TemplateRef })
public template: TemplateRef<any>;
this.grid.rowEditActionsTemplate = this.template;
Gets the row edit text template.
Sets the row edit text template.
<ng-template #template igxRowEditText let-rowChangesCount>
Changes: {{rowChangesCount}}
</ng-template>
@ViewChild('template', {read: TemplateRef })
public template: TemplateRef<any>;
this.grid.rowEditTextTemplate = this.template;
Gets/Sets whether the rows are editable.
By default it is set to false.
<igx-grid #grid [rowEditable]="true" [primaryKey]="'ProductID'" ></igx-grid>
Gets the row expand indicator template.
Sets the row expand indicator template.
<ng-template igxRowExpandedIndicator>
<igx-icon role="button">remove</igx-icon>
</ng-template>
@ViewChild('template', {read: TemplateRef })
public template: TemplateRef<any>;
this.grid.rowExpandedIndicatorTemplate = this.template;
Gets/Sets the row height.
<igx-grid #grid [data]="localData" [rowHeight]="100" [autoGenerate]="true"></igx-grid>
A list of IgxGridRowComponent
.
const rowList = this.grid.rowList;
An
property that provides a template for the row loading indicator when load on demand is enabled.
<ng-template #rowLoadingTemplate>
<igx-icon>loop</igx-icon>
</ng-template>
<igx-tree-grid #grid [data]="employeeData" [primaryKey]="'ID'" [foreignKey]="'parentID'"
[loadChildrenOnDemand]="loadChildren"
[rowLoadingIndicatorTemplate]="rowLoadingTemplate">
</igx-tree-grid>
IgxTreeGridComponent
Gets/Sets row selection mode
By default the row selection mode is 'none' Note that in IgxGrid and IgxHierarchicalGrid 'multipleCascade' behaves like 'multiple'
Gets the row selector template.
Sets a custom template for the row selectors.
<ng-template #template igxRowSelector let-rowContext>
<igx-checkbox [checked]="rowContext.selected"></igx-checkbox>
</ng-template>
@ViewChild("'template'", {read: TemplateRef })
public template: TemplateRef<any>;
this.grid.rowSelectorTemplate = this.template;
Gets/Sets whether clicking over a row should select/deselect it
By default it is set to true
Gets/Sets the current selection state.
Represents the selected rows' IDs (primary key or rowData)
<igx-grid [data]="localData" primaryKey="ID" rowSelection="multiple" [selectedRows]="[0, 1, 2]"><igx-grid>
Controls whether the summary row is visible when groupBy/parent row is collapsed.
<igx-grid #grid [data]="localData" [showSummaryOnCollapse]="true" [autoGenerate]="true"></igx-grid>
By default showSummaryOnCollapse is set to 'false' which means that the summary row is not visible when the groupBy/parent row is collapsed.
The custom template, if any, that should be used when rendering a header sorting indicator when columns are sorted in asc order.
Sets a custom template that should be used when rendering a header sorting indicator when columns are sorted in asc order.
<ng-template #template igxSortAscendingHeaderIcon>
<igx-icon>expand_less</igx-icon>
</ng-template>
@ViewChild("'template'", {read: TemplateRef })
public template: TemplateRef<any>;
this.grid.sortAscendingHeaderIconTemplate = this.template;
The custom template, if any, that should be used when rendering a header sorting indicator when columns are sorted in desc order.
Sets a custom template that should be used when rendering a header sorting indicator when columns are sorted in desc order.
<ng-template #template igxSortDescendingHeaderIcon>
<igx-icon>expand_more</igx-icon>
</ng-template>
@ViewChild("'template'", {read: TemplateRef })
public template: TemplateRef<any>;
this.grid.sortDescendingHeaderIconTemplate = this.template;
Gets custom template, if any, that should be used when rendering a header sorting indicator when columns are not sorted.
Sets a custom template that should be used when rendering a header sorting indicator when columns are not sorted.
<ng-template #template igxSortHeaderIcon>
<igx-icon>unfold_more</igx-icon>
</ng-template>
@ViewChild("'template'", {read: TemplateRef })
public template: TemplateRef<any>;
this.grid.sortHeaderIconTemplate = this.template;
Gets/Sets the sorting strategy of the grid.
<igx-grid #grid [data]="localData" [sortStrategy]="sortStrategy"></igx-grid>
Gets/Sets the sorting state.
Supports two-way data binding.
<igx-grid #grid [data]="Data" [autoGenerate]="true" [(sortingExpressions)]="model.sortingExpressions"></igx-grid>
Gets/Sets the sorting options - single or multiple sorting.
Accepts an ISortingOptions
object with any of the mode
properties.
const _sortingOptions: ISortingOptions = {
mode: 'single'
}
```html
<igx-grid [sortingOptions]="sortingOptions"><igx-grid>
Gets/Sets the summary calculation mode.
<igx-grid #grid [data]="localData" summaryCalculationMode="rootLevelOnly" [autoGenerate]="true"></igx-grid>
By default it is rootAndChildLevels which means the summaries are calculated for the root level and each child level.
Gets/Sets the summary position.
<igx-grid #grid [data]="localData" summaryPosition="top" [autoGenerate]="true"></igx-grid>
By default it is bottom.
Get/Set IgxSummaryRow height
Returns the total number of records.
Only functions when paging is enabled.
const totalRecords = this.grid.totalRecords;
Gets an array of unpinned IgxColumnComponent
s.
const unpinnedColumns = this.grid.unpinnedColumns.
Returns the state of the grid virtualization.
Includes the start index and how many records are rendered.
const gridVirtState = this.grid1.virtualizationState;
Returns an array of visible IgxColumnComponent
s.
const visibleColumns = this.grid.visibleColumns.
Gets/Sets the width of the grid.
let gridWidth = this.grid.width;
Creates a new IgxTreeGridRowComponent
with the given data. If a parentRowID is not specified, the newly created
row would be added at the root level. Otherwise, it would be added as a child of the row whose primaryKey matches
the specified parentRowID. If the parentRowID does not exist, an error would be thrown.
const record = {
ID: this.grid.data[this.grid1.data.length - 1].ID + 1,
Name: this.newRecord
};
this.grid.addRow(record, 1); // Adds a new child row to the row with ID=1.
IgxTreeGridComponent
Enters add mode by spawning the UI under the specified row by rowID.
If null is passed as rowID, the row adding UI is spawned as the first record in the data view
this.grid.beginAddRowById('ALFKI');
this.grid.beginAddRowById('ALFKI', true);
this.grid.beginAddRowById(null);
The rowID to spawn the add row UI for, or null to spawn it as the first record in the data view
Whether the record should be added as a child. Only applicable to igxTreeGrid.
Enters add mode by spawning the UI with the context of the specified row by index.
Accepted values for index are integers from 0 to this.grid.dataView.length
this.grid.beginAddRowByIndex(10);
this.grid.beginAddRowByIndex(10, true);
this.grid.beginAddRowByIndex(null);
The index to spawn the UI at. Accepts integers from 0 to this.grid.dataView.length
Whether the record should be added as a child. Only applicable to igxTreeGrid.
Removes the IgxGridRowComponent
and the corresponding data record by primary key.
Requires that the primaryKey
property is set.
The method accept rowSelector as a parameter, which is the rowID.
this.grid1.deleteRow(0);
Deselects all rows
By default if filtering is in place, selectAllRows() and deselectAllRows() select/deselect all filtered rows. If you set the parameter onlyFilterData to false that will deselect all rows in the grid exept deleted rows.
this.grid.deselectAllRows();
Deselect specified columns by field.
this.grid.deselectColumns(['ID','Name']);
Enables summaries for the specified column and applies your customSummary.
If you do not provide the customSummary, then the default summary for the column data type will be applied.
grid.enableSummaries([{ fieldName: 'ProductName' }, { fieldName: 'ID' }]);
Enable summaries for the listed columns.
grid.enableSummaries('ProductName');
Finishes the row transactions on the current row and returns whether the grid editing was canceled.
If commit === true
, passes them from the pending state to the data (or transaction service)
<button igxButton (click)="grid.endEdit(true)">Commit Row</button>
Filters a single IgxColumnComponent
.
public filter(term) {
this.grid.filter("ProductName", term, IgxStringFilteringOperand.instance().condition("contains"));
}
Filters all the IgxColumnComponent
in the IgxGridComponent
with the same condition.
grid.filterGlobal('some', IgxStringFilteringOperand.instance().condition('contains'));
Finds the next occurrence of a given string in the grid and scrolls to the cell if it isn't visible.
Returns how many times the grid contains the string.
this.grid.findNext("financial");
the string to search.
optionally, if the search should be case sensitive (defaults to false).
optionally, if the text should match the entire value (defaults to false).
Finds the previous occurrence of a given string in the grid and scrolls to the cell if it isn't visible.
Returns how many times the grid contains the string.
this.grid.findPrev("financial");
the string to search.
optionally, if the search should be case sensitive (defaults to false).
optionally, if the text should match the entire value (defaults to false).
Returns the IgxColumnComponent
by field name.
const myCol = this.grid1.getColumnByName("ID");
Gets the width
to be set on IgxGridHeaderGroupComponent
.
Returns ICellPosition
which defines the next cell,
according to the current position, that match specific criteria.
You can pass callback function as a third parameter of getPreviousCell
method.
The callback function accepts IgxColumnComponent as a param
const nextEditableCellPosition = this.grid.getNextCell(0, 3, (column) => column.editable);
Returns ICellPosition
which defines the previous cell,
according to the current position, that match specific criteria.
You can pass callback function as a third parameter of getPreviousCell
method.
The callback function accepts IgxColumnComponent as a param
const previousEditableCellPosition = this.grid.getPreviousCell(0, 3, (column) => column.editable);
Returns an array of the current columns selection in the form of [{ column.field: cell.value }, ...]
.
If formatters
is enabled, the cell value will be formatted by its respective column formatter (if any).
If headers
is enabled, it will use the column header (if any) instead of the column field.
Returns an array of the current cell selection in the form of [{ column.field: cell.value }, ...]
.
If formatters
is enabled, the cell value will be formatted by its respective column formatter (if any).
If headers
is enabled, it will use the column header (if any) instead of the column field.
Get the currently selected ranges in the grid.
Triggers change detection for the IgxGridComponent
.
Calling markForCheck also triggers the grid pipes explicitly, resulting in all updates being processed.
May degrade performance if used when not needed, or if misused:
// DON'Ts:
// don't call markForCheck from inside a loop
// don't call markForCheck when a primitive has changed
grid.data.forEach(rec => {
rec = newValue;
grid.markForCheck();
});
// DOs
// call markForCheck after updating a nested property
grid.data.forEach(rec => {
rec.nestedProp1.nestedProp2 = newValue;
});
grid.markForCheck();
grid.markForCheck();
Places a column before or after the specified target column.
grid.moveColumn(column, target);
Navigates to a position in the grid based on provided rowindex
and visibleColumnIndex
.
Also can execute a custom logic over the target element, through a callback function that accepts { targetType: GridKeydownTargetType, target: Object }
this.grid.navigateTo(10, 3, (args) => { args.target.nativeElement.focus(); });
Opens the advanced filtering dialog.
Pins a column by field name.
Returns whether the operation is successful.
this.grid.pinColumn("ID");
Selects all rows
By default if filtering is in place, selectAllRows() and deselectAllRows() select/deselect all filtered rows. If you set the parameter onlyFilterData to false that will select all rows in the grid exept deleted rows.
this.grid.selectAllRows();
this.grid.selectAllRows(false);
Select specified columns.
this.grid.selectColumns(['ID','Name'], true);
if true clears the current selection
Select range(s) of cells between certain rows and columns of the grid.
Get current selected columns.
Returns an array with selected columns
const selectedColumns = this.grid.selectedColumns();
Sort a single IgxColumnComponent
.
Sort the IgxGridComponent
's IgxColumnComponent
based on the provided array of sorting expressions.
this.grid.sort({ fieldName: name, dir: SortingDirection.Asc, ignoreCase: false });
Toggles the specified column's visibility.
this.grid1.toggleColumnVisibility({
column: this.grid1.columns[0],
newValue: true
});
Unpins a column by field name. Returns whether the operation is successful.
this.grid.pinColumn("ID");
Updates the IgxGridRowComponent
and the corresponding data record by primary key.
Requires that the primaryKey
property is set.
this.gridWithPK.updateCell('Updated', 1, 'ProductName');
the new value which is to be set.
corresponds to rowID.
corresponds to column field.
Updates the IgxGridRowComponent
The row is specified by rowSelector parameter and the data source record with the passed value. This method will apply requested update only if primary key is specified in the grid.
grid.updateRow({
ProductID: 1, ProductName: 'Spearmint', InStock: true, UnitsInStock: 1, OrderDate: new Date('2005-03-21')
}, 1);
correspond to rowID
Ignite UI for Angular Tree Grid - Documentation
The Ignite UI Tree Grid displays and manipulates hierarchical data with consistent schema formatted as a table and provides features such as sorting, filtering, editing, column pinning, paging, column moving and hiding.
Example: