[Dojo-interest] dojoAttachPoints not being set?

Chap Lovejoy chap at chaptastic.net
Tue May 24 19:12:34 PDT 2005


Dylan,

Thanks for the tips. I think I must be suffering a brain disconnect  
somewhere. I used the SlideShow widget as a template and it contains  
the line
     dojo.hostenv.startPackage("dojo.webui.widgets.SlideShow");
But never defines a SlideShow class, only HTMLSlideShow. This did  
give me pause but I assumed it was just part of the magic that goes  
on inside the dojo widget system.  I found a JS syntax checker  
(http://www.crockford.com/javascript/jslint.html) and found what was  
causing the error message, but the attach points still aren't being  
set. I'll try looking through some of the other included widgets for  
inspiration.

I guess Flickr is going to be a pretty popular target for a while.  
Good choice of names, I'm also tinkering with a wordpress plugin I've  
been calling FlickrPickr.

Thanks again,
Chap

> The error message you are seeing generally means that there is a  
> syntax
> error somewhere in your module, in this case FlickrGallery.  I  
> don't see
> where you've defined FlickrGallery, if at all, so that may not be  
> relevant.
>
> Do your templatePath file names really have spaces in them, or is that
> an artifact of email?
>
> Funny that you are working on a Flickr Gallery... I was working on a
> "FlickrPickr" for a widget example.
>
> You might try either the DOM Inspector in Firefox, or the generated
> source bookmarklet from squarefree.com to see what, if any, of the
> template has been added to the document.
>
> HTH,
> - -Dylan
>
> Chap Lovejoy wrote:
> > Hello,
> >
> > I'm making my first attempt at building a widget using Alex's great
> > tutorial. I've gotten my widget to load, but the dojoAttachPoints  
> are
> > not being set in my widget class. I've spent several hours tinkering
> > with different things in an attempt to get it to work to no  
> avail.  I
> > tried the SlideShow widget and it works and I've modeled my  
> widget as
> > closely as I could to it. Could someone give me some pointers as to
> > where I may be going wrong? I've included the basics of my code  
> below.
> >
> > ----- FlickrGallery.html -----
> > <div class="gallery>
> >     <div dojoAttachPoint="thumbContainer">
> >     </div>
> > </div>
> >
> > ----- FlickrGallery.js -----
> > dojo.hostenv.startPackage("dojo.webui.widgets.FlickrGallery");
> > dojo.hostenv.startPackage("dojo.webui.widgets.HTMLFlickrGallery");
> >
> > dojo.hostenv.loadModule("dojo.event.*");
> > dojo.hostenv.loadModule("dojo.xml.*");
> > dojo.hostenv.loadModule("dojo.webui.widgets.Parse");
> > dojo.hostenv.loadModule("dojo.webui.Widget");
> > dojo.hostenv.loadModule("dojo.webui.DomWidget");
> > dojo.hostenv.loadModule("dojo.webui.WidgetManager");
> > dojo.hostenv.loadModule("dojo.webui.DragAndDrop");
> > dojo.hostenv.loadModule("dojo.graphics.*");
> > dojo.hostenv.loadModule("dojo.graphics.htmlEffects");
> >
> > dojo.webui.widgets.HTMLFlickrGallery = function() {
> >     dojo.webui.Widget.call(this);
> >     dojo.webui.DomWidget.call(this, true);
> >     dojo.webui.HTMLWidget.call(this);
> >
> >     this.setId = "";
> >
> >     this.templatePath = "src/webui/widgets/templates/  
> FlickrGallery.html";
> >     this.templateCSSPath = "src/webui/widgets/templates/
> > FlickrGallery.css";
> >
> >     this.widgetType = "FlickrGallery";
> >     this.isContainer = false;
> >
> >     this.set = null;
> >
> >     this.thumbContainer = null;
> >
> >     this.fillInTemplate = function() {
> >         if(this.set == null) {
> >             this.set = new PhotoSet(this.setId);
> >             this.set.load(function(set) {
> >                 var str = "";
> >                 for(i = 0; i < set.photos.length; i++) {
> >                     str += "<img src=\"" + photos[i].getSquareUrl 
> ()  +
> > "\" />";
> >                 }
> >                 this.thumbContainer.innerHTML = str;
> >             });
> >
> >         } else {
> >             debug("Set already loaded.");
> >         }
> >     };
> >
> >     return this;
> > }
> >
> > dj_inherits(dojo.webui.widgets.HTMLFlickrGallery,  
> dojo.webui.DomWidget);
> > dojo.webui.widgets.tags.addParseTreeHandler("dojo:flickrgallery");
> >
> > The PhotoSet object and debug() are defined in another file. I can
> > verify that the PhotoSet object is created (it contains a number of
> > debug() statements which add a string to another <div> on the page).
> > But, I get an undefined value error trying to set
> > this.thumbContainer.innerHTML.  I also see an error "Error -  
> Could  not
> > find module 'dojo.webui.widgets.FlickrGallery'; last tried path
> > '__package__.js' even though the package seems to be loading  
> without  a
> > problem.
>
--
It is no coincidence that in no known language does the phrase 'As  
pretty as an Airport' appear.
   -- Douglas Adams



More information about the Dojo-interest mailing list