I am developing a widget where as per client resolution I want to change widget state like minimize and maximize. However I have followed following documentation but still no help.
Close widget programmatically—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers
I have followed the WidgetManager class but not able to work with that class.
Ameya,
Can ou post the code that you have tried? Are you using the Tab theme or the foldable theme?
Initially I have tried to to use WidgetManager class, because in that class there are two methods one is maximizeWidget and another is minimizeWidget. However I have access them on my function but nothing widget is not minimizing or maximizing. Therefore I have looked for the code for minimizing and maximizing button the widget panel and I have found following code which is giving me auto minimize and maximize functionality in my widget .
this.panelManager.getPanelById(this.id + '_panel').onTitleClick();
I have the same question.
I have tried Widget Manager's minimizeWidget and maximizeWidget methods and see no use of those methods. Using
this.panelManager.getPanelById(this.id + '_panel').onTitleClick();
is an alternate to achieve this for foldable theme, but the same does not work for tabbed theme. Any help in understanding how to do this is appreciated.
Thanks in advance.
Try this:
this.panelManager.closePanel(this.id + '_panel'); // To close the panel this.panelManager.showPanel(this.id + '_panel'); // To show the panel this.panelManager.minimizePanel(this.id + '_panel'); // To minimize the panel this.panelManager.maximizePanel(this.id + '_panel'); // To maximize the panel
Larry
Thanks for your inputs on this Larry.
As said by Ameya in his description earlier I have tried using minimizePanel and maximizePanel as suggested in Close widget programmatically—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers.
But that didn't help, also the alternate titleClick works only for foldable theme and not for other themes and floating place holders.
It's an issue that panelManager.minimizePanel() doesn't work, we'll fix it in next release.
About how to minimize/maximize widget/panel programmatically?
You can have a look at the minimizeWidget() function in widgetManager, it's very simple. It just change the widget's window state and call widget's onMinimize() function. So, it's widget's job to minimize itself in it's onMinimize() function. Panel has the similar design pattern.
For off-panel widget, you should use widgetManager.minimizeWidget(widgetId);
For in-panel widget, you should use panelManager.minimizePanel(panelId);
panelId=widgetId + '_panel', you can also use widget.getPanel() to get widget's panel in next release.