GridAdapter
Methods
Section titled “Methods”processGridConfig()
Section titled “processGridConfig()”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>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
config | GridConfig<TRow> | Angular grid configuration with possible component class references |
Returns
Section titled “Returns”GridConfig<TRow> - Processed GridConfig with actual renderer/editor functions
processConfig()
Section titled “processConfig()”FrameworkAdapter.processConfig implementation.
Called automatically by the grid’s set gridConfig setter.
processConfig(config: GridConfig<TRow>): GridConfig<TRow>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
config | GridConfig<TRow> |
processTypeDefaults()
Section titled “processTypeDefaults()”Processes typeDefaults configuration, converting component class references to actual renderer/editor functions.
processTypeDefaults(typeDefaults: Record<string, TypeDefault<TRow>>): Record<string, BaseTypeDefault<TRow>>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
typeDefaults | Record<string, TypeDefault<TRow>> | Angular type defaults with possible component class references |
Returns
Section titled “Returns”Record<string, BaseTypeDefault<TRow>> - Processed TypeDefault record
processColumn()
Section titled “processColumn()”Processes a single column configuration, converting component class references to actual renderer/editor functions.
processColumn(column: ColumnConfig<TRow>): ColumnConfig<TRow>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
column | ColumnConfig<TRow> | Angular column configuration |
Returns
Section titled “Returns”ColumnConfig<TRow> - Processed ColumnConfig
canHandle()
Section titled “canHandle()”Determines if this adapter can handle the given element. Checks if a template is registered for this element (structural or nested).
canHandle(element: HTMLElement): booleanParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
element | HTMLElement |
createRenderer()
Section titled “createRenderer()”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> | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
element | HTMLElement |
createEditor()
Section titled “createEditor()”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> | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
element | HTMLElement |
createDetailRenderer()
Section titled “createDetailRenderer()”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 | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
gridElement | HTMLElement |
parseDetailElement()
Section titled “parseDetailElement()”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 | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
detailElement | Element |
createResponsiveCardRenderer()
Section titled “createResponsiveCardRenderer()”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 | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
gridElement | HTMLElement |
parseResponsiveCardElement()
Section titled “parseResponsiveCardElement()”FrameworkAdapter hook called by ResponsivePlugin during attach(). Delegates to createResponsiveCardRenderer (bridge installed by responsive feature).
parseResponsiveCardElement(cardElement: Element): (row: TRow, rowIndex: number) => HTMLElement | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
cardElement | Element |
createToolPanelRenderer()
Section titled “createToolPanelRenderer()”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 | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
element | HTMLElement |
getTypeDefault()
Section titled “getTypeDefault()”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> | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
type | string | |
_gridEl | HTMLElement |
processGroupingColumnsConfig()
Section titled “processGroupingColumnsConfig()”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): TConfigParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
config | TConfig |
processGroupingRowsConfig()
Section titled “processGroupingRowsConfig()”Processes a GroupingRowsConfig. Delegates to the feature config preprocessor
installed by @toolbox-web/grid-angular/features/grouping-rows.
processGroupingRowsConfig(config: TConfig): TConfigParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
config | TConfig |
processPinnedRowsConfig()
Section titled “processPinnedRowsConfig()”Processes a PinnedRowsConfig. Delegates to the feature config preprocessor
installed by @toolbox-web/grid-angular/features/pinned-rows.
processPinnedRowsConfig(config: TConfig): TConfigParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
config | TConfig |
releaseCell()
Section titled “releaseCell()”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): voidParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
cellEl | HTMLElement |
unmount()
Section titled “unmount()”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): voidParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
container | HTMLElement |
destroy()
Section titled “destroy()”Clean up all view references and component references. Call this when your app/component is destroyed.
destroy(): void