[Dojo-interest] BIG TROUBLE - After WebBuilder dojo.byId is not found!

18 views
Skip to first unread message

Joseph Morgan

unread,
May 26, 2011, 11:45:25 AM5/26/11
to dojo-i...@mail.dojotoolkit.org

We are very new to Dojo, and have put out our first semi-production release.  The pages were loading very slow, like 1 min for a relatively simple page, and we realized we should probably use the WebBuilder to help us.  So, we loaded our page in to the WebBuilder’s Auto-Analyse tab, and it seemed to pick modules perfectly.  Then we built our optimized dojo.js file, and linked to it rather than the previous one at the google APIs location.

 

This must be where we are lost.

 

First, if we keep our dojo.require(“dojo.parser”) code in there, we get a javascript error saying that it could not load “dojo.parser”.

 

So, we removed all the dojo.require’s, thinking that our new dojo.js contains everything we need.  However, if we do that, we get an error saying “dojo.byId is not a function”

 

How does one properly tie all this together after WebBuilder returns the dojo.js file?

 

Karl Tiedt

unread,
May 26, 2011, 11:50:23 AM5/26/11
to dojo-i...@mail.dojotoolkit.org
Can you provide more details on what your build includes? (so a test
can be done using the same config for the builder etc?) -- a
profile.js would be awesome if it generates that for you...

as for dojo.require... you should never have to remove those...

Are you still including dojo.js in your pages? + your layer file?

-Karl Tiedt
________________________________________________________
Dojotoolkit: http://dojotoolkit.org
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api
Tutorials: http://dojotoolkit.org/documentation

Dojo-i...@mail.dojotoolkit.org
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Joseph Morgan

unread,
May 26, 2011, 12:03:50 PM5/26/11
to dojo-i...@mail.dojotoolkit.org
OK... now you're going to know how dumb I really am!

It did not create a profile.js file. It didn't create a layer file, so
not sure what that is. I used the Simple Mode.

Go to: http://suntrust.moneymatch.com/mm/getGuide?guideID=6

This page has the original, un-optimized dojo references so you can see
what we did. Look at the source. We really don't need the Button and
ProgressBar, but I don't think that's the problem.

Tom Elliott

unread,
May 26, 2011, 1:31:49 PM5/26/11
to dojo-i...@mail.dojotoolkit.org
Joseph, I've not used the web builder so I'm not 100% sure this is correct, but when you build a layer using the command line tools it generally does *not* include dojo core (i.e. the stuff you get when you put <script src="dojo.js" /> in your page.

In your optimized page, are you sure you've got a script tag for both dojo.js (first) and then yourlayer.js?

Tom

Richard Yee

unread,
May 26, 2011, 10:43:04 PM5/26/11
to dojo-i...@mail.dojotoolkit.org
Installing Yahoo YSlow or Googles PageSpeed in your browser will help you determine what is causing your pages to load slowly. They will also suggest how to make them load faster.

Richard

Sent from my iPhone
________________________________________________________

Nick Fenwick

unread,
May 27, 2011, 7:30:16 AM5/27/11
to dojo-i...@mail.dojotoolkit.org
On 26/05/11 22:45, Joseph Morgan wrote:

We are very new to Dojo, and have put out our first semi-production release.  The pages were loading very slow, like 1 min for a relatively simple page, and we realized we should probably use the WebBuilder to help us.  So, we loaded our page in to the WebBuilder’s Auto-Analyse tab, and it seemed to pick modules perfectly.  Then we built our optimized dojo.js file, and linked to it rather than the previous one at the google APIs location.


From your description, you've not properly copied the 'built' dojo and made your site use it.  You're just linking to the dojo.js that was built.  On its own, this is not nearly enough.  You link to dojo.xd.js at the CDN and that's enough, but when hosting a custom build yourself, you need a whole lot more.

When building by hand, you start with a -src release, e.g.

src/dojo (containing dojo/dojo.js)
src/dijit
src/dojox
src/util/buildscripts/build.sh
src/util/buildscripts/profiles/myprofile.profile.js

You run build.sh, pointing it at myprofile with suitable arguments.  By default it will output to ../../release and produce a release build in a directory called 'dojo', but this can be changed via arguments (http://dojotoolkit.org/reference-guide/build).

src/release/dojo/

in that dir is what looks a lot like a copy of the dojo src build .. but it's all optimised.

src/release/dojo/dojo (containing dojo/dojo.js and possibly mylayer.js)
src/release/dojo/dijit
src/release/dojo/dojox

You need to make this entire src/release/dojo directory available to your app.  When you include dojo/dojo/dojo.js, it will look in relative paths like ../dijit/stuff.js for a module called "dijit.stuff".

I've not used the web builder, but I think one should start with this basic knowledge before using more advanced tools.

Nick

Mark Easton

unread,
May 27, 2011, 8:30:14 AM5/27/11
to dojo-i...@mail.dojotoolkit.org
We've used the web builder with great results so I think the advice to
go to the custom build which is pretty complicated is not perhaps
necessary.
After the web build as I remember everything is built into the single
dojo.js file that is part of what the builder provides so you should
not need the complete /dojo /dojox etc directory structure.
All you need is to host the dojo file. You definitely need to keep
your 'requires' statements in there.
One thing you can do to confirm the dojo file has all you need to just
open the dojo.js file and search for sone of the specific modules you
included e.g. If you included dojox.mobile search for some of those
widget definitions.

James Thomas

unread,
May 27, 2011, 1:50:02 PM5/27/11
to dojo-i...@mail.dojotoolkit.org
Sorry to hear you're having trouble Joseph, did you manage to get the problem fixed? 

If not, I can see about looking into it for you. 

Joseph Morgan

unread,
May 27, 2011, 1:55:00 PM5/27/11
to dojo-i...@mail.dojotoolkit.org

I’ve been held up by an unrelated production issue… will get back to it soon

 

From: dojo-inter...@mail.dojotoolkit.org [mailto:dojo-inter...@mail.dojotoolkit.org] On Behalf Of James Thomas
Sent: Friday, May 27, 2011 12:50 PM
To: dojo-i...@mail.dojotoolkit.org
Subject: Re: [Dojo-interest] BIG TROUBLE - After WebBuilder dojo.byId isnotfound!

 

Sorry to hear you're having trouble Joseph, did you manage to get the problem fixed? 

Joseph Morgan

unread,
May 27, 2011, 2:49:48 PM5/27/11
to dojo-i...@mail.dojotoolkit.org

Sorry for not getting back quicker.

 

The simple mode doesn’t build a layer file…. So I switch to advanced, where it lets me do that, and I got both, the dojo.js, and I named my layer file dojoLayer.js. 

 

I am certain the JS files are loading into the page correctly as I can see them correctly in the firebug source. 

 

When I load the page, I see several errors about things not being found:

 

“Could not load ‘dojo._firebug.firebug’ – Just because I’m using firebug – no big deal I suspect

“dojo.declare is not a function”

“Could not load ‘dojo.parser’; last true ‘./parser.js’

 

This is the head of my page(“…” is for excerpts that don’t matter):

 

        <head>

               <title>…</title>

               <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1" />

               <meta name="description" content="…" />

               <meta name="keywords" content="…" />

              

               <link rel="stylesheet"

                       href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css"

                       media="screen"/>

              

               <script

                       src="http://www.mysite.com/js/dojo.js"

                       data-dojo-config="isDebug: true, parseOnLoad: true">

               </script>

               <script

                       src="http://www.mysite.com/js/dojoLayer.js">

               </script>

               <script>

                       dojo.require("dojo.parser");

                       dojo.require("dojo.fx");

                       dojo.require("dojo.fx.easing");

                       dojo.require("dijit.layout.BorderContainer");

                       dojo.require("dijit.layout.ContentPane");

                       dojo.require("dijit.Tooltip");

                       dojo.require("dijit.Dialog"); 

                       dojo.require("dijit.form.ComboBox");

                       dojo.require("dijit.form.RadioButton");

                       dojo.require("dijit.form.Slider");

                       dojo.require("dijit.form.NumberSpinner");

                      

                       dojo.ready(init);

                      

                       function init() {

                               var pageContentDiv = dojo.byId("#bodyContainer");

                               fade("#bodyContainer", "in", 1000);

 

                               setTimeout("ieFadeIn()", 1000);

                       }

                      

                       function fade(selector, direction, duration) {

                               var items = dojo.query(selector);

                              

                               for (var i = 0; i < items.length; i++) {

                                      if (direction == 'out')

                                              dojo.fadeOut({ node: items[i], duration: duration }).play();

                                      else

                                              dojo.fadeIn({ node: items[i], duration: duration }).play();

                               }

                       }

                      

                       function ieFadeIn() {

                               dojo.query('.startHidden').removeClass('startHidden');

                       }

                      

               </script>

        </head>

Karl Tiedt

unread,
May 27, 2011, 2:52:51 PM5/27/11
to dojo-i...@mail.dojotoolkit.org
Did you upload the entire dojo directory paths to your server? /dojo
/dijit /dojox ? even in a build its best to include them (some modules
do have to rely on lazy loading tiny bits of their code (GFX in
particular)

Joseph Morgan

unread,
May 27, 2011, 4:04:37 PM5/27/11
to dojo-i...@mail.dojotoolkit.org
I get it... makes perfect sense. I was under the impression the
resulting JS files would have everything needed, somewhat like an
old-fashioned "make". Ok.. I'll try that.

-----Original Message-----
From: dojo-inter...@mail.dojotoolkit.org
[mailto:dojo-inter...@mail.dojotoolkit.org] On Behalf Of Karl
Tiedt
Sent: Friday, May 27, 2011 1:53 PM
To: dojo-i...@mail.dojotoolkit.org
Subject: Re: [Dojo-interest] BIG TROUBLE - After WebBuilder
dojo.byIdisnotfound!

Reply all
Reply to author
Forward
0 new messages