Select to view content in your preferred language

Developing a Table of Contents to turn on\off layers... anyone try this?

13281
47
Jump to solution
04-10-2015 09:01 AM
MikeCrook
Regular Contributor

I'm developing a Table of Content to turn on\off layers on map using javascript \ dojo-AMD sdk. I found a few places on the internet that shows ways. Nothing that is making complete sense to a newbie. Has anyone done this in a way that makes sense?

Tags (1)
47 Replies
SimonFisher
Frequent Contributor

Ben,

Would your CMV layer control widget be easily extracted from CMV source code and put into an existing ArcGIS JS App?  If so would it require a lot of code modifications or config to get working?

Thanks

Simon

0 Kudos
BenFousek
Deactivated User

You can certainly us it outside of CMV Simon.

Here's the docs: Layer Control - CMV

So CMV has some secret sauce which creates the LayerInfos array for layers loaded with CMV. You'll need to do that yourself. The docs explain it.

It uses Font Awesome, the iconic font and CSS toolkit so you need to have it loaded.

Quick tip: the layer property of a layerInfo object accepts either a layer object or layer id. If you are giving your layers ids (and you should) you can just use layer ids. Which is handy when you might not have the layer objects in the same scope.

RickeyFight
MVP Regular Contributor

So is anyone already trying to implement CMV Layer Control widget into WAB?

0 Kudos
by Anonymous User
Not applicable

they will if ESRI chooses not to combine Legend with TOC!

In my experience with our users, I have found that they are far from being too "confused" to understand a combined Legend/TOC.  In fact, quite the opposite. they specifically ask for it.  Have you had this same user feedback?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Rickey,

   Why? The LayerList widget covers all this already.

0 Kudos
RickeyFight
MVP Regular Contributor

Robert,

I guess it has most of the functionality. I just like the cmv one better.

MikeCrook
Regular Contributor

The TOC method that I chose was the AGSTOC. It's a great tool and I actually got it to work. I'm on my way.  Thanks for all the input and feedback.

MattDriscoll
Esri Contributor

If you just need to toggle layers on and off. I recommend the following (which may be in the API soon): Esri/arcgis-dijit-layer-list · GitHub

If you need more functionality such as a legend combination, etc then I'd recommend to use Nliu's.

BenFousek
Deactivated User

Matt Driscoll​ What about dynamic sublayer control?

0 Kudos
MattDriscoll
Esri Contributor

Yeah, it supports toggling sublayers.

0 Kudos