AnsweredAssumed Answered

Multi graphic selection

Question asked by Alfonso_CLUS on Nov 10, 2017
Latest reply on Nov 13, 2017 by Alfonso_CLUS


I'm very new with WAB and I found some unexpected behavior. I created a simple widget for selecting features by clicking on the map. The widget retrieves the graphics clicked on a featurelayer and put them in the map's graphics layer and the featurelayer is removed from the map when the widget is closed. It let you multiple selections keeping the control key pressed.


The first time the widget is opened, everything is ok. However, once it was closed and reopend again, if you click the first time it catch only one graphic, but the succeeding clicks, it catches more than one for each click and the number increments with the times you close and reopen the widget. That means that, for example,  for three different clicks  it appear selected 5 or 7graphics, the two of the graphics appear repeated several times.


I think it is related because closing only remove the featurelayer from the map, but remains in the widget for the next uses.

Should I destroy the featurelayer every time I close the widget and create it again when the widget opens?