I am using dojo in ESRI's Web AppBuilder environment (which uses the ESRI Javascript 3.x API).
Anyway, I create a button, and in the button's onClick method, I want to be able to call another function using lang.hitch (to keep function in scope). But the called function takes a parameter, and I can't seem to pass it in. I can only call the function, like this.
this.myDialogBtn1 = new Button({
label: "Create New Location",
disabled: false,
onClick: lang.hitch(this, this._createNewLocation)
}).placeAt(this.createNewLoc)
And of course, my _createNewLocation function needs to take a parameter, like this.
_createNewLocation(param){...do stuff}
I'm not sure how I could pass in that parameter to the onClick method. Just adding the parameter like this doesn't work. It throws a TypeError. Any ideas?
lang.hitch(this, this._createNewLocation(param))