# 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 |
| -------- | ---- | ----------- |
| `undo` | <code>() =&gt; <a href="/grid/plugins/undo-redo/types/undoredoaction/">UndoRedoAction</a> &#124; unknown</code> | Undo the last edit action. |
| `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. |
| `clearHistory` | <code>() =&gt; void</code> | Clear all undo/redo history. |
| `getUndoStack` | <code>() =&gt; <a href="/grid/plugins/undo-redo/types/undoredoaction/">UndoRedoAction</a>[]</code> | Get a copy of the current undo stack. |
| `getRedoStack` | <code>() =&gt; <a href="/grid/plugins/undo-redo/types/undoredoaction/">UndoRedoAction</a>[]</code> | Get a copy of the current redo stack. |
| `recordEdit` | <code>(rowIndex: number, field: string, oldValue: unknown, newValue: unknown) =&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. |
| `beginTransaction` | <code>() =&gt; void</code> | Begin a transaction. All edits recorded until `endTransaction()` are grouped into a single compound action for undo/redo. |
| `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. |
| `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());
```

---
