I am trying to turn this JS API sample into a Web AppBuilder custom widget with the WAB Developed Edition.
But not sure where to put the pieces from the sample script in the WAB widget files.
Show x,y coordinates | ArcGIS API for JavaScript 3.29
Thanks
Thanks. I've been through that example. It runs through setting up a widget that writes some text to a panel.
Now I'm looking for an example of how and where to add a map click event function.
I found this kind of helpful to navigate the widget files:
https://community.esri.com/people/andrescastillo08/blog/2019/07/24/how-to-customize-an-app-using-javascript-the-dom-chrome-devtools-and-chromes-debugger
Mike,
OK, it is not as simple as copy and paste the code into the correct file though. The logic of the widget (i.e. the javaScript code portion) goes in the Widget.js and the html portion of the sample goes in the Widget.html. WAB already has a map object so be sure not to try and use that portion of the code. The best starting place for creating widgets is the how to guide here:
Create a custom in-panel widget—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers
Yes, but I am looking more for the process of turning this simple JS into a widget.
I've changed the event trigger from mouse-move to click and want that to be the entire functionality of the widget.
The existing coordinate widget is way more than I need.
WAB already has a widget that does this.
Coordinate widget—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.