Changes at 4.4 with map services?

1253
7
07-10-2017 01:39 PM
JeffSauder
Occasional Contributor

I changed my source in the html file from 4.3 to 4.4, reloaded, and a lot has changed.  Now layers that were turned off by default in the mapservice (rest)  are now all on, the extent has changed significantly, and the legend widget doesn't turn off anymore (I had a button to change visibility).  Is the 4.4 just a beta release or is this the way it is now?  Everything was working perfectly and now it's all messed up.  If this is permanent, how long can I stay on 4.3 until that goes away?

Thanks in advance for any assistance or direction you can provide,

Jeff S

0 Kudos
7 Replies
UndralBatsukh
Esri Regular Contributor

Hi Jeff, 

I am able to reproduce the first issue you brought up where MapImageLayer's sublayers are all being visible regardless of their default visibility being false. This issue will be fixed in our next release.

Can you please give me more information extent and legend issues? Simple sample code would be great.

0 Kudos
JimNoel
New Contributor III

Will it be another 3 months before the next release?  Or is there a fairly easy workaround in the meantime?  I am also having the same issue.  This seems like a serious issue that ought to be corrected quickly.  I will also have to stay with 4.3 until this is resolved.

0 Kudos
JeffSauder
Occasional Contributor

Hi Undral,

Thank you for the response.  I created a test site that can be reached externally, one for the 4.3 and one for the 4.4.  You can see how the layers behave differently, and the extent is off in the 4.4 one.

As far as the Legend widget, it looks like the visibility property is no longer available.  If that is true then I may have to find another way of doing this.  I default it to off, and use a tool (the tool furthest to the right on the toolbar) to toggle the visibility.  I found this to be best since the Legend often interferes with the layerlist widget when a lot of layers are in the service.

I just put together a few external services really quick, just to be able to show this, so please forgive if it doesn't look polished.  There is a basemap, common service, and 2 switchable services, as well as aerials.

All of the other functionality still works OK in 4.4, like measure, id, etc.

Please note that this app is a work in progress, and not all functions may work at this time, I am just putting it out there to show the issues.

http://www.gilbertmapping.com/jsapi/ExtTest43/index.html

http://www.gilbertmapping.com/jsapi/ExtTest44/index.html

//js to define the legend: (visible false by default)

    togLegend=new Legend({
      view: view,
      visible: false,
      layerInfos: [{
        layer: dbLayer,
        title: "Common Layers"
      },{
        layer: dynLayer[0],
        title: legendTitle[0]
      },{
        layer: dynLayer[1],
        title: legendTitle[1]
      }]
    });
    view.ui.add(togLegend, "bottom-right");

//function to toggle legend visibility

function toggleLegend() {
  legendVis=!legendVis;
  togLegend.visible=legendVis;
}

//define extent

  vExtent = new Extent({
    xmin: 730000,
    ymin: 800000,
    xmax: 775000,
    ymax: 870000,
    spatialReference: 2868
  });
  view.extent=vExtent;

Also, being somewhat new with javascript, I'm not sure how long the older versions stick around.  Will I still be able to point to the 4.3 source in my html file at least until 4.5 comes out with the fixes?

Thanks,

Jeff

0 Kudos
JimNoel
New Contributor III

Jeff, in response to your question about how long 4.3 will stay around:  ESRI seems to keep earlier versions available for a fairly indefinite time.  In fact, all versions in the 4.x series are currently still available, all the way back to 4.0.

JeffSauder
Occasional Contributor

Hi Jim,

Thanks for the reply.  Hopefully I can go to 4.5 when it comes out, but it's good to know that the older release will still be around (I also downloaded the 4.3 js just in case).  Of course I would like to take advantage of the new functionality as it becomes available so hopefully with 4.5 and beyond I won't have these issues...

0 Kudos
UndralBatsukh
Esri Regular Contributor

Hi Jeff, 

Sorry for the really late reply. I was out of the office for a while. Anyhow, thank you for the descriptions and reproducible cases. I was able to reproduce different behaviors you reported. 

I created issues for these. 

You can workaround the MapView's initial extent issue by setting the initial extent when the view is loaded as shown below. 

view.then(function(){
   var extent = new Extent({
      xmin: 730000,
      ymin: 800000,
      xmax: 775000,
      ymax: 870000,
      spatialReference: 2868
   });
view.extent = extent;
});

As for the legend widget visibility, you can use the CSS to toggle legend visibility as shown below:

<style>
.my-hiding-class {
  display: none;
}
</style>

function toggleLegend() {
  legendVis=!legendVis;
  togLegend.container.classList.toggle("my-hiding-class", legendVis);
}

Hope this helps,

-Undral 

0 Kudos
JeffSauder
Occasional Contributor

Hi Undral,

Thanks for the reply. I went back to 4.3, the extent is the least of my issues, if you look at the samples you’ll see that all the layers come on in the 4.4 version at full extent, while at 4.3 they work properly (the layers that I turned off by default in the ArcMap project are off in 4.3, but for some reason they all come on in 4.4, regardless of whether the layers are off by default or not).

I fixed the legend issue by using an expand widget. I didn’t even think of the css fix, I may go back and do that instead…

Anyway I will just stay with 4.3 for the time being…

Thanks,

Jeff

0 Kudos