revised: how can I access className?!

146
1
04-30-2020 09:30 AM
CamCode
New Contributor III

Revised attempt at my previous question:

I am successfully adding a class to my graphic layer.... previously I was using an ID.. I console.log(myNewGraphicLayer) and it's found, the added class below: vvv

  1. attributionDataUrl: (...)
  2. attributionVisible: (...)
  3. className: "someThing" <-----------------------------------
  4. elevationInfo: (...)
  5. fullExtent: (...)
  6. graphics: (...)
  7. hasAttributionData: (...)
  8. id: (...)
  9. legendEnabled: (...)
  10. listMode: (...)
  11. load: ƒ (e)
  12. loadError: (...)

I added it this way: vvvv

    let graphicsLayer = new GraphicsLayer({
      //id: "someThing", <------- works, but I am adding many need to use class
      className: "someThing"
    });

I am perplexed, because this will work when ID is added...

const polyDrawline = map.findLayerById('someThing');

but this will not work when className is added...

const polyDrawlineS = map.findLayerByClassName('someThing');

how do I access my className?

Tags (1)
0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Esteemed Contributor

Cam,

     The map class does not have a method by that name.

https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#methods-summary 

What exactly are you trying to do? Will the findLayerById not work for you?

0 Kudos