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. Renders Angular templates for expandable detail rows.
createDetailRenderer(gridElement: HTMLElement): (row: TRow) => HTMLElement | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
gridElement | HTMLElement |
parseDetailElement()
Section titled “parseDetailElement()”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 | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
detailElement | Element |
createResponsiveCardRenderer()
Section titled “createResponsiveCardRenderer()”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 | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
gridElement | HTMLElement | The grid element to look up the template for |
Returns
Section titled “Returns”(row: TRow, rowIndex: number) => HTMLElement | undefined - A card renderer function or undefined if no template is found
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): TypeDefault<TRow> | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
type | string |
processGroupingColumnsConfig()
Section titled “processGroupingColumnsConfig()”Processes a GroupingColumnsConfig, converting component class references to actual renderer functions.
processGroupingColumnsConfig(config: GroupingColumnsConfig): GroupingColumnsConfigParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
config | GroupingColumnsConfig | Angular grouping columns configuration with possible component class references |
Returns
Section titled “Returns”GroupingColumnsConfig - Processed GroupingColumnsConfig with actual renderer functions
processGroupingRowsConfig()
Section titled “processGroupingRowsConfig()”Processes a GroupingRowsConfig, converting component class references to actual renderer functions.
processGroupingRowsConfig(config: GroupingRowsConfig): GroupingRowsConfigParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
config | GroupingRowsConfig | Angular grouping rows configuration with possible component class references |
Returns
Section titled “Returns”GroupingRowsConfig - Processed GroupingRowsConfig with actual renderer functions
processPinnedRowsConfig()
Section titled “processPinnedRowsConfig()”Processes a PinnedRowsConfig, converting component class references
in customPanels[].render to actual renderer functions.
processPinnedRowsConfig(config: PinnedRowsConfig): PinnedRowsConfigParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
config | PinnedRowsConfig | Angular pinned rows configuration with possible component class references |
Returns
Section titled “Returns”PinnedRowsConfig - Processed PinnedRowsConfig with actual renderer functions
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