Issues with ToC loading

3206
7
12-01-2015 12:27 PM
JessicaKnight1
New Contributor III

I am using this code: https://www.arcgis.com/home/item.html?id=9b6280a6bfb0430f8d1ebc969276b109 for a Table of Contents in my application. I'm using an older version of the API (3.5). I have been working on making my app work in Web App Builder so I haven't touched the code on the Javascript API version in a few months. I noticed yesterday the ToC wasn't loading properly. I turned on Firebug and got an error I can't really interpret. I also got some in Chrome as well. I've attached the images of the errors below. Anyone have any insight? I know it was working recently. Again, I haven't touched any of the code in months so something has happened I'm just not sure what. I was hoping that this application would be working for a presentation I have next week so any help to get this working again would be great.

IMS.JPGIMS2.JPG

0 Kudos
7 Replies
TimWitt2
MVP Alum

Hey Jessica,

It might be helpful if we could see your code, it is tough to troubleshoot with only seeing the error message.

Tim

0 Kudos
TyroneBiggums
Occasional Contributor III

I saw something like this yesterday. That user does not have access to that ncsu service. Are you able to open that service on arcgis online outside of your application?

0 Kudos
JessicaKnight1
New Contributor III

I have attached my code.

All of this is done through ArcServer. I don't have it pulling from ArcGIS Online at all. I do have a version running on WAB, but they aren't connected to each other. Everything about the app in the API functions properly except the ToC right now. This is how it shows up on my app:

IMS3.JPG

Rather than giving the drop down of layers to select, all I have is the heading. This has how its been showing up in Safari since day one, though its worked fine in Firefox, Chrome, and IE with no issues for the last year or two that I've been working on it. I know it was working a few weeks ago because I used it for some screenshots for another presentation.

0 Kudos
TyroneBiggums
Occasional Contributor III

Hmm, well what probably happend (not that it's helpful) is that the javascript threw up at that header because of that error and wouldn't continue rendering that bit. Maybe?

Maybe, also, the security of that service has changed since you grabbed a screen capture for your presentation?

Why I brought up ArcOnline is to just add a layer with that service to see what happens. It could rule out it being an issue with the actual service is all I meant.

0 Kudos
JessicaKnight1
New Contributor III

Anyone?

0 Kudos
KenBuja
MVP Esteemed Contributor

You have to initialize the TOC after the map and the IBSS layer are ready. I've always put that into the map's "layers-add-result" event. Don't use the "layer-add-result" event, since this can get fired multiple times.

map.addLayers([IBSS]);

map.on("layers-add-result", function () {
    toc = new agsjs.dijit.TOC({
        map: map,
        layerInfos: [{
            layer: IBSS,
            title: "Southeast Data Layers"
        }]
    }, 'tocDiv');
};
JessicaKnight1
New Contributor III

My code was working as it was written for the last year or so. I changed it to match this though and no change. In fact, now nothing shows up in the Legend container at all. And Firefox shows no error messages.

I'm really at a loss. I changed nothing on my code in the last few months and it went from working fine to this.

0 Kudos