<?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: underbelly of .setVisibility() method for Feature Layer? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/underbelly-of-setvisibility-method-for-feature/m-p/546215#M50891</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the replies. I have both an ONDEMAND and SNAPSHOT feature layer I am doing this for. I will try to put together code to share but right now the application is so huge it would drive you bonkers to try to follow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;setDefinitionExpression is helpful, except I need to subset data by OBJECTID so that may get unwieldy. My sense is the syntax would be 'OBJECTID=1 and OBJECTID=2 and...&lt;SPAN class="str" style="color: #999999;"&gt;"etc&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #666600;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Aug 2014 18:52:22 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2014-08-14T18:52:22Z</dc:date>
    <item>
      <title>underbelly of .setVisibility() method for Feature Layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/underbelly-of-setvisibility-method-for-feature/m-p/546212#M50888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi - I am struggling with what I believed was asynchronous behavior from the setVisibility method on a feature layer. I have a huge feature layer that, to avoid issues, has visibility set to false on load. After clearing the layer's graphics and adding a new, smaller set of graphics, I was setting visibility to 'true'. However all of the thousands of feature graphics kept showing up anyways. I tried using Dojo deferreds and rearranging when I changed visibility to no avail. The only thing that worked was changing the visibility, letting the entire map update, then clearing the graphics.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14078001173368135 jive_text_macro" jivemacro_uid="_14078001173368135" modifiedtitle="true"&gt;
&lt;P&gt;console.log('set visibility');&lt;/P&gt;
&lt;P&gt;fl.setVisibility(true);&lt;/P&gt;
&lt;P&gt;var wait = on(map, 'update-end', function() {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;// Function to clear graphics &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; fl.clear();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; fl.add(graphicSubset);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; wait.remove();&lt;/P&gt;
&lt;P&gt;});&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, this still flashes all of the layer's graphics before clearing them. Suspending drawing on the feature layer did not stop the flashing problem, and if I change the graphics first then wait and change visibility, it overrides the changes I made and loads the original layer's thousands of graphics when it is made visible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I am wondering what setVisibility() is doing to override what I input as graphics. I can see the altered layer with 28 features in the console log if I do not change visibility and the visibility is set to false, but if I change the graphics to the 28 features (results from a query) then set visibility to true after all updates are done, 1500 graphics are returned from the original feature layer even though I cleared them all...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 23:46:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/underbelly-of-setvisibility-method-for-feature/m-p/546212#M50888</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2014-08-11T23:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: underbelly of .setVisibility() method for Feature Layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/underbelly-of-setvisibility-method-for-feature/m-p/546213#M50889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What mode are you using when adding your feature layer? - MODE_AUTO, MODE_ONDEMAND, MODE_SELECTION, MODE_SNAPSHOP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This setting can impact what features are loaded and when they are loaded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have the full page code available?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2014 00:42:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/underbelly-of-setvisibility-method-for-feature/m-p/546213#M50889</guid>
      <dc:creator>OwenEarley</dc:creator>
      <dc:date>2014-08-12T00:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: underbelly of .setVisibility() method for Feature Layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/underbelly-of-setvisibility-method-for-feature/m-p/546214#M50890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you try using &lt;STRONG&gt;setDefinitionExpression(expression) &lt;/STRONG&gt;on the feature layer?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/jsapi/featurelayer.html#setdefinitionexpression" title="https://developers.arcgis.com/javascript/jsapi/featurelayer.html#setdefinitionexpression"&gt;featurelayer | API Reference | ArcGIS API for JavaScript&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2014 02:09:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/underbelly-of-setvisibility-method-for-feature/m-p/546214#M50890</guid>
      <dc:creator>RiyasDeen</dc:creator>
      <dc:date>2014-08-12T02:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: underbelly of .setVisibility() method for Feature Layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/underbelly-of-setvisibility-method-for-feature/m-p/546215#M50891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the replies. I have both an ONDEMAND and SNAPSHOT feature layer I am doing this for. I will try to put together code to share but right now the application is so huge it would drive you bonkers to try to follow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;setDefinitionExpression is helpful, except I need to subset data by OBJECTID so that may get unwieldy. My sense is the syntax would be 'OBJECTID=1 and OBJECTID=2 and...&lt;SPAN class="str" style="color: #999999;"&gt;"etc&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #666600;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2014 18:52:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/underbelly-of-setvisibility-method-for-feature/m-p/546215#M50891</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2014-08-14T18:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: underbelly of .setVisibility() method for Feature Layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/underbelly-of-setvisibility-method-for-feature/m-p/546216#M50892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sarah,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; If you are going to have a long list of ObjectIds the the better SQL will look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OBJECTID IN (1,2,4,6,7)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2014 19:01:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/underbelly-of-setvisibility-method-for-feature/m-p/546216#M50892</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2014-08-14T19:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: underbelly of .setVisibility() method for Feature Layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/underbelly-of-setvisibility-method-for-feature/m-p/546217#M50893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sarah, specific to the definition expression issue, you can use the IN operator in your where clause:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ObjectID IN (33,55,56,222)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It could go something kind of like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14080443447748156 jive_text_macro" jivemacro_uid="_14080443447748156" modifiedtitle="true"&gt;
&lt;P&gt;var objectIdField = featureLayer.objectIdField;&lt;/P&gt;
&lt;P&gt;var objectIds = array.map(features,function(feature){&lt;/P&gt;
&lt;P&gt;&amp;nbsp; return feature.attributes[objectIdField];&lt;/P&gt;
&lt;P&gt;});&lt;/P&gt;
&lt;P&gt;var whereClause = lang.replace("{0} IN ({1})",[objectIdField,objectIds.join(",")]);&lt;/P&gt;
&lt;P&gt;featureLayer.setDefinitionExpression(whereClause);&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2014 19:29:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/underbelly-of-setvisibility-method-for-feature/m-p/546217#M50893</guid>
      <dc:creator>JohnGrayson</dc:creator>
      <dc:date>2014-08-14T19:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: underbelly of .setVisibility() method for Feature Layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/underbelly-of-setvisibility-method-for-feature/m-p/546218#M50894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks everyone, I have finally managed a full workaround, though I still do not understand what was going on with the .setVisibility() method overriding my graphics. I chose to use setDefinitionExpression() because then 'ONDEMAND' feature layers did not fully redraw and have to be hidden after every map pan event, etc. I also used a QueryTask rather than the queryIds method of a feature layer to grab the objectids I needed since it queries the server and not client side, where the ids were being limited by the definition expression..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I have the 'visibility : true' set for all layers involved&lt;/LI&gt;&lt;LI&gt;I make them all MODE_ONDEMAND (SNAPSHOT mode was weirdly saving previous graphics from prior definition expressions sometimes)&lt;/LI&gt;&lt;LI&gt;I set their definition expression on load to something that returns null so that no features are displayed. This gets around the setVisibility method problem, so I never have to change it.&lt;/LI&gt;&lt;LI&gt;I run a query that gathers the objectids I need to display&lt;/LI&gt;&lt;LI&gt;I set the definition expression using those objectids to display the specific data I need to show&lt;/LI&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Aug 2014 21:52:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/underbelly-of-setvisibility-method-for-feature/m-p/546218#M50894</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2014-08-15T21:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: underbelly of .setVisibility() method for Feature Layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/underbelly-of-setvisibility-method-for-feature/m-p/546219#M50895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for that '&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;objectIdField' property tip John, I had not noticed that before.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Aug 2014 21:54:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/underbelly-of-setvisibility-method-for-feature/m-p/546219#M50895</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2014-08-15T21:54:36Z</dc:date>
    </item>
  </channel>
</rss>

