<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: loading indicator &amp;amp; secured feature layers in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-indicator-amp-amp-amp-secured-feature/m-p/739803#M68481</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;adding the onUpdateEnd listener to the last featLayer that's added to the map seemed to do the trick. I also changed to "ONDEMAND" mode.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
dojo.connect(map, "onLayerAdd", function(layer) {
 //console.log(layer.id);
 if(layer.id == "featLayer1"){
&amp;nbsp; ShowLoadingMessage('Loading...'); // &amp;lt;-- fires loading indicator
 }
});
var handle = dojo.connect(featLayer3, "onUpdateEnd", function(){
 createLabels();
 HideLoadingMessage(); &amp;lt;--hides load indicator
 dojo.disconnect(handle)
});
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 07:29:25 GMT</pubDate>
    <dc:creator>danbecker</dc:creator>
    <dc:date>2021-12-12T07:29:25Z</dc:date>
    <item>
      <title>loading indicator &amp;amp;amp; secured feature layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-indicator-amp-amp-amp-secured-feature/m-p/739796#M68474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ShowLoadingMessage fires and displays loading animation&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;dojo.connect(map,"onUpdateStart", ShowLoadingMessage('Loading...'))&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;HideLoadingMessage fires when the basemap is successfully drawn&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;dojo.connect(map, "onUpdateEnd", HideLoadingMessage);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;identifyManager login then pops up, asking for username/password. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After signing in, the 9 feature layers are then added to map, but it takes a few seconds; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;how do I fire my ShowLoadingMessage, then fire HideLoadingMessage when all feature layers are drawn?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I looked through featurelayer events and can't find what I'm looking for. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2012 15:59:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-indicator-amp-amp-amp-secured-feature/m-p/739796#M68474</guid>
      <dc:creator>danbecker</dc:creator>
      <dc:date>2012-05-02T15:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: loading indicator &amp; secured feature layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-indicator-amp-amp-amp-secured-feature/m-p/739797#M68475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you had a function that loaded the 9 services, you could have the showloading function fire prior to the load then have an onLayerAdd event listener on the map that would check if the layer being added matches the last layer of your 9 services.&amp;nbsp; Once it matches you would then fire the hideloading.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I might try to add some code to describe a bit more clearly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is a snippet:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dojo.connect(map, "onLayerAdd", function (layer) { console.log(layer.url + " added"); });&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This would give you the url of the layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best wishes,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2012 17:34:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-indicator-amp-amp-amp-secured-feature/m-p/739797#M68475</guid>
      <dc:creator>PaulBushore</dc:creator>
      <dc:date>2012-05-02T17:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: loading indicator &amp; secured feature layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-indicator-amp-amp-amp-secured-feature/m-p/739798#M68476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;thanks paul; that should get me going!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2012 17:57:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-indicator-amp-amp-amp-secured-feature/m-p/739798#M68476</guid>
      <dc:creator>danbecker</dc:creator>
      <dc:date>2012-05-02T17:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: loading indicator &amp; secured feature layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-indicator-amp-amp-amp-secured-feature/m-p/739799#M68477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here's what I have. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It fires the loading indicator fine, but hides the indicator too soon. It's still several seconds after the indicator is hidden that featLayer3 actually appears on the map...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;what could be causing this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
dojo.connect(map, "onLayerAdd", function(layer) {
 //console.log(layer.id);
 if(layer.id == "featLayer1"){
&amp;nbsp; ShowLoadingMessage('Loading...'); // &amp;lt;-- fires loading indicator
 }
 else if (layer.id == "featLayer3"){
&amp;nbsp; HideLoadingMessage(); // &amp;lt;--hides loading indicator
 }
});
var legendLayers = [];

var featLayer1 = new esri.layers.FeatureLayer(url11, {id:'featLayer1'});
legendLayers.push({layer:featLayer1,title:"featLayer1"});

var featLayer2 = new esri.layers.FeatureLayer(url22, {id:'featLayer2'});
legendLayers.push({layer:featLayer2,title:"featLayer2"});

var featLayer3 = new esri.layers.FeatureLayer(url33, {id:'featLayer3'});
legendLayers.push({layer:featLayer3,title:"featLayer3"});


var featLayers = [];
dojo.forEach(legendLayers,function(layer){
 featLayers.push(layer.layer)
});
map.addLayers(featLayers);
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:29:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-indicator-amp-amp-amp-secured-feature/m-p/739799#M68477</guid>
      <dc:creator>danbecker</dc:creator>
      <dc:date>2021-12-12T07:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: loading indicator &amp; secured feature layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-indicator-amp-amp-amp-secured-feature/m-p/739800#M68478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/map.htm#onLayerAdd" rel="nofollow" target="_blank"&gt;onLayerAdd&lt;/A&gt;&lt;SPAN&gt; fires when a layer is added to the map. A layer being added to the map is not the same as all features being visible on the map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ideally, your features would load fast enough that you don't need to show a loading icon. If that's not the case, look at using your layers' &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/featurelayer.htm#onUpdateEnd" rel="nofollow" target="_blank"&gt;onUpdateEnd&lt;/A&gt;&lt;SPAN&gt; event. You could set up a listener for this event and then disconnect the listener after the event fires the first time. To do this for multiple layers, you could check each layer's updating property. When all updating is false for all your feature layers, you would hide your loading icon and disconnect your event listener using dojo.disconnect.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 16:18:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-indicator-amp-amp-amp-secured-feature/m-p/739800#M68478</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2012-05-03T16:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: loading indicator &amp; secured feature layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-indicator-amp-amp-amp-secured-feature/m-p/739801#M68479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/map.htm#onLayerAdd"&gt;onLayerAdd&lt;/A&gt; fires when a layer is added to the map. A layer being added to the map is not the same as all features being visible on the map.&lt;BR /&gt;&lt;BR /&gt;Ideally, your features would load fast enough that you don't need to show a loading icon. If that's not the case, look at using your layers' &lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/featurelayer.htm#onUpdateEnd"&gt;onUpdateEnd&lt;/A&gt; event. You could set up a listener for this event and then disconnect the listener after the event fires the first time. To do this for multiple layers, you could check each layer's updating property. When all updating is false for all your feature layers, you would hide your loading icon and disconnect your event listener using dojo.disconnect.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks for the reply. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I noticed that when the featlayer is added to the map a RestURL/layerID/query? call is made to the server. It looks like the features aren't actually displayed until the query is returned from the server, which in my case takes awhile because some of the featlayers have &amp;gt;1K records. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll try this out and report back...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 16:39:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-indicator-amp-amp-amp-secured-feature/m-p/739801#M68479</guid>
      <dc:creator>danbecker</dc:creator>
      <dc:date>2012-05-03T16:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: loading indicator &amp; secured feature layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-indicator-amp-amp-amp-secured-feature/m-p/739802#M68480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;I noticed that when the featlayer is added to the map a RestURL/layerID/query? call is made to the server. It looks like the features aren't actually displayed until the query is returned from the server, which in my case takes awhile because some of the featlayers have &amp;gt;1K records. &lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That's correct. When you create a feature layer, a call is made to the map service layer that will be used for the feature layer to get the layer's metadata. Things like field info, scale dependencies, etc. are retrieved. If you're using ONDEMAND mode, features are retrieved when the layer is added to the map.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 16:44:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-indicator-amp-amp-amp-secured-feature/m-p/739802#M68480</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2012-05-03T16:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: loading indicator &amp; secured feature layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-indicator-amp-amp-amp-secured-feature/m-p/739803#M68481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;adding the onUpdateEnd listener to the last featLayer that's added to the map seemed to do the trick. I also changed to "ONDEMAND" mode.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
dojo.connect(map, "onLayerAdd", function(layer) {
 //console.log(layer.id);
 if(layer.id == "featLayer1"){
&amp;nbsp; ShowLoadingMessage('Loading...'); // &amp;lt;-- fires loading indicator
 }
});
var handle = dojo.connect(featLayer3, "onUpdateEnd", function(){
 createLabels();
 HideLoadingMessage(); &amp;lt;--hides load indicator
 dojo.disconnect(handle)
});
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:29:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-indicator-amp-amp-amp-secured-feature/m-p/739803#M68481</guid>
      <dc:creator>danbecker</dc:creator>
      <dc:date>2021-12-12T07:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: loading indicator &amp; secured feature layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-indicator-amp-amp-amp-secured-feature/m-p/739804#M68482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Nice, can you mark my post as an answer?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit:&amp;nbsp; look like you marked this answered, thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 21:45:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/loading-indicator-amp-amp-amp-secured-feature/m-p/739804#M68482</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2012-05-03T21:45:12Z</dc:date>
    </item>
  </channel>
</rss>

