Skip to main content

copy-row

Description

Fires when a row is copied

Usage

"copy-row": ({
id: string | number,
target: string | number,
mode?: "before" | "after",
eventSource?: string,
}) => boolean | void;

Parameters

The callback of the action takes an object with the following parameters:

  • id — (required) the ID of the row being copied
  • target — (required) the ID of the target row
  • mode — (optional) the position where the copied row will be placed:
    • "before" — before the target row
    • "after" — after the target row (default)
  • eventSource — (optional) the name of the Grid action that triggered the copy-row event

Example

<script>
import { Grid } from "@svar-ui/svelte-grid";
import { getData } from "./common/data";
const { data, columns } = getData();

function init(api) {
api.on("copy-row", (ev) => {
console.log("Row that is copied:", ev.id);
});
}
</script>

<Grid {data} {columns} {init} />