Observation:
Inside my template of a custom widget that I’m making, there’s a line:
<input type="text" data-dojo-props="placeHolder:'Search...'" data-dojo-attach-event="onchange: search"/>
This works fine as in on change, the search function of my widget is called. but the display is plain input box, not dijit’s fancy display. So I do this:
<input type="text" data-dojo-type="dijit.form.TextBox" data-dojo-props="placeHolder:'Search...'" data-dojo-attach-event="onchange: search"/>
Now, display is fine but search is not called on change. Now I did this:
<input type="text" data-dojo-type="dijit.form.TextBox" data-dojo-props="placeHolder:'Search...'" data-dojo-attach-event="onchange: random_name"/>
The whole page crashes and debugger tells me dojo could not find the function random_name in the "scope".
To give the whole code, here they are:
EDIT: in place of onchange, I’ve tried onChange, ondijitchange or any other event like ‘onclick’, ‘onClick’, ‘ondijitclick’ etc but search never gets called whatever I do in the browser.
Well looking at your code, and the dojo 1.8 input example I would perhaps remove the attach event from the template and add it within the ‘startup’ function in your widget js file using dojo/on.
So taking your ‘MainViewWidget.js’ code and your template markup, here are the amendments I would try:
first the template change…
and the widget change…
You may need to use dojo’s lang.hitch for the event handler if you want to reference the widget using ‘this’ inside the ‘on’ handler.
Hope that helps and I didnt have any typos.