AnsweredAssumed Answered

Arcgis Javascript Application Issue clearing feature layer

Question asked by thejohnny on Apr 9, 2015
Latest reply on Apr 13, 2015 by tsellste

Ok, here is my issue.  I have a JavaScript application that I have written and the problem comes when I try to hit my home button.  The application uses Feature Layers to show Bus Route and Bus Stops.  If a user has selected a Bus Route on the left and zooms in you can see the highlighted route along with the now highlighted Bus Stops that are associated with this route.  HOME BUTTON function starts my problems.


Issue:  If you are zoomed in enough to see the selected Bus Stops (Green dots) and hit the "HOME" button, only those selected Bus Stops that are visible will be removed and replaced with the Blue Dot Bus Stops. For some weird reason even if you are zoomed out it still doesn't clear all of the feature layer.  I tried putting a timer on the zoomtoextent but that didn't help either.  Anyway, here is my goHome function that may be causing issues.


To replicate issue.  Click on the first route 101 on the left.  Zoom into the lowest portion of the route and you'll see the green selected Stops.  Now hit the home button then zoom back into that area.  Start going North (Up) and you'll see how there are still Selected Stops (Green Dots).


Here is a link to the Application** Link removed as problem is solved **


Sorry tired to put this in a code block but it keeps showing up weird.

Resets the Map to its initial state with no routes selected and accordian pane
back to default

    function goHome(){

      // Reset the Accordian Content Panes
and fix naming

      var newTitle = "Bus Arrival Times";

      dijit.byId("pane3").set("title", newTitle);

      var container = dijit.byId("container");

      container.selectChild("RTCBusroutes", true);


      // This will remove old values in Bus Arrival Time pane so Bus Arrival Times will clear

      var results = document.getElementById("results");

      var rowCount = results.rows.length;

      for (var x=rowCount-1; x>0; x--)




      // Removes the Highlight from the currently selected Item in the RTC Bus Routes List pane



      // Scrolls to the top of the List in the RTC Bus Routes Content Pane List



      // Remove Currently Selected Bus Routes and Ensure all Routes are showing


      busRoutes.setDefinitionExpression("ROUTE IS NOT NULL");


      // Remove Currently Selectes Bus Stops and Ensure all Stops are showing


      busStops.setDefinitionExpression("ROUTE IS NOT NULL");


      // Removes Any simpleLineSymbols and Any simplePointSymbols;


      // Closes any open infoWindows



      // Zoom to Map Extent


      //setTimeout(function() {map.setExtent(mapExtent);}, 1000);


      // Clears any address entered into Address Search Box