Readonly
propsStatic
Optional
contextIf set, this.context
will be set at runtime to the current value of the given Context.
Usage:
type MyContext = number
const Ctx = React.createContext<MyContext>(0)
class Foo extends React.Component {
static contextType = Ctx
context!: React.ContextType<typeof Ctx>
render () {
return <>My context's value: {this.context}</>;
}
}
Gets/Sets the advanced filtering state.
let advancedFilteringExpressionsTree = this.grid.advancedFilteringExpressionsTree;
this.grid.advancedFilteringExpressionsTree = logic;
Gets/Sets cell selection mode.
By default the cell selection mode is multiple selectionMode: GridSelectionMode
Controls the copy behavior of the 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 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 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;
}
}
Gets/Sets column selection mode
By default the row selection mode is none selectionMode: GridSelectionMode
Gets an array of IgxColumnComponent
s.
const colums = this.grid.columns.
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 a reference to the master-detail template.
let detailTemplate = this.grid.detailTemplate;
IgxColumnComponent
Gets the custom template, if any, used for row drag ghost.
The custom template, if any, that should be used when rendering the row drag indicator icon
Gets the excel style header icon.
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;
Emitted when a copy operation is executed.
Fired only if copy behavior is enabled through the [clipboardOptions
]IgxGridBaseDirective#clipboardOptions.
Emitted when a copy operation is executed.
Fired only if copy behavior is enabled through the [clipboardOptions
]IgxGridBaseDirective#clipboardOptions.
Gets the group by row selector template.
Gets/Sets the template reference for the group row.
const groupRowTemplate = this.grid.groupRowTemplate;
this.grid.groupRowTemplate = myRowTemplate;
Gets the hierarchical representation of the group by records.
let groupRecords = this.grid.groupsRecords;
Gets the header row selector template.
Gets the row collapse indicator template.
Gets the header expand indicator template.
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
Represents the last search information.
Gets/Sets the locale.
If not set, returns browser's language.
Controls whether columns moving is enabled in the grid.
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.
Emitted when making a range selection.
Range selection can be made either through drag selection or through keyboard selection.
Emitted when making a range selection.
Range selection can be made either through drag selection or through keyboard selection.
Emitted after the ngAfterViewInit hook. At this point the grid exists in the DOM
Emitted after the ngAfterViewInit hook. At this point the grid exists in the DOM
Gets/Sets the resource strings.
By default it uses EN resources.
Gets the row add text template.
Gets the row collapse indicator template.
Emitted when dropping a row.
Return the dropped row.
Emitted when dropping a row.
Return the dropped row.
Emitted when start dragging a row.
Return the dragged row.
Emitted when start dragging a row.
Return the dragged row.
Gets the row edit actions template.
Gets the row edit text template.
Gets the row expand indicator template.
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.
Gets/Sets whether clicking over a row should select/deselect it
By default it is set to true enabled: boolean
Returns an array of the selected IgxGridCell
s.
const selectedCells = this.grid.selectedCells;
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.
The custom template, if any, that should be used when rendering a header sorting indicator when columns are sorted in asc order.
The custom template, if any, that should be used when rendering a header sorting indicator when columns are sorted in desc order.
Gets custom template, if any, that should be used when rendering a header sorting indicator when columns are not sorted.
Get/Set IgxSummaryRow height
Emitted when an export process is initiated by the user.
toolbarExporting(event: IGridToolbarExportEventArgs){
const toolbarExporting = event;
}
Emitted when an export process is initiated by the user.
toolbarExporting(event: IGridToolbarExportEventArgs){
const toolbarExporting = event;
}
Gets/Sets the total number of records in the data source.
This property is required for remote grid virtualization to function when it is bound to remote data.
const itemCount = this.grid1.totalItemCount;
this.grid1.totalItemCount = 55;
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;
Optional
UNSAFE_Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
16.3, use componentDidMount or the constructor instead
Optional
UNSAFE_Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
16.3, use static getDerivedStateFromProps instead
Optional
UNSAFE_Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
16.3, use getSnapshotBeforeUpdate instead
Enters add mode by spawning the UI at the specified index.
Accepted values for index are integers from 0 to this.grid.dataView.length
this.grid.beginAddRowByIndex(0);
index - The index to spawn the UI at. Accepts integers from 0 to this.grid.dataView.length
Clears grouping for particular column, array of columns or all columns.
Clears all grouping in the grid, if no parameter is passed. If a parameter is provided, clears grouping for a particular column or an array of columns.
this.grid.clearGrouping(); //clears all grouping
this.grid.clearGrouping("ID"); //ungroups a single column
this.grid.clearGrouping(["ID", "Column1", "Column2"]); //ungroups multiple columns
name Name of column or array of column names to be ungrouped.
Collapses the row by its id.
ID is either the primaryKey value or the data record instance.
this.grid.collapseRow(rowID);
rowID The row id - primaryKey value or the data record instance.
Optional
componentOptional
componentCalled immediately after updating occurs. Not called for the initial render.
The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
Optional
componentCalled immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
16.3, use componentDidMount or the constructor instead; will stop working in React 17
Optional
componentCalled when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState
generally does not trigger this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
16.3, use static getDerivedStateFromProps instead; will stop working in React 17
Optional
componentOptional
componentCalled immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState
here.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
16.3, use getSnapshotBeforeUpdate instead; will stop working in React 17
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);
rowSelector
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();
onlyFilterData
Deselect all rows within a group. groupRow The group record which rows would be deselected.
public groupRow: IGroupByRecord;
this.grid.deselectRowsInGroup(this.groupRow);
Expands the row by its id.
ID is either the primaryKey value or the data record instance.
this.grid.expandRow(rowID);
rowID The row id - primaryKey value or the data record instance.
Expands the specified group and all of its parent groups. groupRow The group record to fully expand.
public groupRow: IGroupByRecord;
this.grid.fullyExpandGroup(this.groupRow);
Returns the IgxColumnComponent
by field name.
const myCol = this.grid1.getColumnByName("ID");
name
Gets the width
to be set on IgxGridHeaderGroupComponent
.
Gets calculated width of the pinned area.
const pinnedWidth = this.grid.getPinnedWidth();
takeHidden If we should take into account the hidden columns in the pinned area.
Returns the IgxGridRow
by index.
const myRow = grid.getRowByIndex(1);
index
Returns IgxGridRow
object by the specified primary key.
Requires that the primaryKey
property is set.
const myRow = this.grid1.getRowByKey("cell5");
keyValue
Get the currently selected ranges in the grid.
Optional
getRuns before React applies the result of render
to the document, and
returns an object to be given to componentDidUpdate. Useful for saving
things such as scroll position before render
causes changes to it.
Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.
Returns if a group is expanded or not. group The group record.
public groupRow: IGroupByRecord;
const expandedGroup = this.grid.isExpandedGroup(this.groupRow);
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();
Opens the advanced filtering dialog.
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);
onlyFilterData
Get current selected columns.
Returns an array with selected columns
const selectedColumns = this.grid.selectedColumns();
Toggles the expansion state of a group. groupRow The group record to toggle.
public groupRow: IGroupByRecord;
const toggleExpGroup = this.grid.toggleGroup(this.groupRow);
Toggles the row by its id.
ID is either the primaryKey value or the data record instance.
this.grid.toggleRow(rowID);
rowID The row id - primaryKey value or the data record instance.
Static
_create
If using the new style context, re-declare this in your class to be the
React.ContextType
of yourstatic contextType
. Should be used with type annotation or static contextType.