diff --git a/packages/aurelia-slickgrid/src/extensions/__tests__/slickRowDetailView.spec.ts b/packages/aurelia-slickgrid/src/extensions/__tests__/slickRowDetailView.spec.ts index 9d7b0ee66..535e28ce4 100644 --- a/packages/aurelia-slickgrid/src/extensions/__tests__/slickRowDetailView.spec.ts +++ b/packages/aurelia-slickgrid/src/extensions/__tests__/slickRowDetailView.spec.ts @@ -88,7 +88,7 @@ const gridStub = { registerPlugin: jest.fn(), setSelectionModel: jest.fn(), sanitizeHtmlString: (s: string) => s, - onRendered: new SlickEvent(), + onColumnsReordered: new SlickEvent(), onSelectedRowsChanged: new SlickEvent(), onSort: new SlickEvent(), } as unknown as SlickGrid; @@ -176,7 +176,7 @@ describe('SlickRowDetailView', () => { columnsMock = [{ id: 'field1', field: 'field1', width: 100, cssClass: 'red' }]; jest.spyOn(gridStub, 'getOptions').mockReturnValue(gridOptionsMock); jest.clearAllMocks(); - gridStub.onRendered = new SlickEvent(); + gridStub.onColumnsReordered = new SlickEvent(); gridStub.onSort = new SlickEvent(); }); @@ -391,7 +391,7 @@ describe('SlickRowDetailView', () => { }); }); - it('should call Aurelia Util "createAureliaViewModelAddToSlot" when grid "onRendered" is triggered', (done) => { + it('should call Aurelia Util "createAureliaViewModelAddToSlot" when grid "onColumnsReordered" is triggered', (done) => { const mockColumn = { id: 'field1', field: 'field1', width: 100, cssClass: 'red', __collapsed: true }; const handlerSpy = jest.spyOn(plugin.eventHandler, 'subscribe'); // @ts-ignore:2345 @@ -401,7 +401,7 @@ describe('SlickRowDetailView', () => { plugin.onBeforeRowDetailToggle = new SlickEvent(); plugin.register(); plugin.eventHandler.subscribe(plugin.onBeforeRowDetailToggle, () => { - gridStub.onRendered.notify({ impactedColumns: [mockColumn] } as any, new SlickEventData(), gridStub); + gridStub.onColumnsReordered.notify({ impactedColumns: [mockColumn] } as any, new SlickEventData(), gridStub); expect(appendSpy).toHaveBeenCalledWith( ExampleLoader, expect.objectContaining({ model: mockColumn, addon: expect.anything(), grid: gridStub }), diff --git a/packages/aurelia-slickgrid/src/extensions/slickRowDetailView.ts b/packages/aurelia-slickgrid/src/extensions/slickRowDetailView.ts index 3f55ee4a5..9f12e7156 100644 --- a/packages/aurelia-slickgrid/src/extensions/slickRowDetailView.ts +++ b/packages/aurelia-slickgrid/src/extensions/slickRowDetailView.ts @@ -194,8 +194,8 @@ export class SlickRowDetailView extends UniversalSlickRowDetailView { // -- // hook some events needed by the Plugin itself - // redraw anytime the grid is re-rendered - this.eventHandler.subscribe(this._grid.onRendered, this.redrawAllViewSlots.bind(this)); + // we need to redraw the open detail views if we change column position (column reorder) + this._eventHandler.subscribe(this._grid.onColumnsReordered, this.redrawAllViewSlots.bind(this)); // on row selection changed, we also need to redraw if (this.gridOptions.enableRowSelection || this.gridOptions.enableCheckboxSelector) { @@ -208,7 +208,8 @@ export class SlickRowDetailView extends UniversalSlickRowDetailView { // on filter changed, we need to re-render all Views this._subscriptions.push( this.eventPubSubService?.subscribe('onFilterChanged', this.redrawAllViewSlots.bind(this)), - this.eventPubSubService?.subscribe(['onGridMenuClearAllFilters', 'onGridMenuClearAllSorting'], () => window.setTimeout(() => this.redrawAllViewSlots())), + this.eventPubSubService?.subscribe('onGridMenuClearAllFilters', () => window.setTimeout(() => this.redrawAllViewSlots())), + this.eventPubSubService?.subscribe('onGridMenuClearAllSorting', () => window.setTimeout(() => this.redrawAllViewSlots())), ); } }