I have a custom widget that I've defined as shown below:
dojo.declare('myWidget', [dijit._WidgetBase, dijit._Templated],
{
'templateString':'<span>' +
'<a dojoAttachPoint="linkNode" href="blah.php">' +
'<img class="thumbNail" src="blahthumb.php" />' +
'</a>' +
'<h4 dojoAttachPoint="title" class="title">${blahtitle}</h4>' +
'</span>',
'stuff':null,
'startup':function()
{
dojo.connect(this.linkNode, 'onclick', function(e){dojo.stopEvent(e);alert('hi');});
}
});
When I programmatically create the widget and add it to the page like this:
...
f = new myWidget(stuff);
f.startup();
li = dojo.create('li', {'class':'thingy'});
dojo.place(f.domNode, li);
dojo.place(li, this.gallery); // inside another widget
...
The onclick event connected in the startup method doesn't seem to be firing. I've tried different ways of assigning it but nothing seems to work.
Is there something wrong with the way I'm setting up the onclick event?