AnsweredAssumed Answered

Set a timer to clear selected features after a few seconds?

Question asked by schlot on Apr 2, 2014
Latest reply on Apr 3, 2014 by schlot
I have a dropdown of county names and when the user selected one, it executes a featurelayer.selectFeatures.  Since I have a SelectionSymbol set on this layer, so the county is highlighted to emphasize the border.

I'd like to set this on a timer, so that after a few seconds, the featureLayer clears the selection automatically, removing the highlight.  I can't quite figure out how to set this up.  I assume I need to use setTimeout?  I'd rather not have this be a manual process, using a button or something. 
                // used to zoom to county using dropdown selection or when incoming URL has a co= countyName parameter                 function selectCounty(countyName){                     if (countyName) {                         var coquery = new Query();                         coquery.where = "NAME = '" + countyName + "'";                         coquery.outFields = ['NAME'];                         coquery.returnGeometry = true;                         coquery.outSpatialReference = spatialReference;                         countyFeatureLayer.on('selection-complete', zoomCounty);                         countyFeatureLayer.selectFeatures(coquery, FeatureLayer.SELECTION_NEW, zoomCounty, taskErrorHandler);                     }                 }                 function zoomCounty(results){                     var selectExtent = graphicsUtils.graphicsExtent(results.features).expand(1.2);                                        map.setExtent(selectExtent, true);                 }

Outcomes