Open a widget in its own panel (dialog)

4670
10
Jump to solution
06-05-2016 06:06 AM
Haider_Ali
Occasional Contributor

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

0 Kudos
10 Replies
Haider_Ali
Occasional Contributor

sorry for not mentioning screen size   before thanks

0 Kudos