Skip to main content

scroll

Description

Fires when scrolling

Usage

"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 to
  • row - (optional) the id of a row the table is scrolled to

Returning false from the event handler will block scrolling within the table.

Example

The example below shows how to enable scrolling to the first row and column on a button click.

<script setup>
import { Button } from "@svar-ui/vue-core";
import { Grid } from "@svar-ui/vue-grid";
import { repeatData, repeatColumns } from "./common/data";

const data = repeatData(1000);
const columns = repeatColumns(100);

const api = ref(null);
function doScroll(row, column) {
api.value.exec("scroll", { row, column });
}
</script>

<Button type="primary" :onclick="() => doScroll(data[4].id, columns[4].id)">
Scroll to First Row / Column
</Button>

<Grid ref="api" :data="data" :columns="columns" />

Related articles: