Solved! Go to Solution.
Naty,
It depends on if it is an onscreen widget or a widget in the widgetpool.
Here is the code that works for onscreen widget:
Require
'jimu/PanelManager', PanelManager, var pm = PanelManager.getInstance(); pm.closePanel(this.appConfig.widgetOnScreen.widgets[4]);//close the 5th widget in the config.json inside the widgetOnScreen object //or pm.closePanel(pm.activePanel);//close the active panel
Naty,
It depends on if it is an onscreen widget or a widget in the widgetpool.
Here is the code that works for onscreen widget:
Require
'jimu/PanelManager', PanelManager, var pm = PanelManager.getInstance(); pm.closePanel(this.appConfig.widgetOnScreen.widgets[4]);//close the 5th widget in the config.json inside the widgetOnScreen object //or pm.closePanel(pm.activePanel);//close the active panel
I have been trying to close a widget when my custom widget is opened. I have used your solution above, but because the widget that I am trying to close resided in the widget pool, I have changed
pm.closePanel(this.appConfig.widgetOnScreen.widgets[4])
to
pm.closePanel(this.appConfig.widgetPool.widgets[1]);
I keep getting an error that reads:
TypeError: panel.setState is not a function
The widget is an "In-Panel" widget.
Would you have any idea as to why I am getting this error?
Thank You!
Chris
Chris,
What theme are you using? A screen shot would really help.