Skip to main content

focus-cell

Description

Fires when a cell is given focus

Usage

"focusCell": ({
row?: string | number,
column?: string | number,
eventSource?: string,
}) => boolean|void;

Parameters

The callback of the action takes an object with the following parameters:

  • row - (optional) an id of the selected row
  • column - (optional) an id of the selected column
  • eventSource - (optional) the name of the Grid action used to trigger focusCell

Example

import { getData } from "../data";
import { Grid } from "@svar-ui/react-grid";

const { data, columns } = getData();

function init(api) {
api.on("focusCell", ev => {
console.log(`Cell in focus is in row: ${ev.row}, and triggered by ${ev.eventSource}`);
});
}

export default function App() {
return (
<div style={{ padding: 20 }}>
<div>
<Grid data={data} columns={columns} init={init} />
</div>
</div>
);
}

Related articles: