Skip to main content

hide-column

Description

Fires when hiding a column

Usage

"hide-column": ({
id: string,
mode?: boolean,
eventSource?: string,
}) => boolean|void;

Parameters

The callback of the action takes an object with the following parameters:

  • id - (required) the ID of a column that is hidden
  • mode - (optional) if set to true, hides a column; if false, a column is shown
  • eventSource - (optional) the name of the Grid action that triggered hide-column

Returning false from the event handler will block hiding a column.

Example

<script setup>
import { getData } from "./common/data";
import { Grid } from "@svar-ui/vue-grid";
import { Button } from "@svar-ui/vue-core";
const { data, columns } = getData();

const api = ref(null);

const hideColumn = () => {
api.value.exec("hide-column", { id: "firstName", mode: true });
};
</script>

<template>
<Button :onclick="hideColumn" type="primary">Hide</Button>

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

Related articles: