AnsweredAssumed Answered

esri/dijit/LayerList Question

Question asked by thejohnny on Jul 30, 2015
Latest reply on Apr 18, 2016 by lorieme

Here is what I'm trying to do with the Layer List.

 

I have layers in my mxd that have sublayers upon sublayers.  Here is an example shown below my question.  So in my mxd I have a group layer, 2015 - March Ridership, which then has a sublayer (Weekdays, Saturdays, Sundays), all of which have another sublayer (Ons, Offs).  Is there a way to utilize the layerList to do this?  If not, how can I set it up to simply show one sublayer (see Ex. 2)?  I have tried and tried with no luck.

 

Ex. 1

2015 - March Ridership

  • Weekdays
    1. Ons
    2. Offs
  • Saturdays
    1. Ons
    2. Offs
  • Sundays
    1. Ons
    2. Offs

2014 - September Ridership

  • Weekdays
    1. Ons
    2. Offs
  • Saturdays
    1. Ons
    2. Offs
  • Sundays
    1. Ons
    2. Offs

 

Ex. 2

2015 - March Weekdays

  1. Ons
  2. Off

2015 - March Saturdays

  1. Ons
  2. Offs

2015 - March Sundays

  1. Ons
  2. Offs

 

Currently my widget looks like this as I can't seem to get the sublayer: true working:

      var ridershipWidget = new LayerList(

          {

              map: map,

              layers: [

                {

                    layer:mar15SaturdaysOff

                }, {

                    layer:mar15SaturdaysOn

                }, {

                    layer:mar15WeekdaysOff

                },{

                    layer:mar15WeekdaysOn

                }

              ]

          }, "ridershipList"

      );

     

    
ridershipWidget.startup();

Outcomes