Skip to main content

move-item

Description

Fires when moving a row

Usage

"move-item": ({ 
id: string | number,
target: string | number,
mode?:"before"|"after",
inProgress?: boolean,
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 moved
  • target - (required) the id of a new row where your row is moved
  • mode - (optional) the location where your row is moved: "before" - before the target row or "after" - after the target row
  • inProgress - (optional) defines if the process of moving is still in progress (true) or completed (false)
  • eventSource - (optional) the name of the Grid action that triggered move-item

Example

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

function App() {
const { data, columns } = getData();

function init(api) {
api.on("move-item", (ev) => {
console.log("Row that is moved:", ev.id);
});
}

return <Grid data={data} columns={columns} init={init} reorder />;
}

export default App;

Related articles: