move-item
Description
Fires when moving a rowUsage
"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 movedtarget
- (required) the id of a new row where your row is movedmode
- (optional) 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)eventSource
- (optional) the name of the Grid action that triggeredmove-item
Example
<script>
import { Grid } from "@svar-ui/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: