"Invalid template" error when activating edit toolbar

832
2
05-26-2013 06:30 PM
TomBarrett
New Contributor
Given a polygon graphic created with the draw toolbar, I am activating the edit toolbar to modify it.

// geoObj.polyObject is the polygon graphic
this.editToolbar = new esri.toolbars.Edit(this.map);
this.editToolbar.activate(esri.toolbars.Edit.EDIT_VERTICES, geoObj.polyObject);



This is just like in the code samples, but I'm getting the following dojo error (in chrome and firefox):
Uncaught Error: Invalid template: <table class="dijit dijitMenu dijitMenuPassive dijitReset dijitMenuTable" role="menu" tabIndex="${tabIndex}"
    data-dojo-attach-event="onkeypress:_onKeyPress" cellspacing="0">
 <tbody class="dijitReset" data-dojo-attach-point="containerNode"></tbody>
</table>

 serverapi.arcgisonline.com:34
_94.buildRendering serverapi.arcgisonline.com:34
_2cf serverapi.arcgisonline.com:15
_1123.buildRendering serverapi.arcgisonline.com:34
_d52.create serverapi.arcgisonline.com:34
_d52.postscript serverapi.arcgisonline.com:34
(anonymous function) serverapi.arcgisonline.com:15
_1._addControllers _VertexEditor.js:19
_1.constructor _VertexEditor.js:19
(anonymous function) serverapi.arcgisonline.com:15
_2.mixin.create _VertexEditor.js:19
_1._enableVertexEditing edit.js:19
_1.activate edit.js:19
ArcGISMapProvider.beginGeoEdit widget.js:4040
NGWidget.OCA_GeoMap.Geo.editStart widget.js:1827
NGWidget.OCA_GeoMap.Ob


Googling tells me that dojo is probably throwing this error due to whitespace at the end of the dijit template.  But since it's all done from deep in the (minified) arcGIS js library I'm not able to fiddle with it to confirm the cause.

I've tried catching this error with a try/catch block, and the vertex handles then show up, and can be used to edit the shape, but when I deactivate the toolbar later, the vertex handles do not disappear, which I suspect is because the vertex editor wasn't properly set up, due to this error.

Any suggestions?

Thanks
Tom
0 Kudos
2 Replies
TomBarrett
New Contributor
Any insights on this?  It looks to me like a bug in the arcGIS JS and if there's a way to work around it I'd like to know!
0 Kudos
TomBarrett
New Contributor
So with no responses here, I started trawling through the minified javascript.  It seemed to be trying to add the menu to support the deletion of vertices.  (NB this feature does not actually work - in the demo at http://help.arcgis.com/en/webapi/javascript/arcgis/samples/ed_feature_creation/ I right-click the verticies and no menu shows up.  Tested in Firefox.).

When I added { AllowDeleteVertices : false } to the options when activating the edit toolbar, the "invalid template" error went away.

So that's my workaround for now.  Maybe it's useful to others experiencing this problem.  Hopefully ESRI can fix this API bug some time.
0 Kudos