Select to view content in your preferred language

TOC - totally stumped

3802
3
Jump to solution
03-19-2014 01:38 PM
CM2
by
Deactivated User
Hey folks,

I've been trying to use Nliu's TOC today. I've followed a few examples and looked through the threads here, but I'm totally stumped on why my code isn't working.

I was wondering if anyone might want to take a look at it here:  http://jsfiddle.net/Tx4R6/4/

My service is definitely working. It contains one layer. You can substitute any known service, but while the service shows in the map, it does not show in the TOC.

I've made sure the dijits/functions are called in the correct order. I've seen other examples use the online source for AGSJS so I can't see how that's an issue.

Any ideas? Thanks for reading!
0 Kudos
1 Solution

Accepted Solutions
JohnGravois
Deactivated User
hi Craig, welcome to our forum!

its your event listener. 

map.on('layers-add-result', function(e){


this only gets called when you use the method map.addLayers([layer]);

since you're using map.addLayer(layer); you need to listen for 'layer-add-result' instead

View solution in original post

0 Kudos
3 Replies
JohnGravois
Deactivated User
hi Craig, welcome to our forum!

its your event listener. 

map.on('layers-add-result', function(e){


this only gets called when you use the method map.addLayers([layer]);

since you're using map.addLayer(layer); you need to listen for 'layer-add-result' instead
0 Kudos
CM2
by
Deactivated User
Unbelievable!  You're the man, John.  I appreciate that very much.  It's the little things with stuff like this.

Totally working and a fantastic widget.

Thanks again.
0 Kudos
JohnGravois
Deactivated User
no sweat.  please consider marking this thread as 'answered'
0 Kudos