How to change WAB widget window size?

12363
23
08-23-2016 07:55 AM
DanielChantlos1
Occasional Contributor

Is there a way I can modify code in WAB Developer Edition to change the size of the widget window for specific widgets in LaunchPad theme? I am using WAB Developer Edition 2.1

0 Kudos
23 Replies
MattReeves
New Contributor III

You are correct Robert.  The re-size works great. I didn't have it setup properly.
Thanks for all your help!

0 Kudos
Anish_Adhikari
Occasional Contributor

This has been super helpful for me. However, I wanted to modify it a bit and wanted the panel to open initially on default settings.  After user clicks on the map, I wanted the panel to resize to my specified size. I have added the code on the map click event listener and the window successfully resizes. Now I want to add some code to the onclose function that will return the panel to the default state and not resized. I wanted to do this because the window is taking too much screen real estate once the onclick event is initizlized.

I have declared my variable in startup function : 

var panel = this.getPanel();

Added These Lines on Startup event

panel.position.width = 820;
panel.setPosition(panel.position);
panel.panelManager.normalizePanel(panel);

Now not sure how to reset the panel to original size on close event

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Anish,

   In your startup function in the widget save the widgets original size to a widget var and then in the onClose function (you may have to add this function to the widget) get set the widgets size back to the original size var saved earlier.

GeoRig
by
New Contributor II

Probably quite late but in my case, I had to re-size the widget within the response part of function and could not get the panel details with 'this'. I modified the code a bit and below code helped me to set resize the widget.

// Re-size the widget
panel = _widgetManager.activeWidget.getPanel()   //With this line you can fetch the concerned widget
panel.position.width = 600;    // Set your width value
panel.setPosition(panel.position);
panel.panelManager.normalizePanel(panel);

 

Hope this helps!!!

Tags (1)
0 Kudos