I have some conceptual problem with using Dojo's class-like objects created with dojo/_base/declare.
I have created the following module:
define(["dojo/_base/declare", ....], function(declare,....){
return declare('my.widget', null ,function(..){
startup: function() {
....
new Button({onClick: this.newItem}, newButtonNode)
},
newItem: function() {
this.openDialog({}, this.saveItemCallback)
},
openDialog: function(item,callback){...},
saveItemCallback: function(item){....}
})
})
The problem is, that the function newItem
isn't functioning, because when it's called from button click, this
points to Button widget, and not to the 'my.widget' instance.
I'm confused. How can I refer to the 'my.widget' instance? In the Dojo classes I've read the current instance is available under this
.