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 "@xbs/svelte-wx";
import { getData } from "./common/data";
const { data, columns } = getData();
import { Grid } from "../src/";

let api;

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

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

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

Related articles: