Sunday, 1 December 2019

feature layer - Using toggle button with ArcGIS API for JavaScript?


I am trying to use two toggle buttons which have been added to a map to toggle layers on and off in my simple web application. I am having problems getting the toggle button to respond when clicked or checked.


This is what I have done so far. Added my button to the map and given it an id so I can grad it using dijit.byId


   









I then try listen for the onChange event with dojo.connect I put this in the init function that is called with dojo.addOnLoad(init);.


dojo.connect(dijit.byId('imagery'), 'onChange', layerVisibility(mapLayers[0]));

For some reason this does not run my function. I have tried replacing my function with an alert box to test it with no luck.


Here is an example of how I am using the code within a web application.










FeatureLayer On Demand




















Where could I have gone wrong?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...