AnsweredAssumed Answered

Layer Disappears when zooming JSAPI

Question asked by yogip933 on Dec 10, 2015

So I'm learning javscript as I go along here on this web app.


I'm running into an issue when loading a geoprocessing service result as a feature layer. If the user zooms-in and out a bit, the layer disappears from the map. On the other hand, I have a feature table that shows the resulting attribute table and that information doesn't go away.


Any ideas on how I can keep the layer from disappearing? The code I'm using to add the results is below for reference.


function gp1JobComplete(jobinfo) {
            // Get the result map service layer and add to map.
            gp1.getResultImageLayer(jobinfo.jobId, null, null, function(layer){
              var layerURL = layer.url + "/0";
            var resLayer = new FeatureLayer(layerURL, {
                mode: FeatureLayer.MODE_AUTO,
                visible: true,
                id: "branches"

            on(resLayer, "load", function(evt){
              console.log("Layer loaded");
              var extent = resLayer.fullExtent;
              if (webMercatorUtils.canProject(extent, map)) {
                map.setExtent( webMercatorUtils.project(extent, map) );

              domConstruct.create("div", {id: "myTableNode"}, dom.byId("reports"));
              console.log("re-creating table");

            var oldLayer = map.getLayer("branches");


            myTable = new FeatureTable({
               "featureLayer" : resLayer,
               "map" : map
            }, 'myTableNode');

            on(myTable, "load", function(evt){
              console.log("The load event - ", evt);


   = "Bank";