delete-row
Description
Fires when deleting a rowUsage
"delete-row": ({
id: string | number
}) = > 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
Returning false from the event handler will prevent deleting rows.
Example
import { getData } from "./common/data";
import { Grid } from "wx-react-grid";
const { data, columns } = getData();
export default function App() {
const api = useRef(null);
const deleteRow = () => {
api.current.exec("delete-row", {
id: 17,
});
};
return (
<>
<button onClick={deleteRow} >Delete Row</button>
<Grid data={data} columns={columns} api={api} />
</>
);
}
Related articles: