0

I'm very new to ArcGIS and I'm developing a custom widget in the ArcGIS WebApp Builder that will allow me to change the style attribute of a specific layer in my map.

To manually change the style attribute I would open the map, hover over a layer and click 'Change style':

enter image description here

Then I would select the style attribute from the list that appears:

enter image description here

At the moment my JavaScript widget allows the user to pick from a list of (manually entered) layers and style attributes:

enter image description here

The function that is called when the user clicks 'Update' resembles the following:

_updateAttribute: function() {
    var lyr = document.getElementById("layer");
    var att = document.getElementById("attribute");
    var selectedLayer = lyr.options[lyr.selectedIndex].value;
    var selectedAttribute = att.options[att.selectedIndex].value;
    // Pseudo-code;
    // map.layer(selectedLayer).Attribute = selectedAttribute;
}

Is there a way to carry out the operation represented by my pseudo-code?

-1

this sample actually shows what you want to do (click "Explore in the Sandbox" to see live demo)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.