update-row
Description
Fires when updating a rowUsage
"update-row": ({
id: string | number,
row: Record<string, any>,
eventSource?: string,
}) => boolean | void;
Parameters
The callback of the action takes an object with the following parameters:
id- (required) the ID of a row that is updatedrow- (required) the new row dataeventSource- (optional) the name of the Grid action that triggeredupdate-row
Returning false from the event handler will block updating data in rows.
Example
<script setup>
import { Button } from "@svar-ui/vue-core";
import { getData } from "./common/data";
import { Grid } from "@svar-ui/vue-grid";
const { data, columns } = getData();
const api = ref(null);
const updateRow = () => {
api.value.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="data" :columns="columns" ref="api" />
Related articles: