Skip to main content

update-row

Description

Fires when updating a row### Usage
"update-row": ({
id: string | number,
row: {}
}) => boolean|void;

Parameters

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

  • id - (required) the ID of a row that is updated
  • row - (required) an object with new data for a row

Returning false from the event handler will block updating data in rows.

Example

<script>
import { Button } from "@wx/svelte-core";
import { getData } from "./common/data";
import { Grid } from "../src/";

const { data, columns } = getData();

let api;
const updateRow = () => {
api.exec("update-row", {
id: 11,
row: { city: "New City", firstName: "New name", lastName: "new name" },
});
};
</script>

<Button onclick={updateRow} type="primary">Update Row</Button>

<Grid {data} {columns} bind:this={api} />

Related articles: