How to properly extend the Sketch Widget.

1066
2
Jump to solution
07-30-2019 12:25 PM
JustinMartinek
New Contributor II

We have need of extending the sketch widget to allow for some custom behaviors and buttons.  I followed the steps given in https://github.com/jcfranco/dev-summit-2017-customizing-widgets

We started by installing the types of both arcgis and dojo:

npm init --yes
npm install --save @types/arcgis-js-api
npm install dojo-typings --save-dev

packages.json

Set up the typscript config as such:

When I copy over the widget and compile, I get the following.

Errors:

I attempted to resolve the paths, but I can't find these references.  When I look in the project on git hub, some of these paths do not exist.  I must have something set up incorrectly.  Any help putting me #in the right direction would be wonderful.

0 Kudos
1 Solution

Accepted Solutions
ReneRubalcava
Frequent Contributor II

Are you copying the widget from https://github.com/Esri/arcgis-js-api/tree/4master/widgets ? That won't work unless you install all the same dependencies we use via installing the JSAPI via npm. They're really meant more as a guide and not to be used directly, although you could with some effort.

Check out the more recent version of that presentation here https://github.com/jcfranco/uc-2019-customizing-widgets

The idea is that you can extend the widget as shown in the presentation.

View solution in original post

2 Replies
ReneRubalcava
Frequent Contributor II

Are you copying the widget from https://github.com/Esri/arcgis-js-api/tree/4master/widgets ? That won't work unless you install all the same dependencies we use via installing the JSAPI via npm. They're really meant more as a guide and not to be used directly, although you could with some effort.

Check out the more recent version of that presentation here https://github.com/jcfranco/uc-2019-customizing-widgets

The idea is that you can extend the widget as shown in the presentation.

JustinMartinek
New Contributor II

Thank you. It seemed to start out the same way as the one I was following, but the extending part was much more helpful.  

0 Kudos