I am trying to modify the Screening widget. In one of its subfolders, "drawtool" in the file drawtool,js it emits the completion of the draw by using:
this.emit("onDrawComplete", [graphics]);
to the widget.js
this.own(on(this._drawTool, "onDrawComplete", lang.hitch(this, function (graphics) {
this._initToCreateAOIBuffer(graphics);
})));
I created my own file under the drawtool folder and I need to emit the same event from that file:
this.emit("onDrawComplete", [thePMPTgraphic]);
However, the emit is not working. The issue is not the thePMPTgraphic, since it was tested.
Any ideas why the emit works in drawtools.js and not in the custom file? I have other functions in the custom file and are working properly.
No it doesn't have any arguments.
In the Screening_pmtools.js there is a function that does a query on a REST service and it results to a Lat, Long. Then, a point graphic is defined and added to a feature layer. At last, the fL is added to the map and the emit is performed. The point is plotted on the map but the emit never worked.
-------
var thePoint = new Point(thecoords, new SpatialReference({
wkid: 4326
}));
var pointWebMercator = webMercatorUtils.geographicToWebMercator(thePoint);
var thePMPTgraphic = new Graphic(pointWebMercator, symbolfoundstart);
this.PtLayerfromPM.add(thePMPTgraphic)
--------
this.map.addLayer(this.PtLayerfromPM);
this.emit("onDrawComplete", thePMPTgraphic);
From the sounds of it nothing in the Screening_pmtools.js file is working because it is not loading or has an error when loading. Have you modeled your Screening_pmtools.js code after the drawTools.js file? Meaning it has a constructor function, etc, etc.