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
I have tried both suggestions: placing latest code in startup and onOpen functions. Neither overcome the resize handle issue. I'm testing this on WAB 2.1 with Chrome and IE 10.
I'm curious if danielchantlos has experienced the same thing. Anyone else?
This is what my onOpen function looks like (in Widget.js):
onOpen: function () {
var panel = this.getPanel();
panel.position.width = 300;
panel.position.height = 300;
panel.setPosition(panel.position);
panel.panelManager.normalizePanel(panel);
console.log('onOpen');
},
Phil,
I just copy/pasted your code into my Widget.js as is after the Startup function, and I have no resize/reverting issue. In fact, this is exactly what I was looking for!
Thank you Robert and Phil!
Nice! I'm glad that is working for you. There must be something else going with my code. I think I'll disable the resize handle for now. Thanks for both of your help.
Here is what I am experiencing if anyone is curious:
link: Imgur
Phil,
I did not test making the widget smaller then the default original size for that you will have to have this in the startup function:
var panel = this.getPanel();
panel.position.width = 300;
panel.position.height = 300;
panel._originalBox = {
w: panel.position.width,
h: panel.position.height,
l: panel.position.left || 0,
t: panel.position.top || 0
};
panel.setPosition(panel.position);
panel.panelManager.normalizePanel(panel);
and the onOpen function just the way you have it.
Robert you are the guru. Thank you. Your latest suggestion is working.
I added this to onOpen and I'm not seeing any issues. So, I only have panel resize code in onOpen, not in startup. Do you anticipate that this would be a problem? Seems fine in testing.
Where is the documentation for getPanel()/setPosition()/normalizePanel()? I can't find anything from dojo or esri.
Phil,
No there should be no issue if it is working for you. The getPanel function is supported by all WAB widgets (thought that one was documented). But the others setPosition and normalizePanel are specific functions of the Launchpad panel (internal functions and not documented).
Here is the only documentation related mention of getPanel() I can find: Communication to app container—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers
yep that is what I was thinking of.
Hi Robert,
I am wondering why this code doesn't work when added to the Elevation Profile widget that you wrote. Does something else need to be changed to make this work in that widget?
Matt,
What is not working? I just tested in WAB 2.8 Launchpad adding this to the onOpen of the Elevation Profile widget.
var panel = this.getPanel();
var pos = panel.position;
pos.width = 720;
panel.setPosition(pos);
panel.panelManager.normalizePanel(panel);