AnsweredAssumed Answered

Open a widget in its own panel (dialog)

Question asked by hali@lmkt.com on Jun 5, 2016
Latest reply on Jun 8, 2016 by hali@lmkt.com

I have added a button on it's click i want to open a widget as a dialog. i am using below code to open a widget

 

 

var wconfig =

{

            "name": "Draw",

            "label": "Draw",

            "version": "2.0.1",

            "uri": "widgets/Draw/Widget",

            "config": "configs/Draw/config_Draw.json",

            "index": 6,

            "id": "widgets_Draw_Widget"

          };

 

this.widgetManager.loadWidget(wconfig).then(lang.hitch(this, function(widget) {

            widget.startup(); 

            this.widgetManager.openWidget(widget);

   }));

 

 

 

In the console it says widget [widgets/Draw/Widget] created. but i can't see the widget.

 

If i use this._getPanel(wconfig,true) the widget display in left panel

 

_getPanel: function(widgetCfg, start) { 

   var def = new Deferred(); 

   var panel; 

 

   if (widgetCfg) { 

  // Try getting the panel for this widget 

  panel = registry.byId(widgetCfg.id + '_panel'); 

  

  if (panel) { 

   def.resolve(panel); 

  } else { 

   this.panelManager.showPanel(widgetCfg).then(function(panel) { 

  if (start) { 

   panel.startup(); 

  } 

  def.resolve(panel); 

   }); 

  } 

   } else { 

  def.resolve(undefined); 

   } 

   return def; 

  }

 

Any Idea what i am doing wrong here

Outcomes