Login Register

registering new widgets so they work with the template system?

I guess this question is in two parts:

1) How do I make my own package to collect all the widgets etc that I create into it i.e.
js/dojo/foo/*

2) How do get new widgets that I create registered so that when the page is parse after it has finished loading my widgets get picked up and instanciated i.e.

<div dojoType="foo.wizzBangWidget" >Something here</div>

There doesn't seem to be anything around on it :(

is your 'foo' namespace a peer of dojo?

foo should be a peer of dojo/dijit/dojox in your directory structure, otherwise you'll have to use registerModulePath to set that up

I found that if I just /*

I found that if I just

dojo.require('foo.MyWidget');

in the header then it just works, but I would like some automatic way for this to happen. How should I use registerModulePath to get this going?

If your code is in

If your code is in js/dojo/foo/* (so foo is a sibling to dijit, dojox), then you do not need to use dojo.registerModulePath(). However, for all widgets you reference via dojoType="" on an HTML element, you have to have an explicit dojo.require() for the module. The attempted auto-loading of widgets based on dojoType is not supported in Dojo 0.9+.

Yes, I got it working now.

Yes, I got it working now. There seems to be a bug with this Drupal template (I think thats where it is) as when I click on the link to 'reply' directly to your last comment I'm sent to:

http://www.dojotoolkit.org/comment/reply/6636/14937

which is a white screen where as this replay was made from:

http://www.dojotoolkit.org/comment/reply/6636

and seems to work, but is not directly on your comment but the main post :(

Strange...?