Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/slickgrid-react/extensions/slickRowDetailView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,14 @@ export class SlickRowDetailView extends UniversalSlickRowDetailView {
this._preloadRoot?.unmount();

// triggers after backend called "onAsyncResponse.notify()"
this.renderViewModel(args?.item);

if (typeof this.rowDetailViewOptions?.onAsyncEndUpdate === 'function') {
this.rowDetailViewOptions.onAsyncEndUpdate(event, args);
}
// because of the preload destroy above, we need a small delay to make sure the DOM element is ready to render the Row Detail
queueMicrotask(() => {
this.renderViewModel(args?.item);

if (typeof this.rowDetailViewOptions?.onAsyncEndUpdate === 'function') {
this.rowDetailViewOptions.onAsyncEndUpdate(event, args);
}
});
});

this._eventHandler.subscribe(this.onAfterRowDetailToggle, async (event, args) => {
Expand Down
17 changes: 17 additions & 0 deletions test/cypress/e2e/example19.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,4 +346,21 @@ describe('Example 19 - Row Detail View', () => {
.find('.slick-cell + .dynamic-cell-detail .innerDetailView_101')
.should('not.exist');
});

it('should expect the Row Detail to be re-rendered after expanding/collapsing multiple times', () => {
cy.get('#grid19').find('.slick-row:nth(1) .slick-cell:nth(0)').as('toggle1');
cy.get('@toggle1').click();
cy.get('@toggle1').click();
cy.get('@toggle1').click();

cy.get('#grid19').find('.slick-cell + .dynamic-cell-detail .innerDetailView_1').as('detailContainer');
cy.get('@detailContainer').find('h3').contains('Task 1');

cy.get('@toggle1').click();
cy.get('@detailContainer').should('not.exist');

cy.get('@toggle1').click();
cy.get('#grid19').find('.slick-cell + .dynamic-cell-detail .innerDetailView_1').as('detailContainer');
cy.get('@detailContainer').find('h3').contains('Task 1');
});
});