We deploy custom widgets to ArcGIS Portal (following prescribed workflow - Add custom widgets—Portal for ArcGIS | ArcGIS Enterprise) but we'd like to include a help doc along with our widget (like you can in Dev Edition - Add help for your widget—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers ). Is there a supported way to do that?
Hi Pete,
Please take a look at these GeoNet threads,
Activate help link on home made widget
https://community.esri.com/message/669750-help-widget
Hope these help,
Derek's links are what the WAB dev team have provided for adding help to a custom widget. I still find this to be a bit to involved and heavy handed when try to provide a simple help link for your custom widget. Here is a hack snippet of code I use to make my widgets link to help docs on a web server.
In the widget settings.js setConfig function.
setConfig<SPAN class="punctuation token">:</SPAN><SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN>config<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN> <SPAN class="comment token">//hack the 'Learn more about this widget link'</SPAN> <SPAN class="token function">setTimeout</SPAN><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">var</SPAN> helpLink <SPAN class="operator token">=</SPAN> dojo<SPAN class="punctuation token">.</SPAN><SPAN class="token function">query</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">'.help-link'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> helpLink<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>href <SPAN class="operator token">=</SPAN> <SPAN class="string token"><SPAN>'</SPAN><A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fgis.calhouncounty.org%2FWAB%2FV2.9%2Fwidgets%2FeSearch%2Fhelp%2FeSearch_Help.htm" target="_blank">https://gis.calhouncounty.org/WAB/V2.9/widgets/eSearch/help/eSearch_Help.htm</A><SPAN>'</SPAN></SPAN><SPAN class="punctuation token">;</SPAN> html<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setStyle</SPAN><SPAN class="punctuation token">(</SPAN>helpLink<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'display'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'block'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">600</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></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Or you can have the link go to a help doc in the widgets folder by using a url like this.
helpLink<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>href <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>location<SPAN class="punctuation token">.</SPAN>href<SPAN class="punctuation token">.</SPAN><SPAN class="token function">replace</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">'?id='</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'apps/'</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="string token">'/widgets/eSearch/help/eSearch_Help.html'</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
Thanks guys - appreciate the quick answers! The snippet you provided Robert Scheitlin, GISP works in our test environment just fine thank you. One question, why the setTimeout? What needs to happen in that 600 ms before you run that code? Is the help link not actually there yet? I just wonder if there's a way to get this done without some kind of race condition.
Pete that is because the WAB core code searches for the help doc in the path that WAB expects to find the help in and when it can not it hides the link.
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.