I want to dynamically set showLabels to display featurelayer labels. using
FeatureLayer.setShowLabels(true); logic is not working. Is there a sample code to dynamically enable showLabels? Any help is greatly appreciated.
I'm not sure if we are ready for 2.4 yet but that gives us an excuse to upgrade it . Thanks for the information. I agree that JS API does not have an option to change this so as a work around I may have to create http handler and invoke it from JS API .
It looks like in version 2.4 of WAB you will be able to do this. So just wait a couple of weeks when 2.4 Dev edition comes out.
Thanks for your help Robert. I will just use some workaround
Thanks,
Sapna
Robert,
Is there an option to enable this from web app builder when user creates the web app? I want to refrain from editing config.json file of webappbuilder client as far as possible.
Sapna,
No you can not from inside a widget as it needs to be in the map constructor.
You would have to change the apps main config.json:
<SPAN class="string token">"map"</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="string token">"mapOptions"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="string token">"showLabels"</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"extent"</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="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></SPAN></SPAN>
Unfortunately I cannot make changes to MapManager as I have to deploy the widget only and not the web application
I want to enable it in custom webapp builder widget . I'm not sure if I can reinstantiate the map object in the widget.
Did you set your map object constructor to enable showing labels?
https://developers.arcgis.com/javascript/3/jsapi/map-amd.html#map1
showLabel = true
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.