# applyTransaction

Adds, updates, and removes source rows by stable ID. Inspect results separately from app server saving.

Canonical: https://grid.syidax.com/docs/methods/applyTransaction/

<a id="meaning"></a>

## What does this API do?

Adds, updates, and removes source rows by stable ID. Inspect results separately from app server saving.

<a id="contract"></a>

## Exact input and result types

```typescript
applyTransaction(transaction: RowDataTransaction<GridRow>, label?: string, opts?: { source?: GridEditSource; origin?: unknown }): Promise<ApplyRowTransactionResult<GridRow>>
```

| Arguments | Required | Type |
| --- | --- | --- |
| transaction | Required | RowDataTransaction<GridRow> |
| label | Optional | string |
| opts | Optional | { source?: GridEditSource; origin?: unknown } |

The return type is `Promise<ApplyRowTransactionResult<GridRow>>`.

<a id="usage"></a>

## Usage flow

After registering and initializing the Grid element, call grid.applyTransaction(…). Read the return value with await. For methods returning a boolean or report, inspect the result before continuing.

<a id="types"></a>

## Read related types

- [RowDataTransaction](https://grid.syidax.com/docs/types/RowDataTransaction.md)
- [GridRow](https://grid.syidax.com/docs/types/GridRow.md)
- [GridEditSource](https://grid.syidax.com/docs/types/GridEditSource.md)
- [ApplyRowTransactionResult](https://grid.syidax.com/docs/types/ApplyRowTransactionResult.md)

<a id="recipes"></a>

## Feature explanations and examples

- [Data updates](https://grid.syidax.com/docs/features/data-updates.md) — Replace rowData when receiving a complete query result. For partial changes, pass add, update, and remove to applyTransaction. Updates match through getRowId, not display positions.
