This repository was archived by the owner on Jun 1, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +25
-5
lines changed
src/slickgrid-react/extensions Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -139,11 +139,14 @@ export class SlickRowDetailView extends UniversalSlickRowDetailView {
139139 this . _preloadRoot ?. unmount ( ) ;
140140
141141 // triggers after backend called "onAsyncResponse.notify()"
142- this . renderViewModel ( args ?. item ) ;
143-
144- if ( typeof this . rowDetailViewOptions ?. onAsyncEndUpdate === 'function' ) {
145- this . rowDetailViewOptions . onAsyncEndUpdate ( event , args ) ;
146- }
142+ // because of the preload destroy above, we need a small delay to make sure the DOM element is ready to render the Row Detail
143+ queueMicrotask ( ( ) => {
144+ this . renderViewModel ( args ?. item ) ;
145+
146+ if ( typeof this . rowDetailViewOptions ?. onAsyncEndUpdate === 'function' ) {
147+ this . rowDetailViewOptions . onAsyncEndUpdate ( event , args ) ;
148+ }
149+ } ) ;
147150 } ) ;
148151
149152 this . _eventHandler . subscribe ( this . onAfterRowDetailToggle , async ( event , args ) => {
Original file line number Diff line number Diff line change @@ -346,4 +346,21 @@ describe('Example 19 - Row Detail View', () => {
346346 . find ( '.slick-cell + .dynamic-cell-detail .innerDetailView_101' )
347347 . should ( 'not.exist' ) ;
348348 } ) ;
349+
350+ it ( 'should expect the Row Detail to be re-rendered after expanding/collapsing multiple times' , ( ) => {
351+ cy . get ( '#grid19' ) . find ( '.slick-row:nth(1) .slick-cell:nth(0)' ) . as ( 'toggle1' ) ;
352+ cy . get ( '@toggle1' ) . click ( ) ;
353+ cy . get ( '@toggle1' ) . click ( ) ;
354+ cy . get ( '@toggle1' ) . click ( ) ;
355+
356+ cy . get ( '#grid19' ) . find ( '.slick-cell + .dynamic-cell-detail .innerDetailView_1' ) . as ( 'detailContainer' ) ;
357+ cy . get ( '@detailContainer' ) . find ( 'h3' ) . contains ( 'Task 1' ) ;
358+
359+ cy . get ( '@toggle1' ) . click ( ) ;
360+ cy . get ( '@detailContainer' ) . should ( 'not.exist' ) ;
361+
362+ cy . get ( '@toggle1' ) . click ( ) ;
363+ cy . get ( '#grid19' ) . find ( '.slick-cell + .dynamic-cell-detail .innerDetailView_1' ) . as ( 'detailContainer' ) ;
364+ cy . get ( '@detailContainer' ) . find ( 'h3' ) . contains ( 'Task 1' ) ;
365+ } ) ;
349366} ) ;
You can’t perform that action at this time.
0 commit comments