# UndoRedoMethods

Undo/Redo methods returned from injectGridUndoRedo.

Uses lazy discovery - the grid is found on first method call, not during initialization.

## Properties

| Property | Type | Description |
| -------- | ---- | ----------- |
| <span id="undo"></span>`undo` | <code>() =&gt; <a href="/grid/plugins/undo-redo/types/undoredoaction/">UndoRedoAction</a> &#124; unknown</code> | Undo the last edit action. |
| <span id="redo"></span>`redo` | <code>() =&gt; <a href="/grid/plugins/undo-redo/types/undoredoaction/">UndoRedoAction</a> &#124; unknown</code> | Redo the last undone action. |
| `canUndo` | <code>Signal&lt;boolean&gt;</code> | Reactive signal indicating whether undo is available. Updates automatically when edits are made, undone, redone, or history is cleared. |
| `canRedo` | <code>Signal&lt;boolean&gt;</code> | Reactive signal indicating whether redo is available. Updates automatically when edits are made, undone, redone, or history is cleared. |
| <span id="clearhistory"></span>`clearHistory` | <code>() =&gt; void</code> | Clear all undo/redo history. |
| <span id="getundostack"></span>`getUndoStack` | <code>() =&gt; <a href="/grid/plugins/undo-redo/types/undoredoaction/">UndoRedoAction</a>[]</code> | Get a copy of the current undo stack. |
| <span id="getredostack"></span>`getRedoStack` | <code>() =&gt; <a href="/grid/plugins/undo-redo/types/undoredoaction/">UndoRedoAction</a>[]</code> | Get a copy of the current redo stack. |
| <span id="recordedit"></span>`recordEdit` | <code>(rowIndex: number, field: string, oldValue: unknown, newValue: unknown, rowId: string) =&gt; void</code> | Manually record an edit action. If a transaction is active, the action is buffered; otherwise it's pushed to the undo stack. Pass `rowId` (since 2.6.2) — e.g. `cell-commit`'s `detail.rowId` — when the row may not be in the view; otherwise it is resolved from `rowIndex`. |
| <span id="begintransaction"></span>`beginTransaction` | <code>() =&gt; void</code> | Begin a transaction. All edits recorded until `endTransaction()` are grouped into a single compound action for undo/redo. |
| <span id="endtransaction"></span>`endTransaction` | <code>() =&gt; void</code> | End the active transaction and push the compound action to the undo stack. If only one edit was recorded, it's pushed as a plain EditAction. If no edits were recorded, the transaction is discarded. |
| <span id="isready"></span>`isReady` | <code>Signal&lt;boolean&gt;</code> | Signal indicating if grid is ready. |

### Property Details

#### `canUndo`

```typescript
// In template:
// <button [disabled]="!undoRedo.canUndo()">Undo</button>

// In computed:
readonly undoAvailable = computed(() => this.undoRedo.canUndo());
```

---

#### `canRedo`

```typescript
// In template:
// <button [disabled]="!undoRedo.canRedo()">Redo</button>

// In computed:
readonly redoAvailable = computed(() => this.undoRedo.canRedo());
```

---
