delete-row
Description
Fires when deleting a rowUsage
"delete-row": ({
id: string | number,
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 deleted -
eventSource- (optional) the name of the Grid action that triggereddelete-row
Returning false from the event handler will prevent deleting rows.
Example
<script setup>
import { getData } from "./common/data";
import { Grid } from "@svar-ui/vue-grid";
import { Button } from "@svar-ui/vue-core";
const { data, columns } = getData();
const api = ref(null);
const deleteRow = () => {
api.value.exec("delete-row", {
id: 17,
});
};
</script>
<template>
<Button :onclick="deleteRow" type="primary">Delete Row</Button>
<Grid :data="data" :columns="columns" ref="api" />
</template>
Related articles: