# SyGridApi

Fields, allowed values, and APIs that use SyGridApi.

Canonical: https://grid.syidax.com/docs/types/SyGridApi/

<a id="definition"></a>

## Type definition

A question mark (?) marks an optional field; readonly marks a value you should not change directly. A union (|) accepts one of the listed forms. Functions are callbacks that Grid invokes at the relevant point.

```typescript
export interface SyGridApi<
  TData = GridData,
  TContext = unknown,
  TValue = unknown,
  TFilterModel = unknown,
> extends HTMLElement,
    SyGridImperativeMethods<TData, TContext, TValue, TFilterModel> {
  rowData?: TData[];
  columnDefs?: Array<GridColumnDefinition<TData, TContext, TValue>>;
  context?: TContext;
  getRowId?: GridGetRowId<TData>;
  components?: GridComponentLocalDefinitions<
    TData,
    TValue,
    TFilterModel,
    TContext
  >;
  externalFilter?:
    | GridExternalFilterCallbacks<TData>
    | GridExternalFilterInstance<TData, TContext>;
  componentTimeoutMs?: number;
  addEventListener<K extends keyof SyGridEventMap<TData, TContext, TValue>>(
    type: K,
    listener:
      | SyGridEventListener<
          SyGridEventMap<TData, TContext, TValue>[K],
          TData,
          TContext,
          TValue
        >
      | null,
    options?: boolean | AddEventListenerOptions,
  ): void;
  addEventListener(
    type: string,
    listener: EventListenerOrEventListenerObject | null,
    options?: boolean | AddEventListenerOptions,
  ): void;
  removeEventListener<K extends keyof SyGridEventMap<TData, TContext, TValue>>(
    type: K,
    listener:
      | SyGridEventListener<
          SyGridEventMap<TData, TContext, TValue>[K],
          TData,
          TContext,
          TValue
        >
      | null,
    options?: boolean | EventListenerOptions,
  ): void;
  removeEventListener(
    type: string,
    listener: EventListenerOrEventListenerObject | null,
    options?: boolean | EventListenerOptions,
  ): void;
}
```

<a id="used-by"></a>

## APIs using this type

- [getApi](https://grid.syidax.com/docs/methods/getApi.md) — Accesses the current Grid's typed API and app context. Read from a fully initialized element.

<a id="parents"></a>

## Contracts containing this type

- [CellCallbackParams](https://grid.syidax.com/docs/types/CellCallbackParams.md)
- [SyGridCustomEvent](https://grid.syidax.com/docs/types/SyGridCustomEvent.md)
- [SyGridEventListener](https://grid.syidax.com/docs/types/SyGridEventListener.md)
- [SyGridImperativeMethods](https://grid.syidax.com/docs/types/SyGridImperativeMethods.md)
- [ValueFormatterParams](https://grid.syidax.com/docs/types/ValueFormatterParams.md)
- [ValueGetterParams](https://grid.syidax.com/docs/types/ValueGetterParams.md)
- [ValueParserParams](https://grid.syidax.com/docs/types/ValueParserParams.md)
- [ValueSetterParams](https://grid.syidax.com/docs/types/ValueSetterParams.md)

<a id="related"></a>

## Related types

- [GridData](https://grid.syidax.com/docs/types/GridData.md)
- [SyGridImperativeMethods](https://grid.syidax.com/docs/types/SyGridImperativeMethods.md)
- [GridColumnDefinition](https://grid.syidax.com/docs/types/GridColumnDefinition.md)
- [GridGetRowId](https://grid.syidax.com/docs/types/GridGetRowId.md)
- [GridComponentLocalDefinitions](https://grid.syidax.com/docs/types/GridComponentLocalDefinitions.md)
- [GridExternalFilterCallbacks](https://grid.syidax.com/docs/types/GridExternalFilterCallbacks.md)
- [GridExternalFilterInstance](https://grid.syidax.com/docs/types/GridExternalFilterInstance.md)
- [SyGridEventMap](https://grid.syidax.com/docs/types/SyGridEventMap.md)
- [SyGridEventListener](https://grid.syidax.com/docs/types/SyGridEventListener.md)
