1818qx . Class . define ( "osparc.dashboard.SearchBarFilterExtended" , {
1919 extend : qx . ui . core . Widget ,
2020
21- construct : function ( sourceSearchBarFilter , resourceType ) {
22- this . __sourceSearchBarFilter = sourceSearchBarFilter ;
23- this . __resourceType = resourceType ;
24-
21+ construct : function ( sourceSearchBarFilter , resourceType , initFilterData = { } ) {
2522 this . base ( arguments , "searchBarFilter-" + resourceType , "searchBarFilter" ) ;
2623
2724 this . _setLayout ( new qx . ui . layout . VBox ( 10 ) ) ;
@@ -32,6 +29,10 @@ qx.Class.define("osparc.dashboard.SearchBarFilterExtended", {
3229 decorator : "rounded" ,
3330 } ) ;
3431
32+ this . __sourceSearchBarFilter = sourceSearchBarFilter ;
33+ this . __resourceType = resourceType ;
34+ this . __initFilterData = initFilterData ;
35+
3536 this . __buildLayout ( ) ;
3637
3738 // defaults to "My Projects"
@@ -75,14 +76,19 @@ qx.Class.define("osparc.dashboard.SearchBarFilterExtended", {
7576 _createChildControlImpl : function ( id ) {
7677 let control ;
7778 switch ( id ) {
78- case "search-bar-filter" :
79+ case "search-bar-filter" : {
7980 control = new osparc . dashboard . SearchBarFilter ( this . __resourceType ) ;
80- control . getChildControl ( "text-field" ) . addListener ( "appear" , ( ) => {
81- control . getChildControl ( "text-field" ) . focus ( ) ;
82- control . getChildControl ( "text-field" ) . activate ( ) ;
81+ const textField = control . getChildControl ( "text-field" ) ;
82+ if ( "text" in this . __initFilterData ) {
83+ textField . setValue ( this . __initFilterData [ "text" ] ) ;
84+ }
85+ textField . addListener ( "appear" , ( ) => {
86+ textField . focus ( ) ;
87+ textField . activate ( ) ;
8388 } ) ;
8489 this . _add ( control ) ;
8590 break ;
91+ }
8692 case "context-buttons" :
8793 control = new qx . ui . toolbar . ToolBar ( ) . set ( {
8894 spacing : 0 ,
0 commit comments