I have a list of features that I want to set the visibility on for on a feature layer. I don't want to change the definition expression because I requery the layer periodically to get the latest attributes, I have to remove and readd the definition query.
I do something like this, but I cant seem to get it to work.
property <SPAN class="keyword token">var</SPAN> allFeatures<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>
property <SPAN class="keyword token">var</SPAN> searchFeatures<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>
property Layer queryLayer<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">null</SPAN>
onLengthChanged<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN>
searchFeatures <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">{</SPAN><SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">for</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">var</SPAN> i <SPAN class="operator token">=</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">;</SPAN> i <SPAN class="operator token"><</SPAN> listModelFields<SPAN class="punctuation token">.</SPAN>count<SPAN class="punctuation token">;</SPAN> i<SPAN class="operator token">++</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
searchFeatures<SPAN class="punctuation token">[</SPAN>id<SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> features<SPAN class="punctuation token">[</SPAN>id<SPAN class="punctuation token">]</SPAN>
<SPAN class="punctuation token">}</SPAN>
queryLayer<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setFeaturesVisible</SPAN><SPAN class="punctuation token">(</SPAN>searchFeatures<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></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>The above snippet just shows where i am trying to apply the setFeaturesVisible. I basically have a search bar, that when the length changes, I want the visible features to change with the filter this search bar performs on the model. But with my list of features I cant seem to get them show or hide, in fact the code actually breaks. Has anyone tried this function.