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,
}) => 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 - (required) 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)

Example

<script>
import { Grid } from "wx-svelte-grid";
import { getData } from "./common/data";
const { data, columns } = getData();

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

<Grid {data} {columns} {init} reorder />

Related articles: