diff --git a/src/plugins/slick.cellselectionmodel.ts b/src/plugins/slick.cellselectionmodel.ts index 30607593..90a46b48 100644 --- a/src/plugins/slick.cellselectionmodel.ts +++ b/src/plugins/slick.cellselectionmodel.ts @@ -111,9 +111,9 @@ export class SlickCellSelectionModel { this._ranges = this.removeInvalidRanges(ranges); if (rangeHasChanged) { - // provide extra "caller" argument through SlickEventData to avoid breaking pubsub event that only accepts an array of selected range - const eventData = new SlickEventData(null, this._ranges); - Object.defineProperty(eventData, 'detail', { writable: true, configurable: true, value: { caller: caller || 'SlickCellSelectionModel.setSelectedRanges' } }); + // provide extra "caller" argument through SlickEventData event to avoid breaking the previous pubsub event structure + // that only accepts an array of selected range `SlickRange[]`, the SlickEventData args will be merged and used later by `onSelectedRowsChanged` + const eventData = new SlickEventData(new CustomEvent('click', { detail: { caller } }), this._ranges); this.onSelectedRangesChanged.notify(this._ranges, eventData); } } diff --git a/src/plugins/slick.rowselectionmodel.ts b/src/plugins/slick.rowselectionmodel.ts index 5611ae8d..c8b2ca25 100644 --- a/src/plugins/slick.rowselectionmodel.ts +++ b/src/plugins/slick.rowselectionmodel.ts @@ -141,9 +141,9 @@ export class SlickRowSelectionModel { } this._ranges = ranges; - // provide extra "caller" argument through SlickEventData to avoid breaking pubsub event that only accepts an array of selected range - const eventData = new SlickEventData(null, this._ranges); - Object.defineProperty(eventData, 'detail', { writable: true, configurable: true, value: { caller: caller || 'SlickRowSelectionModel.setSelectedRanges' } }); + // provide extra "caller" argument through SlickEventData event to avoid breaking the previous pubsub event structure + // that only accepts an array of selected range `SlickRange[]`, the SlickEventData args will be merged and used later by `onSelectedRowsChanged` + const eventData = new SlickEventData(new CustomEvent('click', { detail: { caller } }), this._ranges); this.onSelectedRangesChanged.notify(this._ranges, eventData); }