AnsweredAssumed Answered

Delete Multiple Graphic

Question asked by JerryGarcia on Nov 16, 2014
Latest reply on Nov 16, 2014 by rscheitlin

I am trying to delete all graphics within a polygon, but the following code only removes the first graphic.  Any suggestions?

 

fieldGeom is a valid polygon.  It removes one point graphic, but then exits loop and does not remove a second point graphic.

 

Thanks!

 

        this.pointGraphics.graphics.forEach(function (g) {
            for (var x = 0; x < fieldIds.length; x++) {
                fieldGeom = that.getFieldGeometry(fieldIds[x]);
                if (fieldGeom.contains(g.geometry) === true) {
                    that.pointGraphics.remove(g);
                }
            }
        });

Outcomes