Select to view content in your preferred language

Maps Toolbar Draw : Dojo compatiblity issue

414
1
Jump to solution
05-13-2013 06:11 AM
RajasekarNammalvar
New Contributor II
I am getting the following exception while trying to draw the features(Ploygon, Line, Circle) on the map. The issue has raised exactly "onDrawEnd" event. I am using ESRI-3.2 version.

Uncaught TypeError: Object [object Object] has no method 'apply' dojo.js:15
_549.(anonymous function)._54edojo.js:15
dojo.declare._onDblClickHandlerjsapi.js:19
(anonymous function)dojo.js:15
_549.(anonymous function)._54edojo.js:15
_599._firejsapi.js:19
_599._onDblClickHandlerjsapi.js:19
(anonymous function)

[ATTACH=CONFIG]24241[/ATTACH]

This is my code,
init : function() {
connect.connect(dojo.byId("btnCreatePolygonFeature"), 'onclick', dojo.hitch(this, this.activateDrawingTool, this.drawingToolFeature.polygon));
},

activateDrawingTool: function(tool){
[INDENT]switch (tool) {
[INDENT]case this.drawingToolFeature.polygon:
toolbar.activate(esri.toolbars.Draw.POLYGON);
break;
case this.drawingToolFeature.circle:
toolbar.activate(esri.toolbars.Draw.CIRCLE);
break;[/INDENT]
}     [/INDENT]
map.hideZoomSlider();
},

initialiseView : function() {
dojo.connect(map, 'onLoad', function() {});

connect.connect(map, 'onLoad', function() {
toolbar = new esri.toolbars.Draw(map);
dojo.connect(toolbar,"onDrawEnd",this.addToMap);
});
},


This is my ESRI reference link,
view-source:http://developers.arcgis.com/en/javascript/samples/toolbar_draw/
0 Kudos
1 Solution

Accepted Solutions
RajasekarNammalvar
New Contributor II
The issue resolved. Somehow the "this" object getting null in the following statement.
dojo.connect(toolbar, "onDrawEnd", this.addToMap);

addToMap : function(geometry) {
}


So I have used the addToMap functionality inside the dojo.connect like the following,
dojo.connect(toolbar, "onDrawEnd", function(geometry) {

});


It works fine. Special thanks to Rambalaji to found this.

View solution in original post

0 Kudos
1 Reply
RajasekarNammalvar
New Contributor II
The issue resolved. Somehow the "this" object getting null in the following statement.
dojo.connect(toolbar, "onDrawEnd", this.addToMap);

addToMap : function(geometry) {
}


So I have used the addToMap functionality inside the dojo.connect like the following,
dojo.connect(toolbar, "onDrawEnd", function(geometry) {

});


It works fine. Special thanks to Rambalaji to found this.
0 Kudos