@@ -296,7 +296,7 @@ qx.Class.define("osparc.vipMarket.VipMarket", {
296296 const found = this . __anatomicalModels . find ( model => model [ "modelId" ] === modelId ) ;
297297 if ( found ) {
298298 found [ "purchases" ] . push ( purchaseData ) ;
299- this . __populateModels ( ) ;
299+ this . __populateModels ( modelId ) ;
300300 anatomicModelDetails . setAnatomicalModelsData ( found ) ;
301301 }
302302 } )
@@ -317,7 +317,7 @@ qx.Class.define("osparc.vipMarket.VipMarket", {
317317 . catch ( err => console . error ( err ) ) ;
318318 } ,
319319
320- __populateModels : function ( ) {
320+ __populateModels : function ( selectModelId ) {
321321 const models = this . __anatomicalModels ;
322322
323323 this . __anatomicalModelsModel . removeAll ( ) ;
@@ -358,6 +358,18 @@ qx.Class.define("osparc.vipMarket.VipMarket", {
358358 sortModel ( sortBy ) ;
359359 models . forEach ( model => this . __anatomicalModelsModel . append ( qx . data . marshal . Json . createModel ( model ) ) ) ;
360360 } , this ) ;
361+
362+ // select model after timeout, there is something that changes the selection to empty after populating the list
363+ setTimeout ( ( ) => {
364+ const modelsUIList = this . getChildControl ( "models-list" ) ;
365+ if ( selectModelId ) {
366+ const entryFound = modelsUIList . getSelectables ( ) . find ( entry => "getModelId" in entry && entry . getModelId ( ) === selectModelId ) ;
367+ modelsUIList . setSelection ( [ entryFound ] ) ;
368+ } else if ( modelsUIList . getSelectables ( ) . length ) {
369+ // select first
370+ modelsUIList . setSelection ( [ modelsUIList . getSelectables ( ) [ 0 ] ] ) ;
371+ }
372+ } , 100 ) ;
361373 } ,
362374
363375 __sendImportModelMessage : function ( modelId ) {
0 commit comments