Why won’t my dashlet fire?

I was developing a new dashlet for my clients’ Alfresco installation, MyOffice.

Update: there’s an extension of this post here. If you put a minus sign in your HTML element ID, it will also not fire.

So I had a client-side javascript where I extended the Alfresco.dashlet class (that’s how I construct my objects lately).  So my code was something like…

(function () {
/*blah*/
Alfresco.dashlet.ChangeRequestClient = function(htmlId) {
return Alfresco.dashlet.ChangeRequestClient.superclass.constructor
.call(this,
"Alfresco.dashlet.ChangeRequestClient", htmlId, ["json", "button", "menu"]);
}
YAHOO.extend(Alfresco.dashlet.ChangeRequestClient,
Alfresco.component.Base,
{
/*blah*/
onReady: function blah (htmlId) {
/*blah till the end*/
})();

I was constructing this, the script was firing up, the constructor did its job, but my onReady function didn’t work. So I checked and checked and checked. And what I found was that I was calling the script with

new Alfresco.dashlet.ChangeRequestDashlet();

And now my onReady was waiting for undefined or something to be ready, which was never.

Lesson learned:

Always call your dashlets with “${args.htmlid}” parameter!

 

 

One thought on “Why won’t my dashlet fire?

  1. Pingback: Don’t put minus sign in component names for Alfresco dashlets and other page components « Alfresco « zlayer.net

Leave a Reply