Class IgxPivotGridComponent

Pivot Grid provides a way to present and manipulate data in a pivot table view.

Igx Module

IgxPivotGridModule

Igx Group

Grids & Lists

Igx Keywords

pivot, grid, table

Igx Theme

igx-grid-theme

Remarks

The Ignite UI Pivot Grid is used for grouping and aggregating simple flat data into a pivot table. Once data has been bound and the dimensions and values configured it can be manipulated via sorting and filtering.

Example

<igx-pivot-grid [data]="data" [pivotConfiguration]="configuration">
</igx-pivot-grid>

Hierarchy

Hierarchy

  • IgxGridBaseDirective
    • IgxPivotGridComponent

Implements

  • OnInit
  • AfterContentInit
  • GridType
  • AfterViewInit

Constructors

Properties

Accessors

Methods

Constructors

  • Parameters

    • validationService: IgxGridValidationService
    • selectionService: IgxGridSelectionService
    • colResizingService: IgxPivotColumnResizingService
    • gridAPI: GridBaseAPIService<IgxGridBaseDirective & GridType>
    • transactionFactory: IgxFlatTransactionFactory
    • elementRef: ElementRef<HTMLElement>
    • zone: NgZone
    • document: any
    • cdr: ChangeDetectorRef
    • differs: IterableDiffers
    • viewRef: ViewContainerRef
    • injector: Injector
    • envInjector: EnvironmentInjector
    • navigation: IgxPivotGridNavigationService
    • filteringService: IgxFilteringService
    • textHighlightService: IgxTextHighlightService
    • overlayService: IgxOverlayService
    • summaryService: IgxGridSummaryService
    • _displayDensityOptions: IDisplayDensityOptions
    • localeId: string
    • platform: PlatformUtil
    • Optional _diTransactions: TransactionService<Transaction, State>

    Returns IgxPivotGridComponent

Properties

activeNodeChange: EventEmitter<IActiveNodeChangeEventArgs> = ...

Emmited when the active node is changed.

Example

<igx-grid [data]="data" [autoGenerate]="true" (activeNodeChange)="activeNodeChange($event)"></igx-grid>
advancedFilteringExpressionsTreeChange: EventEmitter<IFilteringExpressionsTree> = ...

Emitted after advanced filtering is performed.

Remarks

Returns the advanced filtering expressions tree.

Example

<igx-grid #grid [data]="localData" [height]="'305px'" [autoGenerate]="true"
(advancedFilteringExpressionsTreeChange)="advancedFilteringExprTreeChange($event)"></igx-grid>
cdr: ChangeDetectorRef

Provides change detection functionality. A change-detection tree collects all views that are to be checked for changes. The property cannot be changed (readonly)

cellClick: EventEmitter<IGridCellEventArgs> = ...

Emitted when a cell is clicked.

Remarks

Returns the IgxGridCell.

Example

<igx-grid #grid (cellClick)="cellClick($event)" [data]="localData" [height]="'305px'" [autoGenerate]="true"></igx-grid>
clipboardOptions: IClipboardOptions = ...

Controls the copy behavior of the grid.

columnInit: EventEmitter<IgxColumnComponent> = ...

Emitted when a column is initialized.

Remarks

Returns the column object.

Example

<igx-grid #grid [data]="localData" (columnInit)="initColumns($event)" [autoGenerate]="true"></igx-grid>
columnResized: EventEmitter<IColumnResizeEventArgs> = ...

Emitted after column is resized.

Remarks

Returns the IgxColumnComponent object's old and new width.

Example

<igx-grid #grid [data]="localData" (columnResized)="resizing($event)" [autoGenerate]="true"></igx-grid>
columnSelectionChanging: EventEmitter<IColumnSelectionEventArgs> = ...

Emitted when IgxColumnComponent is selected.

Example

<igx-grid #grid (columnSelectionChanging)="columnSelectionChanging($event)" [data]="localData" [autoGenerate]="true"></igx-grid>
columnVisibilityChanged: EventEmitter<IColumnVisibilityChangedEventArgs> = ...

Emitted after column visibility is changed.

Remarks

Args: { column: IgxColumnComponent, newValue: boolean }

Example

<igx-grid (columnVisibilityChanged)="visibilityChanged($event)"></igx-grid>
columnVisibilityChanging: EventEmitter<IColumnVisibilityChangingEventArgs> = ...

Emitted before column visibility is changed.

Remarks

Args: { column: any, newValue: boolean }

Example

<igx-grid (columnVisibilityChanging)="visibilityChanging($event)"></igx-grid>
contextMenu: EventEmitter<IGridCellEventArgs> = ...

Emitted when a cell is right clicked.

Remarks

Returns the IgxGridCell object.

<igx-grid #grid [data]="localData" (contextMenu)="contextMenu($event)" [autoGenerate]="true"></igx-grid>
dataChanged: EventEmitter<any> = ...

Emitted after the grid's data view is changed because of a data operation, rebinding, etc.

Example

 <igx-grid #grid [data]="localData" [autoGenerate]="true" (dataChanged)='handleDataChangedEvent()'></igx-grid>
dataChanging: EventEmitter<IForOfDataChangingEventArgs> = ...

Emitted before the grid's data view is changed because of a data operation, rebinding, etc.

Example

 <igx-grid #grid [data]="localData" [autoGenerate]="true" (dataChanging)='handleDataChangingEvent()'></igx-grid>
densityChanged: EventEmitter<IDensityChangedEventArgs> = ...
dimensionInit: EventEmitter<IPivotDimension> = ...

Emitted when the dimension is initialized.

Remarks

Emits the dimension that is about to be initialized.

Example

<igx-pivot-grid #grid [data]="localData" [height]="'305px'"
(dimensionInit)="dimensionInit($event)"></igx-pivot-grid>
dimensionsChange: EventEmitter<IDimensionsChange> = ...

Emitted when the dimension collection is changed via the grid chip area.

Remarks

Returns the new dimension collection and its type:

Example

<igx-pivot-grid #grid [data]="localData" [height]="'305px'"
(dimensionsChange)="dimensionsChange($event)"></igx-grid>
dimensionsSortingExpressionsChange: EventEmitter<ISortingExpression<any>[]> = ...

Emitted when a dimension is sorted.

Example

<igx-pivot-grid #grid [data]="localData" [height]="'305px'"
(dimensionsSortingExpressionsChange)="dimensionsSortingExpressionsChange($event)"></igx-pivot-grid>
doubleClick: EventEmitter<IGridCellEventArgs> = ...

Emitted when a cell is double clicked.

Remarks

Returns the IgxGridCell object.

Example

<igx-grid #grid [data]="localData" (doubleClick)="dblClick($event)" [autoGenerate]="true"></igx-grid>
emptyGridTemplate: TemplateRef<void>

Gets/Sets a custom template when empty.

Example

<igx-grid [id]="'igx-grid-1'" [data]="Data" [emptyGridTemplate]="myTemplate" [autoGenerate]="true"></igx-grid>
emptyPivotGridTemplate: TemplateRef<void>

Gets/Sets a custom template when pivot grid is empty.

Example

<igx-pivot-grid [emptyPivotGridTemplate]="myTemplate"><igx-pivot-grid>
filtering: EventEmitter<IFilteringEventArgs> = ...

Emitted before filtering expressions are applied.

Remarks

Returns an IFilteringEventArgs object. filteringExpressions key holds the filtering expressions for the column.

Example

<igx-grid #grid [data]="localData" [height]="'305px'" [autoGenerate]="true" (filtering)="filtering($event)"></igx-grid>
filteringDone: EventEmitter<IFilteringExpressionsTree> = ...

Emitted after filtering is performed through the UI.

Remarks

Returns the filtering expressions tree of the column for which filtering was performed.

Example

<igx-grid #grid [data]="localData" [height]="'305px'" [autoGenerate]="true" (filteringDone)="filteringDone($event)"></igx-grid>
filteringExpressionsTreeChange: EventEmitter<IFilteringExpressionsTree> = ...

Emitted after filtering is performed.

Remarks

Returns the filtering expressions tree of the column for which filtering was performed.

Example

<igx-grid #grid [data]="localData" [height]="'305px'" [autoGenerate]="true"
(filteringExpressionsTreeChange)="filteringExprTreeChange($event)"></igx-grid>
formGroupCreated: EventEmitter<IGridFormGroupCreatedEventArgs> = ...

Emitted when formGroup is created on edit of row/cell.

Example

<igx-grid #grid (formGroupCreated)="formGroupCreated($event)" [data]="localData" [height]="'305px'" [autoGenerate]="true"></igx-grid>

Represents the grid service type providing API methods for the grid

gridCopy: EventEmitter<IGridClipboardEvent> = ...

Emitted when a copy operation is executed.

Remarks

Fired only if copy behavior is enabled through the [clipboardOptions]IgxGridBaseDirective#clipboardOptions.

gridKeydown: EventEmitter<IGridKeydownEventArgs> = ...

Emitted when keydown is triggered over element inside grid's body.

Remarks

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.

Example

 <igx-grid (gridKeydown)="customKeydown($event)"></igx-grid>
gridScroll: EventEmitter<IGridScrollEventArgs> = ...

Emitted when grid is scrolled horizontally/vertically.

Example

<igx-grid #grid [data]="localData" [height]="'305px'" [autoGenerate]="true"
(gridScroll)="onScroll($event)"></igx-grid>
lastSearchInfo: ISearchInfo = ...

Represents the last search information.

loadingGridTemplate: TemplateRef<void>

Gets/Sets a custom template when loading.

Example

<igx-grid [id]="'igx-grid-1'" [data]="Data" [loadingGridTemplate]="myTemplate" [autoGenerate]="true"></igx-grid>
navigation: IgxGridNavigationService
pivotConfigurationChange: EventEmitter<IPivotConfigurationChangedEventArgs> = ...

Emitted when any of the pivotConfiguration properties is changed via the grid chip area.

Example

<igx-pivot-grid #grid [data]="localData" [height]="'305px'"
(pivotConfigurationChanged)="configurationChanged($event)"></igx-grid>
primaryKey: any

Gets/Sets the primary key.

Example

<igx-grid #grid [data]="localData" [primaryKey]="'ProductID'" [autoGenerate]="true"></igx-grid>
rangeSelected: EventEmitter<GridSelectionRange> = ...

Emitted when making a range selection.

Remarks

Range selection can be made either through drag selection or through keyboard selection.

rendered: EventEmitter<boolean> = ...

Emitted after the ngAfterViewInit hook. At this point the grid exists in the DOM

rowClasses: any

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>

Memberof

IgxColumnComponent

rowClick: EventEmitter<IGridRowEventArgs> = ...

Emitted when a row is clicked.

Remarks

Returns the IgxGridRow.

Example

<igx-grid #grid (rowClick)="rowClick($event)" [data]="localData" [height]="'305px'" [autoGenerate]="true"></igx-grid>
rowSelectionChanging: EventEmitter<IRowSelectionEventArgs> = ...

Emitted when IgxGridRowComponent is selected.

Example

<igx-grid #grid (rowSelectionChanging)="rowSelectionChanging($event)" [data]="localData" [autoGenerate]="true"></igx-grid>
rowStyles: any = null

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>

Memberof

IgxColumnComponent

rowToggle: EventEmitter<IRowToggleEventArgs> = ...

Emitted when the expanded state of a row gets changed.

Example

<igx-grid [data]="employeeData" (rowToggle)="rowToggle($event)" [autoGenerate]="true"></igx-grid>
selected: EventEmitter<IGridCellEventArgs> = ...

Emitted when a cell is selected.

Remarks

Returns the IgxGridCell.

Example

<igx-grid #grid (selected)="onCellSelect($event)" [data]="localData" [height]="'305px'" [autoGenerate]="true"></igx-grid>
showPivotConfigurationUI: boolean = true
sorting: EventEmitter<ISortingEventArgs> = ...

Emitted before sorting expressions are applied.

Remarks

Returns an ISortingEventArgs object. sortingExpressions key holds the sorting expressions.

Example

<igx-grid #grid [data]="localData" [autoGenerate]="true" (sorting)="sorting($event)"></igx-grid>
sortingDone: EventEmitter<ISortingExpression<any> | ISortingExpression<any>[]> = ...

Emitted after sorting is completed.

Remarks

Returns the sorting expression.

Example

<igx-grid #grid [data]="localData" [autoGenerate]="true" (sortingDone)="sortingDone($event)"></igx-grid>
sortingExpressionsChange: EventEmitter<ISortingExpression<any>[]> = ...

Emitted before sorting is performed.

Remarks

Returns the sorting expressions.

Example

<igx-grid #grid [data]="localData" [autoGenerate]="true" (sortingExpressionsChange)="sortingExprChange($event)"></igx-grid>
uniqueColumnValuesStrategy: ((column, filteringExpressionsTree, done) => void)

Gets/Sets a unique values strategy used by the Excel Style Filtering

Remarks

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.

Example

<igx-grid [data]="localData" [filterMode]="'excelStyleFilter'" [uniqueColumnValuesStrategy]="columnValuesStrategy"></igx-grid>

Type declaration

    • (column, filteringExpressionsTree, done): void
    • Parameters

      Returns void

validation: IgxGridValidationService

Represents the validation service for the grid. The type contains properties and methods (logic) for validating records

validationStatusChange: EventEmitter<IGridValidationStatusEventArgs> = ...

Emitted when grid's validation status changes.

Example

<igx-grid #grid (validationStatusChange)="validationStatusChange($event)" [data]="localData" [height]="'305px'" [autoGenerate]="true"></igx-grid>
validationTrigger: GridValidationTrigger = 'change'

Gets/Sets the trigger for validators used when editing the grid.

Example

<igx-grid #grid validationTrigger='blur'></igx-grid>
valueChipTemplate: TemplateRef<IgxPivotGridValueTemplateContext>

Gets/Sets a custom template for the value chips.

Example

<igx-pivot-grid [valueChipTemplate]="myTemplate"><igx-pivot-grid>
valueInit: EventEmitter<IPivotValue> = ...

Emitted when the value is initialized.

Remarks

Emits the value that is about to be initialized.

Example

<igx-pivot-grid #grid [data]="localData" [height]="'305px'"
(valueInit)="valueInit($event)"></igx-pivot-grid>
valuesChange: EventEmitter<IValuesChange> = ...

Emitted when the values collection is changed via the grid chip area.

Remarks

Returns the new dimension

Example

<igx-pivot-grid #grid [data]="localData" [height]="'305px'"
(valuesChange)="valuesChange($event)"></igx-grid>

Accessors

Methods

  • If name is provided, clears the filtering state of the corresponding IgxColumnComponent.

    Remarks

    Otherwise clears the filtering state of all IgxColumnComponents.

    Example

    this.grid.clearFilter();
    

    Parameters

    • Optional name: string

    Returns void

  • Deselects all rows

    Remarks

    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.

    Example

    this.grid.deselectAllRows();
    

    Parameters

    • onlyFilterData: boolean = true

    Returns void

  • Filters all the IgxColumnComponent in the IgxGridComponent with the same condition.

    Example

    grid.filterGlobal('some', IgxStringFilteringOperand.instance().condition('contains'));
    

    Parameters

    • value: any
    • condition: any
    • Optional ignoreCase: any

    Returns void

  • Sets the --component-size CSS variable based on the value of Display Density

    Returns "var(--ig-size, var(--ig-size-small))" | "var(--ig-size, var(--ig-size-medium))" | "var(--ig-size, var(--ig-size-large))"

  • Returns the data that is contained in the row component.

    Remarks

    If the primary key is not specified the row selector match the row data.

    Example

    const data = grid.getRowData(94741);
    

    Parameters

    • rowSelector: any

      correspond to rowID

    Returns any

  • Returns an array of the current columns selection in the form of [{ column.field: cell.value }, ...].

    Remarks

    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 = false
    • headers: boolean = false

    Returns any[]

  • Returns an array of the current cell selection in the form of [{ column.field: cell.value }, ...].

    Remarks

    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 = false
    • headers: boolean = false

    Returns any[]

  • Inserts dimension in target collection by type at specified index or at the collection's end.

    Example

    this.grid.insertDimensionAt(dimension, PivotDimensionType.Row, 1);
    

    Parameters

    • dimension: IPivotDimension

      The dimension that will be added.

    • targetCollectionType: PivotDimensionType

      The target collection type to add to. Can be Row, Column or Filter.

    • Optional index: number

      The index in the collection at which to add. This parameter is optional. If not set it will add it to the end of the collection.

    Returns void

  • Inserts value at specified index or at the end.

    Example

    this.grid.insertValueAt(value, 1);
    

    Parameters

    • value: IPivotValue

      The value definition that will be added.

    • Optional index: number

      The index in the collection at which to add. This parameter is optional. If not set it will add it to the end of the collection.

    Returns void

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

    Example

    grid.markForCheck();
    

    Returns void

  • Move dimension from its currently collection to the specified target collection by type at specified index or at the collection's end.

    Example

    this.grid.moveDimension(dimension, PivotDimensionType.Row, 1);
    

    Parameters

    • dimension: IPivotDimension

      The dimension that will be moved.

    • targetCollectionType: PivotDimensionType

      The target collection type to move it to. Can be Row, Column or Filter.

    • Optional index: number

      The index in the collection at which to add. This parameter is optional. If not set it will add it to the end of the collection.

    Returns void

  • Navigates to a position in the grid based on provided rowindex and visibleColumnIndex.

    Remarks

    Also can execute a custom logic over the target element, through a callback function that accepts { targetType: GridKeydownTargetType, target: Object }

    Example

     this.grid.navigateTo(10, 3, (args) => { args.target.nativeElement.focus(); });
    

    Parameters

    • rowIndex: number
    • visibleColIndex: number = -1
    • cb: ((args) => void) = null
        • (args): void
        • Parameters

          • args: any

          Returns void

    Returns void

  • Selects all rows

    Remarks

    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.

    Example

    this.grid.selectAllRows();
    this.grid.selectAllRows(false);

    Parameters

    • onlyFilterData: boolean = true

    Returns void

  • Toggles the row by its id.

    Remarks

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

    Example

    this.grid.toggleRow(rowID);
    

    Parameters

    • rowID: any

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

    Returns void