So, awhile back, I posted this thread about changing the label associated with a layer checkbox in the LayerList widget. The solution posted in that thread (setting id: "some layer name") does not seem to work using the 3.16 API version of the layerList widget.
code snippet:
// Initialize and set up the LayerList layerWidget = new LayerList({ map: app.map, showLegend: true, showOpacitySlider: true, showSubLayers: false, layers: [ {layer:wsdotBridgeLayer, visibility:true, id:"WSDOT Bridges" }, {layer: KingCoBridgeLayer, visibility:true, id:"King County Bridges" }, {layer:priorityRoadsLayer, visibility:true, id:"Priority Roads" } ]},"layerList"); layerWidget.startup();
Result at load:
Has anybody encountered this and found a solution?
Steve
Solved! Go to Solution.
Mehretab,
Actually it does have a title property it is just not documented.
The LayerList also honors the title option in the layers array, I find that helpful for individual feature layers:
var layerList = new LayerList({ map: mapMain, showLegend: true, layers: [{ layer: lyrSide, title: "Sidewalks", }, { layer: lyrBike, title: "Bicycle Lanes", }, { layer: lyrTrans, title:"Transit Lines" }, { layer: lyrShlt, title:"Sheltered Stops" }, { layer: lyrStops, title:"Transit Stops" }] //layerInfo }, "layerListDiv");
David Coley THANK YOU! That's the golden ticket. Why hasn't this made it into the documentation?....
sure glad to help, I haven't been able to contribute in awhile. Sometimes its just the small things