Skip to content

GridAdapter

Processes an Angular grid configuration, converting component class references to actual renderer/editor functions.

Call this method on your gridConfig before passing it to the grid.

processGridConfig(config: GridConfig<TRow>): GridConfig<TRow>
NameTypeDescription
configGridConfig<TRow>Angular grid configuration with possible component class references

GridConfig<TRow> - Processed GridConfig with actual renderer/editor functions


FrameworkAdapter.processConfig implementation. Called automatically by the grid’s set gridConfig setter.

processConfig(config: GridConfig<TRow>): GridConfig<TRow>
NameTypeDescription
configGridConfig<TRow>

Processes typeDefaults configuration, converting component class references to actual renderer/editor functions.

processTypeDefaults(typeDefaults: Record<string, TypeDefault<TRow>>): Record<string, BaseTypeDefault<TRow>>
NameTypeDescription
typeDefaultsRecord<string, TypeDefault<TRow>>Angular type defaults with possible component class references

Record<string, BaseTypeDefault<TRow>> - Processed TypeDefault record


Processes a single column configuration, converting component class references to actual renderer/editor functions.

processColumn(column: ColumnConfig<TRow>): ColumnConfig<TRow>
NameTypeDescription
columnColumnConfig<TRow>Angular column configuration

ColumnConfig<TRow> - Processed ColumnConfig


Determines if this adapter can handle the given element. Checks if a template is registered for this element (structural or nested).

canHandle(element: HTMLElement): boolean
NameTypeDescription
elementHTMLElement

Creates a view renderer function that creates an embedded view from the registered template and returns its DOM element.

Returns undefined if no template is registered for this element, allowing the grid to use its default rendering.

createRenderer(element: HTMLElement): ColumnViewRenderer<TRow, TValue> | undefined
NameTypeDescription
elementHTMLElement

Creates an editor spec that creates an embedded view.

Auto-wiring: The adapter automatically listens for commit and cancel CustomEvents on the rendered component. If the component emits these events, the adapter will call the grid’s commit/cancel functions automatically.

This means templates can be simplified from:

<app-editor *tbwEditor="let value; onCommit as onCommit"
[value]="value" (commit)="onCommit($event)" />

To just:

<app-editor *tbwEditor="let value" [value]="value" />

As long as the component emits (commit) with the new value.

createEditor(element: HTMLElement): ColumnEditorSpec<TRow, TValue> | undefined
NameTypeDescription
elementHTMLElement

Creates a detail renderer function for MasterDetailPlugin. Renders Angular templates for expandable detail rows.

createDetailRenderer(gridElement: HTMLElement): (row: TRow) => HTMLElement | undefined
NameTypeDescription
gridElementHTMLElement

Framework adapter hook called by MasterDetailPlugin during attach(). Parses the <tbw-grid-detail> element and returns an Angular template-based renderer.

This enables MasterDetailPlugin to automatically use Angular templates without manual configuration in the Grid directive.

parseDetailElement(detailElement: Element): (row: TRow, rowIndex: number) => string | HTMLElement | undefined
NameTypeDescription
detailElementElement

Creates a responsive card renderer function for ResponsivePlugin. Renders Angular templates for card layout in responsive mode.

createResponsiveCardRenderer(gridElement: HTMLElement): (row: TRow, rowIndex: number) => HTMLElement | undefined
NameTypeDescription
gridElementHTMLElementThe grid element to look up the template for

(row: TRow, rowIndex: number) => HTMLElement | undefined - A card renderer function or undefined if no template is found


Creates a tool panel renderer from a light DOM element. The renderer creates an Angular template-based panel content.

createToolPanelRenderer(element: HTMLElement): (container: HTMLElement) => void | () => void | undefined
NameTypeDescription
elementHTMLElement

Gets type-level defaults from the application’s GridTypeRegistry.

This enables application-wide type defaults configured via provideGridTypeDefaults(). The returned TypeDefault contains renderer/editor functions that instantiate Angular components dynamically.

getTypeDefault(type: string): TypeDefault<TRow> | undefined
NameTypeDescription
typestring

Processes a GroupingColumnsConfig, converting component class references to actual renderer functions.

processGroupingColumnsConfig(config: GroupingColumnsConfig): GroupingColumnsConfig
NameTypeDescription
configGroupingColumnsConfigAngular grouping columns configuration with possible component class references

GroupingColumnsConfig - Processed GroupingColumnsConfig with actual renderer functions


Processes a GroupingRowsConfig, converting component class references to actual renderer functions.

processGroupingRowsConfig(config: GroupingRowsConfig): GroupingRowsConfig
NameTypeDescription
configGroupingRowsConfigAngular grouping rows configuration with possible component class references

GroupingRowsConfig - Processed GroupingRowsConfig with actual renderer functions


Processes a PinnedRowsConfig, converting component class references in customPanels[].render to actual renderer functions.

processPinnedRowsConfig(config: PinnedRowsConfig): PinnedRowsConfig
NameTypeDescription
configPinnedRowsConfigAngular pinned rows configuration with possible component class references

PinnedRowsConfig - Processed PinnedRowsConfig with actual renderer functions


Called when a cell’s content is about to be wiped (e.g., exiting edit mode, scroll-recycling a row, or rebuilding a row).

Destroys any editor embedded views or component refs whose DOM is inside the given cell element. This prevents memory leaks from orphaned Angular views that would otherwise stay in the change detection tree indefinitely.

releaseCell(cellEl: HTMLElement): void
NameTypeDescription
cellElHTMLElement

Unmount a specific container (e.g., detail panel, tool panel). Finds the matching view or component ref whose DOM nodes are inside the container and properly destroys it to prevent memory leaks.

unmount(container: HTMLElement): void
NameTypeDescription
containerHTMLElement

Clean up all view references and component references. Call this when your app/component is destroyed.

destroy(): void

AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://raw.githubusercontent.com/OysteinAmundsen/toolbox/main/llms-full.txt