How to disable multiselect for SketchViewModel?

639
2
03-14-2019 08:25 AM
ChristianAlfons
New Contributor II

I don't want to allow multiselect (shift + click) in my SketchViewModel, i.e., the user should not be allowed to select more than one graphic at a time. How to disable multiselect for SketchViewModel with ArcGIS JavaScript API 4.10?

Update 1: The following code seems to do the trick, but it's kind of a hack:

this.sketchViewModel.updateGraphics.watch("length", (e) => {
  if (this.sketchViewModel.updateGraphics.length > 1) {
    this.sketchViewModel.cancel(); // Or some other action
  }
});‍‍‍‍‍

Update 2: With ArcGIS JS API 4.11, you can now do this:

this.sketchViewModel.defaultUpdateOptions.multipleSelectionEnabled = false;
0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Christian,

   That sounds like a great enhancement request. To get things like this added to the API you can contact esi tech support to file the request or submit an Idea to the Ideas space on GeoNet.

0 Kudos
ChristianAlfons
New Contributor II

Alright!

0 Kudos