I am going through the custom widget tutorial here: Create a custom in-panel widget—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developer...
On Step 8, when I click the icon, I get the following error:
create widget error: widgets/samplewidgets/MyWidget/Widget
In DevTools I see:
Unexpected identifier
WidgetManager.js:108 create [widgets/samplewidgets/MyWidget/Widget] error:TypeError: clazz is not a constructor
Any ideas? I am using version 1.3 of web appbuilder. Thank you.
Andrew,
I would have to see your code but it seems like you are missing a comma in your syntax. Probably in the requires or functions.
Thanks Robert,
I copied and pasted the code, so I'm not sure. Here is the code in my Widget.js file.
define(['dojo/_base/declare', 'jimu/BaseWidget'],
function(declare, BaseWidget) {
//To create a widget, you need to derive from BaseWidget.
return declare([BaseWidget], {
// Custom widget code goes here
baseClass: 'jimu-widget-mywidget'
startup: function() {
this.inherited(arguments);
this.mapIdNode.innerHTML = 'map id is:' + this.map.id;
},
//methods to communication between widgets:
});
});
Andrew,
OK, you have to put a comma after baseClass: 'jimu-widget-mywidget'. If you add a function like you did startup then the code block needs to know that something is suppose to follow baseClass: 'jimu-widget-mywidget' and that is what the comma denotes (sort of).
Actually I found in one of your posts that you said a comma after the baseClass line is needed if the startup line is uncommented. I added this and it works now. Thanks!