If using the new style context, re-declare this in your class to be the
React.ContextType
of your static contextType
.
Should be used with type annotation or static contextType.
static contextType = MyContext
// For TS pre-3.7:
context!: React.ContextType<typeof MyContext>
// For TS 3.7 and above:
declare context: React.ContextType<typeof MyContext>
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}</>;
}
}
Returns a reference to the bodyTemplate
.
let bodyTemplate = this.column.bodyTemplate;
IgxColumnComponent
A list containing all the child columns under this column (if any). Empty without children or if this column is not Group or Layout.
Use the childColumns
property instead.
Allows you to define a custom template for expand/collapse indicator
IgxColumnGroupComponent
Returns a boolean indicating if the column is a ColumnGroup
.
let columnGroup = this.column.columnGroup;
IgxColumnComponent
Returns a boolean indicating if the column is a ColumnLayout
for multi-row layout.
let columnGroup = this.column.columnGroup;
IgxColumnComponent
Returns a boolean indicating if the column is a child of a ColumnLayout
for multi-row layout.
let columnLayoutChild = this.column.columnLayoutChild;
IgxColumnComponent
Gets whether the hiding is disabled.
let isHidingDisabled = this.column.disableHiding;
IgxColumnComponent
Gets whether the pinning is disabled.
let isPinningDisabled = this.column.disablePinning;
IgxColumnComponent
Gets whether the column is editable.
Default value is false
.
let isEditable = this.column.editable;
IgxColumnComponent
Returns a reference to the validation error template.
let errorTemplate = this.column.errorTemplate;
Returns a reference to the filterCellTemplate
.
let filterCellTemplate = this.column.filterCellTemplate;
IgxColumnComponent
Returns the filteringExpressionsTree of the column.
let tree = this.column.filteringExpressionsTree;
IgxColumnComponent
Gets the column filters
.
let columnFilters = this.column.filters'
IgxColumnComponent
Applies display format to cell values in the column. Does not modify the underlying data.
Note: As the formatter is used in places like the Excel style filtering dialog, in certain
scenarios (remote filtering for example), the row data argument can be undefined
.
In this example, we check to see if the column name is Salary, and then provide a method as the column formatter
to format the value into a currency string.
columnInit(column: IgxColumnComponent) {
if (column.field == "Salary") {
column.formatter = (salary => this.format(salary));
}
}
format(value: number) : string {
return formatCurrency(value, "en-us", "$");
}
const column = this.grid.getColumnByName('Address');
const addressFormatter = (address: string, rowData: any) => data.privacyEnabled ? 'unknown' : address;
column.formatter = addressFormatter;
IgxColumnComponent
Applies display format to cell values in the column. Does not modify the underlying data.
Note: As the formatter is used in places like the Excel style filtering dialog, in certain
scenarios (remote filtering for example), the row data argument can be undefined
.
In this example, we check to see if the column name is Salary, and then provide a method as the column formatter
to format the value into a currency string.
columnInit(column: IgxColumnComponent) {
if (column.field == "Salary") {
column.formatter = (salary => this.format(salary));
}
}
format(value: number) : string {
return formatCurrency(value, "en-us", "$");
}
const column = this.grid.getColumnByName('Address');
const addressFormatter = (address: string, rowData: any) => data.privacyEnabled ? 'unknown' : address;
column.formatter = addressFormatter;
IgxColumnComponent
Gets a value indicating whether the summary for the column is enabled.
let hasSummary = this.column.hasSummary;
IgxColumnComponent
Returns a reference to the header template.
let headerTemplate = this.column.headerTemplate;
IgxColumnComponent
Gets whether the column is hidden.
let isHidden = this.column.hidden;
IgxColumnComponent
Gets the column index.
let columnIndex = this.column.index;
IgxColumnComponent
Returns a reference to the inline editor template.
let inlineEditorTemplate = this.column.inlineEditorTemplate;
IgxColumnComponent
Returns the level of the column in a column group.
Returns 0
if the column doesn't have a parent
.
let columnLevel = this.column.level;
IgxColumnComponent
Sets/gets the parent column.
let parentColumn = this.column.parent;
this.column.parent = higherLevelColumn;
IgxColumnComponent
Gets whether the column is pinned
.
let isPinned = this.column.pinned;
IgxColumnComponent
Returns if the column is selectable.
let columnSelectable = this.column.selectable;
IgxColumnComponent
Returns if the column is selected.
let isSelected = this.column.selected;
IgxColumnComponent
Gets the column sortStrategy
.
let sortStrategy = this.column.sortStrategy
IgxColumnComponent
Gets the column summaries
.
let columnSummaries = this.column.summaries;
IgxColumnComponent
Returns a reference to the summaryTemplate
.
let summaryTemplate = this.column.summaryTemplate;
IgxColumnComponent
Returns a reference to the top level parent column.
let topLevelParent = this.column.topLevelParent;
Gets the column visible index.
If the column is not visible, returns -1
.
let visibleColumnIndex = this.column.visibleIndex;
IgxColumnComponent
Gets the width
of the column.
let columnWidth = this.column.width;
IgxColumnComponent
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
Autosize the column to the longest currently visible cell value, including the header cell.
@ViewChild('grid') grid: IgxGridComponent;
let column = this.grid.columnList.filter(c => c.field === 'ID')[0];
column.autosize();
IgxColumnComponent byHeaderOnly Set if column should be autosized based only on the header content.
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
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.
Moves a column to the specified visible index. If passed index is invalid, or if column would receive a different visible index after moving, moving is not performed. If passed index would move the column to a different column group. moving is not performed.
column.move(index);
IgxColumnComponent
Pins the column at the provided index in the pinned area.
Defaults to index 0
if not provided, or to the initial index in the pinned area.
Returns true
if the column is successfully pinned. Returns false
if the column cannot be pinned.
Column cannot be pinned if:
let success = this.column.pin();
IgxColumnComponent
Unpins the column and place it at the provided index in the unpinned area.
Defaults to index 0
if not provided, or to the initial index in the unpinned area.
Returns true
if the column is successfully unpinned. Returns false
if the column cannot be unpinned.
Column cannot be unpinned if:
let success = this.column.unpin();
IgxColumnComponent
Static
_create
Ignite UI for Angular Column Group
Igx Parent
IgxGridComponent, IgxTreeGridComponent, IgxHierarchicalGridComponent, IgxColumnGroupComponent, IgxRowIslandComponent