Robert,
I have the eSearch widget configured to open at the start. Now I need to automatically close the widget when I open another widget called Sewer Capacity Calculator. What piece of code is needed and where would it go?
Also, at the same time I would like to turn off the Ortho image as the widget is opened, same thing how do I do this?
Please see attached image.
Thank You!
Rich
Rich,
Sounds like you have messed up your widgets require array. Can you Post your define section and the following function list?
you must have missed a step when attaching...
I attached the entire widget
Thanks a bunch
Still no luck turning of the eSearch Widget?
I'm missing something???
Turning off the Imagery does work...Thank You!
Here is the correct code for the onOpen function for your setup then:
<SPAN class="keyword token">var</SPAN> pm <SPAN class="operator token">=</SPAN> PanelManager<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getInstance</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> pm<SPAN class="punctuation token">.</SPAN><SPAN class="token function">closePanel</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>appConfig<SPAN class="punctuation token">.</SPAN>widgetPool<SPAN class="punctuation token">.</SPAN>widgets<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>id <SPAN class="operator token">+</SPAN> <SPAN class="string token">'_panel'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN></SPAN>
Assuming that the eSearch is actually your second widget in the header controller widget. From your code paste above it looks like it is the first in the header controller and that would mean.
<SPAN class="keyword token">var</SPAN> pm <SPAN class="operator token">=</SPAN> PanelManager<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getInstance</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> pm<SPAN class="punctuation token">.</SPAN><SPAN class="token function">closePanel</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>appConfig<SPAN class="punctuation token">.</SPAN>widgetPool<SPAN class="punctuation token">.</SPAN>widgets<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>id <SPAN class="operator token">+</SPAN> <SPAN class="string token">'_panel'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN></SPAN>
Oh, then yes they are in the correct place. but still no luck
with the rest of the require entries at the top of the widget.js.
I'm using a Foldable Panel Theme.
This is the config...
"widgetPool": {"panel": {"uri": "themes/FoldableTheme/panels/FoldablePanel/Panel","position": {"top": 5,"left": 15,"bottom": 5,"zIndex": 5,"relativeTo": "map"} },"widgets":[ {"name":"eSearch","label": "Sanitary Search Tools","uri": "widgets/eSearchSanitary/Widget","config": "configs/eSearch/config_eSanitary.json","icon": "configs\\eSearch\\i_searchsan.png","id": "widgets_eSearchSanitary_Widget_500","openAtStart": true,"position": {"top": 70,"left": 4,"height": 420,"width": 360,"relativeTo": "map"}, "index": 1,"version": "2.7"},
Where does the "Require" for the PanelManager go?
That may be the issue???
Then you need to provide more info. What theme are you using and where in that theme is the eSearch widget added?
The eSearch widget is in a WidgetPool and is not a WidgetOnSreen.
Ok, I tried fooling with the code but either way I get an "setState" error.
This is my attempt putting in the code you gave me.
onOpen: function () {//BELL Add to close other widgets at start upvar pm = PanelManager.getInstance();//pm.closePanel(this.appConfig.widgetOnScreen.widgets[4]);
pm.closePanel(this.appConfig.widgetPool.widgets[1]);//close the 5th widget in the config.json inside the widgetOnScreen object //or // pm.closePanel(pm.activePanel);//close the active panel //End Bell Add
This is the error?
init.js:114 TypeError: panel.setState is not a function at Object.<anonymous> (PanelManager.js?wab_dv=2.9:197) at init.js:63 at k (init.js:107) at b.extend.then.then.b.then (init.js:110) at Object.closePanel (PanelManager.js?wab_dv=2.9:192) at Object.onOpen (Widget.js?wab_dv=2.9:964) at Object.openWidget (WidgetManager.js?wab_dv=2.9:569) at Object._postWidgetStartup (WidgetManager.js?wab_dv=2.9:1130) at Object.<anonymous> (init.js:63) at Object.c [as startup] (init.js:119) "TypeError: panel.setState is not a function at Object.<anonymous> (http://localhost:63342/MAHGIS_2.9/jimu.js/PanelManager.js?wab_dv=2.9:197:15) at https://js.arcgis.com/3.25/init.js:63:337 at k (https://js.arcgis.com/3.25/init.js:107:277) at b.extend.then.then.b.then (https://js.arcgis.com/3.25/init.js:110:152) at Object.closePanel (http://localhost:63342/MAHGIS_2.9/jimu.js/PanelManager.js?wab_dv=2.9:192:50) at Object.onOpen (http://localhost:63342/MAHGIS_2.9/widgets/CapacityCalculation/Widget.js?wab_dv=2.9:964:20) at Object.openWidget (http://localhost:63342/MAHGIS_2.9/jimu.js/WidgetManager.js?wab_dv=2.9:569:18) at Object._postWidgetStartup (http://localhost:63342/MAHGIS_2.9/jimu.js/WidgetManager.js?wab_dv=2.9:1130:12) at Object.<anonymous> (https://js.arcgis.com/3.25/init.js:63:15) at Object.c [as startup] (https://js.arcgis.com/3.25/init.js:119:235) ---------------------------------------- rejected at a (https://js.arcgis.com/3.25/init.js:108:174) at k (https://js.arcgis.com/3.25/init.js:107:436) at b.extend.then.then.b.then (https://js.arcgis.com/3.25/init.js:110:152) at Object.closePanel (http://localhost:63342/MAHGIS_2.9/jimu.js/PanelManager.js?wab_dv=2.9:192:50) at Object.onOpen (http://localhost:63342/MAHGIS_2.9/widgets/CapacityCalculation/Widget.js?wab_dv=2.9:964:20) at Object.openWidget (http://localhost:63342/MAHGIS_2.9/jimu.js/WidgetManager.js?wab_dv=2.9:569:18) at Object._postWidgetStartup (http://localhost:63342/MAHGIS_2.9/jimu.js/WidgetManager.js?wab_dv=2.9:1130:12) at Object.<anonymous> (https://js.arcgis.com/3.25/init.js:63:15) at Object.c [as startup] (https://js.arcgis.com/3.25/init.js:119:235) at Object.<anonymous> (http://localhost:63342/MAHGIS_2.9/jimu.js/BaseWidgetPanel.js?wab_dv=2.9:78:18) ----------------------------------------Error at b.extend.then.then.b.then (https://js.arcgis.com/3.25/init.js:110:97) at Object.closePanel (http://localhost:63342/MAHGIS_2.9/jimu.js/PanelManager.js?wab_dv=2.9:192:50) at Object.onOpen (http://localhost:63342/MAHGIS_2.9/widgets/CapacityCalculation/Widget.js?wab_dv=2.9:964:20) at Object.openWidget (http://localhost:63342/MAHGIS_2.9/jimu.js/WidgetManager.js?wab_dv=2.9:569:18) at Object._postWidgetStartup (http://localhost:63342/MAHGIS_2.9/jimu.js/WidgetManager.js?wab_dv=2.9:1130:12) at Object.<anonymous> (https://js.arcgis.com/3.25/init.js:63:15) at Object.c [as startup] (https://js.arcgis.com/3.25/init.js:119:235) at Object.<anonymous> (http://localhost:63342/MAHGIS_2.9/jimu.js/BaseWidgetPanel.js?wab_dv=2.9:78:18) at https://js.arcgis.com/3.25/init.js:63:337 at k (https://js.arcgis.com/3.25/init.js:107:277)"
You would need to add this to the sewer widget onOpen function
<SPAN class="comment token">//require</SPAN> <SPAN class="string token">'jimu/PanelManager'</SPAN><SPAN class="punctuation token">,</SPAN> PanelManager<SPAN class="punctuation token">,</SPAN> <SPAN class="comment token">//code</SPAN> <SPAN class="keyword token">var</SPAN> pm <SPAN class="operator token">=</SPAN> PanelManager<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getInstance</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> pm<SPAN class="punctuation token">.</SPAN><SPAN class="token function">closePanel</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>appConfig<SPAN class="punctuation token">.</SPAN>widgetOnScreen<SPAN class="punctuation token">.</SPAN>widgets<SPAN class="punctuation token">[</SPAN><SPAN class="number token">4</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="comment token">//close the 5th widget in the config.json inside the widgetOnScreen object </SPAN> <SPAN class="comment token">//or </SPAN> pm<SPAN class="punctuation token">.</SPAN><SPAN class="token function">closePanel</SPAN><SPAN class="punctuation token">(</SPAN>pm<SPAN class="punctuation token">.</SPAN>activePanel<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="comment token">//close the active panel </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>
For turning a layer on or off see this thread:
https://community.esri.com/thread/183992-turn-on-layers-on-widget-start
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.