Select to view content in your preferred language

skech widget is ignoring availableCreateTools property

141
1
2 weeks ago
RakeshAjwani
Emerging Contributor

I am trying to create a sketch widget in esri javascript. I am using the 4.30 libraries. I am setting a property called availableCreateTools and giving it 6 or 7 tools but the api just does not render the tools I am providing. It goes back to default values.

Here is my code, attached is the screenshot from the debugger.

  sketch = new Sketch({

      layer: graphicsLayer,

      view: view,

     availableCreateTools: ["point", "polyline", "rectangle", "freehandPolygon", "multipoint", "freehandPolyline", "polygon"],

      creationMode: "update"

  });

Is this a server side setting that needs to change or a bug in the api or is there a different way to achieve this?

 

Any insight is appreciated.

 

Best

Rakesh

0 Kudos
1 Reply
JoelBennett
MVP Regular Contributor

The Sketch widget overrides the value of availableCreateTools supplied in the constructor.  Whether that's a bug or not is debatable (I would suggest that it is), but whatever the case, you should be able to set it after the constructor instead:

sketch = new Sketch({
	layer: graphicsLayer,
	view: view,
	creationMode: "update"
});

sketch.availableCreateTools = ["point", "polyline", "rectangle", "freehandPolygon", "multipoint", "freehandPolyline", "polygon"];

 

0 Kudos