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:

Callable

  • Returns ReactNode

Accessors

selectedCells: IgrCellType[]

Returns an array of the selected IgxGridCells.

Events

onActiveNodeChange: (args: CustomEvent<IgrActiveNodeChangeEventArgsDetail>) => void

Type declaration

onAdvancedFilteringExpressionsTreeChange: (args: CustomEvent<IgrFilteringExpressionsTree>) => void

Type declaration

onCellClick: (args: CustomEvent<IgrGridCellEventArgsDetail>) => void

Type declaration

onCellEdit: (args: CustomEvent<IgrGridEditEventArgsDetail>) => void

Type declaration

onCellEditDone: (args: CustomEvent<IgrGridEditDoneEventArgsDetail>) => void

Type declaration

onCellEditEnter: (args: CustomEvent<IgrGridEditEventArgsDetail>) => void

Type declaration

onCellEditExit: (args: CustomEvent<IgrGridEditDoneEventArgsDetail>) => void

Type declaration

onColumnInit: (args: CustomEvent<IgrColumn>) => void

Type declaration

onColumnMoving: (args: CustomEvent<IgrColumnMovingEventArgsDetail>) => void

Type declaration

onColumnMovingEnd: (args: CustomEvent<IgrColumnMovingEndEventArgsDetail>) => void

Type declaration

onColumnMovingStart: (args: CustomEvent<IgrColumnMovingStartEventArgsDetail>) => void

Type declaration

Type declaration

onColumnPinned: (args: CustomEvent<IgrPinColumnEventArgsDetail>) => void

Type declaration

onColumnResized: (args: CustomEvent<IgrColumnResizeEventArgsDetail>) => void

Type declaration

onColumnsAutogenerated: (args: CustomEvent<IgcColumnsAutoGeneratedEventArgs>) => void

Type declaration

onColumnSelectionChanging: (args: CustomEvent<IgrColumnSelectionEventArgsDetail>) => void

Type declaration

onColumnVisibilityChanged: (args: CustomEvent<IgrColumnVisibilityChangedEventArgsDetail>) => void

Type declaration

onColumnVisibilityChanging: (args: CustomEvent<IgrColumnVisibilityChangingEventArgsDetail>) => void

Type declaration

onContextMenu: (args: CustomEvent<IgrGridContextMenuEventArgsDetail>) => void

Type declaration

onDataChanged: (args: CustomEvent<IgrForOfDataChangeEventArgsDetail>) => void

Type declaration

onDataChanging: (args: CustomEvent<IgrForOfDataChangeEventArgsDetail>) => void

Type declaration

onDoubleClick: (args: CustomEvent<IgrGridCellEventArgsDetail>) => void

Type declaration

onExpansionStatesChange: (args: CustomEvent<Map<any, boolean>>) => void

Type declaration

onFiltering: (args: CustomEvent<IgrFilteringEventArgsDetail>) => void

Type declaration

onFilteringDone: (args: CustomEvent<IgrFilteringExpressionsTree>) => void

Type declaration

onFilteringExpressionsTreeChange: (args: CustomEvent<IgrFilteringExpressionsTree>) => void

Type declaration

onFormGroupCreated: (args: CustomEvent<IgrGridFormGroupCreatedEventArgsDetail>) => void

Type declaration

onGridCopy: (args: CustomEvent<IgrGridClipboardEvent>) => void

Type declaration

onGridKeydown: (args: CustomEvent<IgrGridKeydownEventArgsDetail>) => void

Type declaration

onGridScroll: (args: CustomEvent<IgrGridScrollEventArgsDetail>) => void

Type declaration

onRangeSelected: (args: CustomEvent<IgrGridSelectionRange>) => void

Type declaration

onRendered: (args: CustomEvent<boolean>) => void

Type declaration

Type declaration

onRowAdded: (args: CustomEvent<IgrRowDataEventArgsDetail>) => void

Type declaration

onRowClick: (args: CustomEvent<IgrGridRowEventArgsDetail>) => void

Type declaration

onRowDelete: (args: CustomEvent<IgrRowDataCancelableEventArgsDetail>) => void

Type declaration

onRowDeleted: (args: CustomEvent<IgrRowDataEventArgsDetail>) => void

Type declaration

onRowDragEnd: (args: CustomEvent<IgrRowDragEndEventArgsDetail>) => void

Type declaration

onRowDragStart: (args: CustomEvent<IgrRowDragStartEventArgsDetail>) => void

Type declaration

onRowEdit: (args: CustomEvent<IgrGridEditEventArgsDetail>) => void

Type declaration

onRowEditDone: (args: CustomEvent<IgrGridEditDoneEventArgsDetail>) => void

Type declaration

onRowEditEnter: (args: CustomEvent<IgrGridEditEventArgsDetail>) => void

Type declaration

onRowEditExit: (args: CustomEvent<IgrGridEditDoneEventArgsDetail>) => void

Type declaration

onRowPinned: (args: CustomEvent<IgrPinRowEventArgsDetail>) => void

Type declaration

onRowPinning: (args: CustomEvent<IgrPinRowEventArgsDetail>) => void

Type declaration

onRowSelectionChanging: (args: CustomEvent<IgrRowSelectionEventArgsDetail>) => void

Type declaration

onRowToggle: (args: CustomEvent<IgrRowToggleEventArgsDetail>) => void

Type declaration

onSelected: (args: CustomEvent<IgrGridCellEventArgsDetail>) => void

Type declaration

onSelectedRowsChange: (args: CustomEvent<any[]>) => void

Type declaration

onSorting: (args: CustomEvent<IgrSortingEventArgsDetail>) => void

Type declaration

onSortingDone: (args: CustomEvent<IgrSortingExpression[]>) => void

Type declaration

onSortingExpressionsChange: (args: CustomEvent<IgrSortingExpression[]>) => void

Type declaration

onToolbarExporting: (args: CustomEvent<IgrGridToolbarExportEventArgsDetail>) => void

Type declaration

onValidationStatusChange: (args: CustomEvent<IgrGridValidationStatusEventArgsDetail>) => void

Type declaration

Methods

  • 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

    Parameters

    • data: any
    • parentRowID: any

    Returns void

  • 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);

    Parameters

    • index: number

      The index to spawn the UI at. Accepts integers from 0 to this.grid.dataView.length

    • asChild: boolean

      Whether the record should be added as a child. Only applicable to igxTreeGrid.

    Returns void

  • Collapses all rows.

    this.grid.collapseAll();
    

    IgxTreeGridComponent

    Returns void

  • Expands all rows.

    this.grid.expandAll();
    

    IgxTreeGridComponent

    Returns void

  • Returns a CellType object that matches the conditions.

    const myCell = this.grid1.getCellByColumn(2, "UnitPrice");
    

    Parameters

    • rowIndex: number
    • columnField: string

    Returns IgrCellType

  • Returns a CellType object that matches the conditions.

    Requires that the primaryKey property is set.

    grid.getCellByKey(1, 'index');
    

    Parameters

    • rowSelector: any

      match any rowID

    • columnField: string

    Returns IgrCellType

  • Returns the IgxTreeGridRow by index.

    const myRow = treeGrid.getRowByIndex(1);
    

    Parameters

    • index: number

    Returns IgrRowType

  • Returns the RowType object by the specified primary key.

    const myRow = this.treeGrid.getRowByIndex(1);
    

    Parameters

    • key: any

    Returns IgrRowType

  • 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.

    Parameters

    • formatters: boolean
    • headers: boolean

    Returns any[]

  • Pin the row by its id.

    ID is either the primaryKey value or the data record instance.

    this.grid.pinRow(rowID);
    

    Parameters

    • rowID: any

      The row id - primaryKey value or the data record instance.

    • index: number

      The index at which to insert the row in the pinned collection.

    Returns boolean

  • Unpin the row by its id.

    ID is either the primaryKey value or the data record instance.

    this.grid.unpinRow(rowID);
    

    Parameters

    • rowID: any

      The row id - primaryKey value or the data record instance.

    Returns boolean

Properties

cascadeOnDelete: boolean

Sets 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>
childDataKey: string

Sets the child data key of the IgxTreeGridComponent.

<igx-tree-grid #grid [data]="employeeData" [childDataKey]="'employees'" [autoGenerate]="true"></igx-tree-grid>
data: any[]

Gets/Sets the array of data that populates the component.

<igx-tree-grid [data]="Data" [autoGenerate]="true"></igx-tree-grid>
expansionDepth: number

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>
foreignKey: string

Sets the foreign key of the IgxTreeGridComponent.

<igx-tree-grid #grid [data]="employeeData" [primaryKey]="'employeeID'" [foreignKey]="'parentID'" [autoGenerate]="true">
</igx-tree-grid>
hasChildrenKey: string

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>
id: string

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>
loadChildrenOnDemand: any

Sets 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));
}
processedRootRecords: IgrTreeGridRecord[]

Returns an array of processed (filtered and sorted) root ITreeGridRecords.

// gets the processed root record with index=2
const states = this.grid.processedRootRecords[2];
rootRecords: IgrTreeGridRecord[]

Returns an array of the root level ITreeGridRecords.

// gets the root record with index=2
const states = this.grid.rootRecords[2];
rowLoadingIndicatorTemplate: IgcRenderFunction<void>

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>