📙
Aurelia-Slickgrid
Live DemoGitHub
  • Introduction
  • Getting Started
    • Quick start
  • Styling
    • Dark Mode
    • Styling CSS/SASS/Themes
  • Column Functionalities
    • Cell Menu (Action Menu)
    • Editors
      • Autocomplete
      • old Date Picker (flatpickr)
      • new 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 & Footer Slots
    • 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 2.x (2018-06-23)
    • Migration Guide to 3.x (2020-12-20)
    • Migration Guide to 4.x (2021-12-11)
    • Migration Guide to 5.x (2022-10-18)
    • Migration Guide to 6.x (2023-05-29)
    • Migration Guide to 7.x (2023-12-15)
    • Migration Guide to 8.x (2024-05-10)
    • Migration Guide to 9.x (2025-05-10)
Powered by GitBook
On this page
Edit on GitHub
  1. Slick Grid/DataView Objects

Slick Grid/DataView Objects

Last updated 24 days ago

index

In some cases you might want a feature that is not yet available in Aurelia-Slickgrid but exists in the original SlickGrid, what should you do? Fear not, we got you covered. Aurelia-Slickgrid exposes the SlickGrid Grid and DataView objects through Event Aggregators, these objects are created when Aurelia-Slickgrid initialize the grid (with attached()). 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 AureliaGridInstance via the instances bindable as shown

Grid & DataView objects through AureliaGridCreated

Since version 2.x, we can now access the Slick Grid & DataView objects directly from the AureliaGridInstance through the on-aurelia-grid-created Event Dispatch, for example:

View

<span id="radioAutoEdit">
   <label class="radio-inline control-label" for="radioTrue">
       <input type="radio" name="inlineRadioOptions" id="radioTrue" checked value.bind="isAutoEdit" click.trigger="setAutoEdit(true)"> ON (single-click)
    </label>
    <label class="radio-inline control-label" for="radioFalse">
       <input type="radio" name="inlineRadioOptions" id="radioFalse" value.bind="isAutoEdit" click.trigger="setAutoEdit(false)"> OFF (double-click)
    </label>
</span>

<aurelia-slickgrid
      grid-id="grid1"
      columns.bind="columnDefinitions"
      options.bind="gridOptions"
      dataset.bind="dataset"
      on-aurelia-grid-created.trigger="aureliaGridReady($event.detail)">
</aurelia-slickgrid>

Component

import { AureliaGridInstance, Column, GridOption } from 'aurelia-slickgrid';

export class MyApp {
  aureliaGrid: AureliaGridInstance;
  columnDefinitions: Column[];
  gridOptions: GridOption;
  dataset: any[];
  isAutoEdit = true;
  gridObj: SlickGrid;
  dataViewObj: SlickDataView;


  aureliaGridReady(aureliaGrid: AureliaGridInstance) {
    this.aureliaGrid = aureliaGrid;

    // the Aurelia Grid Instance exposes both Slick Grid & DataView objects
    this.gridObj = aureliaGrid.slickGrid;
    this.dataViewObj = aureliaGrid.dataView;
  }

  /** Change dynamically `autoEdit` grid options */
  setAutoEdit(isAutoEdit) {
    this.isAutoEdit = isAutoEdit;
    this.gridObj.setOptions({ autoEdit: isAutoEdit }); // change the grid option dynamically
    return true;
  }

  collapseAllGroups() {
    this.dataviewObj.collapseAllGroups();
  }

  expandAllGroups() {
    this.dataviewObj.expandAllGroups();
  }
}

Grid & DataView objects & Services through instances bindable

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

<aurelia-slickgrid grid-id="grid19"
    columns.bind="columnDefinitions"
    options.bind="gridOptions"
    dataset.bind="dataset"
    extensions.bind="extensions"
    instances.bind="aureliaGrid">
</aurelia-slickgrid>

Component

import { AureliaGridInstance, Column, GridOption } from 'aurelia-slickgrid';

export class MyApp {
  aureliaGrid: AureliaGridInstance;

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

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

Wiki - Grid & DataView Events
Wiki - Grid & DataView Events
Grid, DataView objects through AureliaGridCreated
Grid, DataView objects & Services via instances bindable
here