-
-
Notifications
You must be signed in to change notification settings - Fork 19
Addons, Extensions (SlickGrid controls,plugins)
SlickGrid, the core library, has multiple controls and plugins that can be added to SlickGrid to provide more capabilities. They are really addons that can be added and there are a few (Column Picker, Header Menu, Grid Menu, Draggable Grouping, Row Detail, ...). Within Aurelia-Slickgrid you can add them just be enabling certain flags (enableColumnPicker
, enableGridMenu
, ...). All of these SlickGrid controls/plugins have dedicated SlickGrid classes (e.g. new Slick.Plugins.RowDetail()
) and so each addon is being instantiated, to get the instance reference then see below.
Addon, Controls, Plugins, Extensions... this is all confusing, what is what? So to know exactly what is what, I decided to use the following wordings
-
controls
are extra SlickGrid addon like: Column Picker, Grid Menu (the full list is here) -
plugins
are extra SlickGrid addon like: Cell Menu, Header Menu, Grid Menu, Draggable Grouping, Row Detail, ... (the full list is here) -
addon
is what I decided to represent as being bothcontrols
andplugins
together -
extension
is what I decided to represent as the class that I created in Aurelia-Slickgrid that will instantiate the addon- for example the
RowDetailViewExtension
will internally instantiate the SlickGrid addon viaaddonInstance = new Slick.Plugins.RowDetail()
- for example the
Sometime you maybe want to use some function of the addon, for example if we use the Row Detail in Aurelia-Slickgrid, we enable the flag enableRowDetailView: true
(which internally will call new Slick.Plugins.RowDetail()
) and we pass a few options through the rowDetailView
grid options... but what if we want to collapse all the rows? Aurelia-Slickgrid doesn't expose that directly but what you can do is get the addon instance and call the collapseAll()
from it.
We can get the addon instance in 3 different ways, you choose whichever is easier for you (we'll demo with the Row Detail addon). The Option 1 or Option 3 are probably the best way of getting the instance.
- use
onExtensionRegistered
from therowDetailView
grid options - use the
(asg-on-aurelia-grid-created)
and then usegetSlickgridAddonInstance()
- use the
(asg-on-aurelia-grid-created)
and reference the addon instance via theextensions.[addonName].instance
export class MyComponent {
rowDetailInstance: any;
columnDefinitions: Column[];
initGrid() {
this.gridOptions = {
enableRowDetailView: true,
rowDetailView: {
// ... other options
onExtensionRegistered: (addon) => this.rowDetailInstance = addon,
}
};
}
closeAllRowDetail() {
if (this.rowDetailInstance) {
this.rowDetailInstance.collapseAll();
}
}
}
<aurelia-slickgrid
grid-id="grid1"
column-definitions.bind="columnDefinitions"
grid-options.bind="gridOptions"
dataset.bind="dataset"
asg-on-aurelia-grid-created.delegate="aureliaGridReady($event.detail)">
</aurelia-slickgrid>
export class MyComponent {
rowDetailInstance: any;
aureliaGrid: AureliaGridInstance;
columnDefinitions: Column[];
aureliaGridReady(aureliaGrid: AureliaGridInstance) {
this.aureliaGrid= aureliaGrid;
this.rowDetailInstance = aureliaGrid.extensionService.getSlickgridAddonInstance(ExtensionName.rowDetailView);
}
initGrid() {
this.gridOptions = {
enableRowDetailView: true,
rowDetailView: {
// ... other options
}
};
}
closeAllRowDetail() {
if (this.rowDetailInstance) {
this.rowDetailInstance.collapseAll();
}
}
}
<aurelia-slickgrid
grid-id="grid1"
column-definitions.bind="columnDefinitions"
grid-options.bind="gridOptions"
dataset.bind="dataset"
asg-on-aurelia-grid-created.delegate="aureliaGridReady($event.detail)">
</aurelia-slickgrid>
export class MyComponent {
rowDetailInstance: any;
aureliaGrid: AureliaGridInstance;
columnDefinitions: Column[];
aureliaGridReady(aureliaGrid: AureliaGridInstance) {
this.aureliaGrid = aureliaGrid;
this.rowDetailInstance = aureliaGrid.extensions.rowDetailView.instance;
}
initGrid() {
this.gridOptions = {
enableRowDetailView: true,
rowDetailView: {
// ... other options
}
};
}
closeAllRowDetail() {
if (this.rowDetailInstance) {
this.rowDetailInstance.collapseAll();
}
}
}
Contents
- Aurelia-Slickgrid Wiki
- Installation
- Styling
- Interfaces/Models
- Testing Patterns
- Column Functionalities
- Global Grid Options
- Localization
- Events
- Grid Functionalities
- Auto-Resize / Resizer Service
- Resize by Cell Content
- Add/Delete/Update or Highlight item
- Dynamically Change Row CSS Classes
- Column Picker
- Composite Editor Modal
- Context Menu
- Custom Tooltip
- Excel Copy Buffer
- Export to Excel
- Export to File (CSV/Txt)
- Grid Menu
- Grid State & Presets
- Grouping & Aggregators
- Header Menu & Header Buttons
- Header Title Grouping
- Pinning (frozen) of Columns/Rows
- Row Colspan
- Row Detail
- Row Selection
- Tree Data Grid
- SlickGrid & DataView objects
- Addons (controls/plugins)
- Backend Services