How to make text more visible in esriLayerList

2137
6
Jump to solution
05-05-2016 03:22 PM
DougCollins
Occasional Contributor

I am using the esri dijit LayerList to display the layers and legend, however the text that shows the layer names is very faint and is difficult to see.  Is there any way to make it darker or change the color of the text to black.  Not sure why the default text color is a very faint gray ... really seems like a stupid default setting.

I am using javascript api v 3.16.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Charlie,

  The faint grey text is to indicate the the layer is not visible at the current scale due to min scale and max scale settings on the layer.

But if you still want to change that then you just need to add a css rule and change the color. Here is the default rule:

.esriLayerList .esriScaleInvisible .esriLabel {
    color: #999;
}

View solution in original post

6 Replies
RobertScheitlin__GISP
MVP Emeritus

Charlie,

  The faint grey text is to indicate the the layer is not visible at the current scale due to min scale and max scale settings on the layer.

But if you still want to change that then you just need to add a css rule and change the color. Here is the default rule:

.esriLayerList .esriScaleInvisible .esriLabel {
    color: #999;
}
DougCollins
Occasional Contributor

Thanks Robert!   That worked great.

The esri layerlist works fine for a layer created as an ArcGISDynamicMapService.  However, I have a service that has a main layer with several sublayers.

eg.    MainLayer  (0)

               SubLayerA (1)

               SubLayerB (2)

If I define my layer as a FeatureLayer in JavaScript using this service (ex  ...myservice/MapServer/0 ), it does not work.  I have to point the FeatureLayer to one of the SubLayers (1 or 2) in order for the esri layerlist to work.  And then it only works for that one layer.  Is there any way to make the esri layerlist show all of the sublayers when using a FeatureLayer instead of an ArcGISDynamicMapService?

I have sublayers set to "true" but that does not seem to work for anything defined as a FeatureLayer.

Thanks.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Charlie,

Is there any way to make the esri layerlist show all of the sublayers when using a FeatureLayer instead of an ArcGISDynamicMapService?

No that is what a FeatureLayer is a specific sublayer in a map service.

Pointing a FeatureLayer to a group is not going to work.

0 Kudos
DougCollins
Occasional Contributor

Ok, I see.  That makes sense.

I wanted to use a FeatureLayer because I wanted to be able to click to identify on a point to bring up more information, and have the layerlist.  It looks like the tradeoff is either to use a FeatureLayer for "identify" and no layerlist, or an ArcGISDynamicMapService with a "layerlist" but no identify capabilities.  Doesn't look like you can have both capabilities, unless there is some other way to get around it.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Charlie,

  You can absolutely have InfoTemplates assigned to a dynamic map service layer.

ArcGISDynamicMapServiceLayer | API Reference | ArcGIS API for JavaScript | setInfoTemplates

0 Kudos
DougCollins
Occasional Contributor

I had been using version 3.2 of the API for a long time, and just recently started using version 3.16 of the API.  I didn't realize that you could do that with the dynamic map service layer.  I see that it was added at version 3.10.

Great!  Thanks again Robert.

0 Kudos