[Dojo-interest] Loading Dojo XD

James Burke jburke at dojotoolkit.org
Mon Apr 13 12:36:46 EDT 2009


It looks like this declare:

 dojo.declare("my.RoundedContentPane",[dijit.layout.ContentPane,dijit._Templated],{...

is done in the HTML page after doing some dojo.require calls. In the
xd case, the dojo.require calls are async calls, so the modules
probably have not loaded by the time that dojo.declare call runs. Two
solutions:

1) Wrap the dojo.declare in a dojo.addOnLoad callback.This means
setting djConfig.parseOnLoad: false, then explicitly calling
dojo.parser.parse() after your dojo.declare call runs.

or even better:

2) Put the my.RoundedContentPane in a separate JS file that is loaded
via dojo.require. No dojo.addOnLoad wrapper needed, and parseOnLoad
can stay as true/no explicit dojo.parser.parse call.

Modules loaded via dojo.require are not evaluated until all of their
dojo.required dependencies are loaded. The dojo.addOnLoad wrapper is
only needed in the top-level HTML page. So solution #2 should be
favored where possible.

James

On Mon, Apr 13, 2009 at 8:28 AM, Andy Daykin <adogg31 at msn.com> wrote:
> Hello, I have been having some problems loading my website
> http://andydaykin.com/ XD. I am using the XD version of the dojo and fisheye
> files, and then using dojo.require for importing all of the other stuff. My
> site worked fine when I was using the dojo 1.3 locally on my server.
>
> Firebug gives a few errors now when my site loads. The first one is:
>
> "dijit.layout is undefined http://andydaykin.com/Line 49".
>
> I believe that this is referring to the rounded content pane that I am
> using. I got the code from somewhere on the site
> http://archive.dojotoolkit.org/nightly/dojotoolkit I can't find it there
> now.
>
> Thanks,
>
> -Andy
>
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest at mail.dojotoolkit.org
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
>


More information about the Dojo-interest mailing list