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

import { Button } from "@xbs/react-wx";
import { getData } from "./common/data";
import { Grid } from "../src/";

const { data, columns } = getData();

export default function App() {
const api = useRef(null);

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

return (
<>
<button onClick={updateRow} >Update Row</button>
<Grid data={data} columns={columns} api={api} />
</>
);
}

Related articles: