scroll
Description
Fires when scrollingUsage
"scroll": ({
column?: string | number,
row?: string | number
}) => boolean | void;
Parameters
The callback of the action takes an object with the following parameters:
column
- (optional) the id of a column the table is scrolled torow
- (optional) the id of a row the table is scrolled to
Returning false from the event handler will block scrolling withing the table.
Example
The example below shows how to enable scrolling to the first row and column on a button click.
<script>
import { Button } from "wx-svelte-core";
import { Grid } from "wx-svelte-grid";
import { repeatData, repeatColumns } from "./common/data";
const data = repeatData(1000);
const columns = repeatColumns(100);
let api;
function doScroll(row, column) {
api.exec("scroll", { row, column });
}
</script>
<Button type="primary" click={() => doScroll(data[4].id, columns[4].id)}>
Scroll to First Row / Column
</Button>
<Grid bind:api {data} {columns} />
Related articles: