move-item
Description
Fires when moving a rowUsage
"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 movedtarget
- (required) the id of a new row where your row is movedmode
- (required) the location where your row is moved: "before" - before the target row or "after" - after the target rowinProgress
- (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: