Detect how layer is rendered?

Discussion created by sjacksonesriaustralia-com-au-esridist Employee on Jan 16, 2013
I have a dynamic map service, served up with just one solid colour fill symbology, no classification, Dynamic Layers enabled.
This just holds one layer, suburbs.

I have a web app, where when a drop down is changed (list of the fields), a function is called to perform a generateRenderer using the field passed to the function from the dropdown, and this generates a nice thematic map server-side to send to my app.

Back on the map, I have some popups going on, working with the very same layer.

When one particular field (out of 6) has been chosen from the dropdown list, I need to make sure my popup shows some different content.

Part of me is thinking that an easy approach might be to also update a global variable with the current dropdown choice, and then when the popup function fires, check this global variable and if its the particular field, do something else.

However, the internet is telling me to avoid using globals where possible, so I was wondering if in my popup function i could do some kind of conditional like this:

if (map.getLayer("thatDynamicMapService").rendererField = theOneIWantToKnowAbout)
then do this:

Unfortunately for me, that rendererField property of a layer, does not exist.  (I made it up).
How would one go about detecting how a particular layer within a dynamicMapService has been rendered?  Im sure it might have been easier if it were a FeatureLayer, but its not.

Happy to hear the answer is that its not possible, but would like to know.  Thanks