Thanks Robert,
I get the following error:
fail to open widget Demo. TypeError: Cannot read property 'on' of undefined
Here is what I have in my widget.js
define(['dojo/_base/declare', 'jimu/BaseWidget', 'dojo/dom', "dojo/on",'dojo/_base/lang'],
function(declare, BaseWidget, dom, on, lang) {
//To create a widget, you need to derive from BaseWidget.
return declare([BaseWidget], {
// DemoWidget code goes here
//please note that this property is be set by the framework when widget is loaded.
//templateString: template,
baseClass: 'jimu-widget-demo',
postCreate: function() {
this.inherited(arguments);
console.log('postCreate');
},
startup: function() {
this.inherited(arguments);
this.mapIdNode.innerHTML = 'map id:' + this.map.id;
console.log('startup');
},
onOpen: function(){
console.log('It is open, come on in!');
on(this.clear, 'click', lang.hitch(this, function(evt){
console.log("It is clear!")
}));
},
onClose: function(){
console.log('onClose');
var test = this;
},
onMinimize: function(){
console.log('onMinimize');
},
onMaximize: function(){
console.log('onMaximize');
},
onSignIn: function(credential){
/* jshint unused:false*/
console.log('onSignIn');
},
onSignOut: function(){
console.log('onSignOut');
}
});
});
And here is what I have in my widget.html:
<div>
<button id="clear" data-dojo-type="dijit/form/Button" type="button" data-dojo-attach-point="button">Clear All</button>
</div>
Any ideas what I did wrong?
Tim