-
-
Notifications
You must be signed in to change notification settings - Fork 29
Grid & DataView Events
Ghislain B edited this page Jul 13, 2023
·
9 revisions
SlickGrid has a nice amount of Grid Events or DataView Events which you can use by simply hook a subscribe
to them (the subscribe
are a custom SlickGrid Event
and are NOT an RxJS Observable
type but they very similar). You can access them in Slickgrid-Universal by following the documentation below
<div class="grid1">
</div>
Hook yourself to the Changed event of the bindable grid object.
export class GridExample {
sgb;
attached() {
const dataset = this.initializeGrid();
const gridContainerElm = document.querySelector<HTMLDivElement>(`.grid1`);
gridContainerElm.addEventListener('oncellclicked', this.handleOnCellClicked.bind(this));
gridContainerElm.addEventListener('oncellchanged', this.handleOnCellChanged.bind(this));
this.sgb = new Slicker.GridBundle(gridContainerElm, this.columnDefinitions, this.gridOptions, dataset);
}
handleOnCellClicked(event) {
const args = event?.detail?.args;
const eventData = event?.detail?.eventData;
// cellClick event only returns row/cell, use DataView to get its context
const dataContext = this.sgb.dataView.getItem(args.row);
}
handleOnCellChanged(event) {
const args = event?.detail?.args;
const eventData = event?.detail?.eventData;
this.updatedObject = args.item;
this.sgb.resizerService.resizeGrid(10);
}
}
For SalesForce it's nearly the same, the only difference is that we add our events in the View instead of in the ViewModel
<div class="grid-container">
<div class="grid1"
onvalidationerror={handleOnValidationError}
oncellchange={handleOnCellChange}
onclick={handleOnCellClick}
onbeforeeditcell={handleOnBeforeEditVerifyCellIsEditable}
onslickergridcreated={handleOnSlickerGridCreated}>
</div>
</div>
- Slickgrid-Universal Wikis
- Installation
- Styling
- Interfaces/Models
- Column Functionalities
- Events
- Grid Functionalities
- Auto-Resize / Resizer Service
- Resize by Cell Content
- Column Picker
- Composite Editor Modal
- Custom Tooltip
- Context Menu
- Custom Footer
- Export to Excel
- Export to File (csv/txt)
- Grid Menu
- Grid State & Presets
- Grouping & Aggregators
- Header Menu & Header Buttons
- Pinning (frozen) of Columns/Rows
- Row Selection
- Tree Data Grid
- SlickGrid & DataView objects
- Backend Services