Skip to main content

redo

Description

Allows performing steps forward in history

It's required to enable the undo property to perform the action.

Usage

"redo": () => void;

Parameters

The callback of the action takes no parameters.

Example

We enable the redo action on a button click. The action cannot be executed in the tree mode.

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

import { useRef } from "react";
import { Button } from "@svar-ui/react-core";
import { Grid } from "@svar-ui/react-grid";
import { getData } from "../data";

const { data, columns } = getData();

export default function Example() {
const apiRef = useRef(null);

function redo() {
apiRef.current?.exec("redo");
}

return (
<>
<Button onClick={redo}>Redo</Button>

<div style={{ height: 400, marginTop: 10 }}>
<Grid ref={apiRef} data={data} columns={columns} undo />
</div>
</>
);
}

Related articles: