Hi,
I've developed a custom widget for WAB, that I need to change the default size of. How can I change the default widget panel height? I need to make the panel smaller, so that it doesn't take up as much screen space.
Thanks
Jerry,
There is not a absolute way to do this. There are going to be times when the widget is in a panel that will not be resized. If the widget is in a onScreenWidgetPanel then this will work:
onOpen<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">getPanel</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">resize</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN>w<SPAN class="punctuation token">:</SPAN><SPAN class="number token">200</SPAN><SPAN class="punctuation token">,</SPAN>h<SPAN class="punctuation token">:</SPAN><SPAN class="number token">200</SPAN><SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
@RobertScheitlin__GISP
Should the addition of the height and width work for the Legend widget too? I have an app in which users have requested it be on at startup (I personally don't like any other than the Popup Panel on at startup but that's me). I tried adding the height and width to the Legend and as onScreen widget and it didn't seem to take. This app is 2.13 and in Foldable theme.
Thanks Robert, this worked for me.
Thanks for your response Robert. This is a global setting in the app for the widget; I was wondering whether it's possible to apply this to the widget itself. The widget I'm developing is going to be used in ArcGIS Portal 10.5.1 apps as well, and I would like to make sure that where ever the widget is used, the dimension settings are shipped with the widget. Is this possible?
The widget size can be set in the apps main config.json by adding a height and width property to the widgets position object:
<SPAN class="punctuation token">{</SPAN> <SPAN class="string token">"position"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="string token">"left"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="number token">55</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"top"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="number token">45</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"width"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="number token">200</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"height"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="number token">200</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"relativeTo"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"map"</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"placeholderIndex"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="number token">1</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"id"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"_5"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"closeable"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"uri"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"widgets/eSearch/Widget"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"openAtStart"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"name"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"eSearch"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"config"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"configs/eSearch/config__5.json"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"version"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"2.5.0.1"</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.