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. Delegates to the bridge installed by @toolbox-web/grid-angular/features/master-detail. Returns undefined if the feature is not imported or no <tbw-grid-detail> template is registered for this grid.

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

FrameworkAdapter hook called by MasterDetailPlugin during attach(). Delegates to createDetailRenderer (bridge installed by master-detail feature).

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

Creates a responsive card renderer function for ResponsivePlugin. Delegates to the bridge installed by @toolbox-web/grid-angular/features/responsive.

createResponsiveCardRenderer(gridElement: HTMLElement): (row: TRow, rowIndex: number) => HTMLElement | undefined
NameTypeDescription
gridElementHTMLElement

FrameworkAdapter hook called by ResponsivePlugin during attach(). Delegates to createResponsiveCardRenderer (bridge installed by responsive feature).

parseResponsiveCardElement(cardElement: Element): (row: TRow, rowIndex: number) => HTMLElement | undefined
NameTypeDescription
cardElementElement

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, _gridEl: HTMLElement): TypeDefault<TRow> | undefined
NameTypeDescription
typestring
_gridElHTMLElement

Processes a GroupingColumnsConfig. Delegates to the feature config preprocessor installed by @toolbox-web/grid-angular/features/grouping-columns, which handles converting Angular component class references to actual renderer functions. Returns the input config unchanged if the feature is not imported.

processGroupingColumnsConfig(config: TConfig): TConfig
NameTypeDescription
configTConfig

Processes a GroupingRowsConfig. Delegates to the feature config preprocessor installed by @toolbox-web/grid-angular/features/grouping-rows.

processGroupingRowsConfig(config: TConfig): TConfig
NameTypeDescription
configTConfig

Processes a PinnedRowsConfig. Delegates to the feature config preprocessor installed by @toolbox-web/grid-angular/features/pinned-rows.

processPinnedRowsConfig(config: TConfig): TConfig
NameTypeDescription
configTConfig

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