injectGridExport
Angular inject function for programmatic export control.
Uses lazy grid discovery - the grid element is found when methods are called, not during initialization. This ensures it works reliably with:
- Lazy-rendered tabs
- Conditional rendering (*ngIf)
- Dynamic component loading
injectGridExport(selector: string): ExportMethodsParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
selector | string | Optional CSS selector to target a specific grid element. |
Defaults to 'tbw-grid' (first grid in the component). Use when the | ||
component contains multiple grids, e.g. 'tbw-grid.primary' or '#my-grid'. |
Example
Section titled “Example”import { Component } from '@angular/core';import { Grid } from '@toolbox-web/grid-angular';import '@toolbox-web/grid-angular/features/export';import { injectGridExport } from '@toolbox-web/grid-angular/features/export';
@Component({ selector: 'app-my-grid', imports: [Grid], template: ` <button (click)="handleExport()">Export CSV</button> <tbw-grid [rows]="rows" [export]="true"></tbw-grid> `})export class MyGridComponent { gridExport = injectGridExport();
handleExport() { this.gridExport.exportToCsv('employees.csv'); }}
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