Modifying an exisitng widget

214
5
12-07-2021 03:18 AM
RemiBecheru
New Contributor II

Are there any possibilities to get the code of a widget and modify the render method?

I checked the youtube resources -> https://www.youtube.com/watch?v=o4yzbiHIAT8&t=125s

But in there they use a tsx file where you can modify whatever you want. Now looks like those tsx files are no longer available.

 

0 Kudos
5 Replies
AndyGup
Esri Regular Contributor

@RemiBecherucorrect, as of 4.21 we no longer support directly modifying the out-of-the-box widget View code. Which widget are you using? Some options going forward are extending the ViewModel, or building a custom widget.

A common example for extending the ViewModel is SketchViewModel, here's the doc: https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.ht... and here's an example: https://developers.arcgis.com/javascript/latest/sample-code/layers-mapnoteslayer/ 

We are looking into adding a sample and some additional doc on this.

RobertScheitlin__GISP
MVP Esteemed Contributor

@AndyGup 

Unfortunately your example url seems to be a non-public url.

0 Kudos
AndyGup
Esri Regular Contributor

Thanks @RobertScheitlin__GISP link has been updated to an existing sample. The other sample (SketchViewModel Styler) will be available in the upcoming 4.22 release.

0 Kudos
RemiBecheru
New Contributor II

@AndyGup I am interested in the CoordinateConversion widget. Mainly I am not satisfied with the rendered UI, but there are some other things as well.

For example, I would like to input coordinates directly by clicking on the coordinates format instead of clicking on the dedicated edit button.

 

 

0 Kudos
Noah-Sager
Esri Regular Contributor

Hi @RemiBecheru, you can use the methods from the CoordinateConversionViewModel in your own UI, if that is of interest to you.

https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-CoordinateConversion-Coor...

I'd like to hear more about your thoughts on the CC widget. Feel free to outline them here, or message me directly.

0 Kudos