Hi Kantis,
I think that inside _generatePreview method you have different context for this object. It's a current function context instead of widget context. The problem is related with executing _generatePreview function inside onChange event. In that place the context change.
You could modify _generatePreview method and use lang.hitch to keep the widget context. You already referenced the "dojo/_base/lang" so there is no dependencies to add.
The modified code should looks like:
// --- your code // Event used to notify EPiServer that the property value has changed onChange: function(value) { lang.hitch(this, this._generatePreview); }, // --- your code
Hi Grzegorz,
Thanks for your reply. Sadly this is the same in both contexts and using lang.hitch didn't make a difference. Do you happen to know why I'm not getting any JS-errors when dojo breaks? Might help in tracking down the problem :)
Solved it. It was crashing due to removeHours being undefined. Also, connect didn't seem to work. I used dojo/on instead which works fine :)
I'm trying to create a custom editor for business hours. I'm having problems connecting programmatically created buttons to event-handlers using this.connect. The form edit mode of the editor stops loading when I add the this.connect line (line 132). Anyone had this problem? Why doesn't Dojo/Dijit show any errors?