Skip to main content

undo

Description

Allows performing steps back in history

It's required to enable the undo property to perfrom the action. The action cannot be executed in the tree mode.

Actions that can be undone: add-row, update-row, update-cell, delete-row, move-item, collapse-column, resize-column, hide-column.

Usage

["undo"]: () => void;

Parameters

The callback of the action takes no parameters.

Example

We enable the undo action on a button click.

<script>
import { Button } from "wx-svelte-core"; // import the Button component
import { Grid } from "wx-svelte-grid";
import { getData } from "../data";

const { data, columns } = getData();

let api = $state();

function undo() {
api.exec("undo");
}

</script>

<Button onclick={undo}>Undo</Button>

<div style="height: 400px; margin-top: 10px;">
<Grid
bind:this={api}
{data}
{columns}
undo={true}
/>
</div>

Related articles: