📗
Slickgrid-Vue
Live DemoGitHub
  • Introduction
  • Getting Started
    • Quick start
  • Styling
    • Dark Mode
    • Styling CSS/SASS/Themes
  • Column Functionalities
    • Cell Menu (Action Menu)
    • Editors
      • Autocomplete
      • Date Picker (vanilla-calendar)
      • LongText (textarea)
      • Select Dropdown Editor (single/multiple)
    • Filters
      • Autocomplete
      • Input Filter (default)
      • Select Filter (dropdown)
      • Compound Filters
      • Range Filters
      • Custom Filter
      • Styling Filled Filters
      • Single Search Filter
    • Formatters
    • Sorting
  • Events
    • Available events
    • On Events
  • Slick Grid/DataView Objects
    • Slick Grid/DataView Objects
  • Grid Functionalities
    • Auto-Resize / Resizer Service
    • Resize by Cell Content
    • Column Picker
    • Composite Editor Modal
    • Custom Tooltip
    • Add, Update or Highlight a Datagrid Item
    • Dynamically Add CSS Classes to Item Rows
    • Column & Row Spanning
    • Context Menu
    • Custom Footer
    • Excel Copy Buffer Plugin
    • Export to Excel
    • Export to File (csv/txt)
    • Grid Menu
    • Grid State & Presets
    • Grouping & Aggregators
    • Header Menu & Header Buttons
    • Infinite Scroll
    • Pinning (frozen) of Columns/Rows
    • Providing data to the grid
    • Row Detail
    • Row Selection
    • Tree Data Grid
    • Row Based Editing Plugin
  • Developer Guides
    • CSP Compliance
  • Localization
    • with I18N
    • with Custom Locales
  • Backend Services
    • Custom Backend Service
    • OData
    • GraphQL
      • JSON Result Structure
      • Filtering Schema
      • Pagination Schema
      • Sorting Schema
  • Testing
    • Testing Patterns
  • Migrations
    • Migration Guide to 9.x (2025-05-10)
Powered by GitBook
On this page
  1. Slick Grid/DataView Objects

Slick Grid/DataView Objects

PreviousOn EventsNextAuto-Resize / Resizer Service

Last updated 1 month ago

index

In some cases you might want a feature that is not yet available in slickgrid-vue but exists in the original SlickGrid, what should you do? Fear not, we got you covered. slickgrid-vue exposes the SlickGrid Grid and DataView objects through Event Aggregators, these objects are created when slickgrid-vue initialize the grid (with defineGrid()). So if you subscribe to the Event Aggregator, you will get the SlickGrid and DataView objects and from there you can call any of the SlickGrid features.

The preferred way is now to use the SlickgridVueInstance via the instances bindable as shown

Grid & DataView objects through vueGridCreated

Since version 2.x, we can now access the Slick Grid & DataView objects directly from the SlickgridVueInstance through the onvueGridCreated Event Dispatch, for example:

Component

<script setup lang="ts">
import { type Column, Filters, Formatters, OperatorType, SlickgridVue, SlickgridVueInstance } from 'slickgrid-vue';
import { onBeforeMount, type Ref } from 'vue';

const gridOptions = ref<GridOption>();
const columnDefinitions: Ref<Column[]> = ref([]);
const dataset = ref<any[]>([]);
const isAutoEdit = ref(true);
let vueGrid: SlickgridVueInstance;

onBeforeMount(() => {
  defineGrid();
});

function defineGrid() {}

function vueGridReady(vGrid: SlickgridVueInstance) {
  vueGrid = vGrid;
}

/** Change dynamically `autoEdit` grid options */
function setAutoEdit(autoEdit) {
  isAutoEdit.value = autoEdit;
  vueGrid.grid?.setOptions({ autoEdit }); // change the grid option dynamically
  return true;
}

function collapseAllGroups() {
  vueGrid.dataView?.collapseAllGroups();
}

function expandAllGroups() {
  vueGrid.dataView?.expandAllGroups();
}
</script>

<template>
  <div id="demo-container" class="container-fluid">
    <div class="col-sm-6">
      <label class="me-1">autoEdit setting:</label>
      <span id="radioAutoEdit">
        <label class="radio-inline control-label me-1" htmlFor="radioTrue">
          <input
            type="radio"
            name="inlineRadioOptions"
            id="radioTrue"
            defaultChecked={this.state.isAutoEdit}
            @input="setAutoEdit(true)"
          />
          ON (single-click)
        </label>
        <label class="radio-inline control-label" htmlFor="radioFalse">
          <input
            type="radio"
            name="inlineRadioOptions"
            id="radioFalse"
            @input="setAutoEdit(false)"
          />
          OFF (double-click)
        </label>
      </span>
    </div>

    <div class="col-sm-12">
      <SlickgridVue
        grid-id="grid3"
        v-model:columns="columnDefinitions"
        v-model:options="gridOptions"
        v-model:data="dataset"
        onvueGridCreated="vueGridReady(e.detail)"
        onCellChange="onCellChanged(e.detail.eventData, e.detail.args)"
        onClick="onCellClicked(e.detail.eventData, e.detail.args)"
        onValidationError="onCellValidationError(e.detail.eventData, e.detail.args)"
      />
    </div>
  </div>
</template>

Grid & DataView objects & Services through instances bindable

You could also get all the Service instances via the new instances bindable property

Component

<script setup lang="ts">
import { SlickgridVueInstance, Column, GridOption } from 'slickgrid-vue';

let vueGrid: SlickgridVueInstance;

function vueGridReady(vGrid: SlickgridVueInstance) {
  vueGrid = vGrid;
}

/** Change dynamically `autoEdit` grid options */
function setAutoEdit(isAutoEdit) {
  this.isAutoEdit = isAutoEdit;
  this.vueGrid.slickGrid.setOptions({ autoEdit: isAutoEdit }); // change the grid option dynamically
  return true;
}
</script>

<template>
  <SlickgridVue
    grid-id="grid1"
    v-model:columns="columnDefinitions"
    v-model:options="gridOptions"
    v-model:data="dataset"
    @onVueGridCreated="vueGridReady($event.detail)"
  />
</template>

SlickGrid Events (original SlickGrid)

Usage

You have access to all original SlickGrid events which you can subscribe, for more info refer to the

There's already all the necessary information on how to use this on the page, so I suggest you to head over to that Wiki page on how to use the SlickGrid and DataView objects

Docs - Grid & DataView Events
Docs - Grid & DataView Events
Grid, DataView objects through vueGridCreated
Grid, DataView objects & Services via instances bindable
here