[Dojo-interest] String Insertion into Template CSS

Andrew Scott andrew.scott at aegeon.com.au
Sat Nov 4 22:01:29 MST 2006

Ok the way I did it was to do this.

in my customWidget.js

have all the variables declared as such

  .Width = 0,
  .Height  = 0,

now when you use the attachPoint, you can the modify the styles like such

attachPointname.style.width = this.Width;

I am not sure if there is a better way, but it works for me. Have a look at
the src for dropDownContainer or something similar for an example.

On 11/5/06, Nicholas Retallack <nickretallack at gmail.com> wrote:
> I see we can pass strings into our html template file using ${value}
> (where is this documented btw?).  But is there any way to do this in
> the template CSS file as well?
> For example, I have a gallery widget that contains thumbnail widgets,
> and I'd like the gallery to define the size of the thumbnails in it,
> like so:
> <div dojoType="my:gallery" thumbnailwidth="150px" thumbnailheight="200px">
>   <div dojoType="my:thumbnail" src="image1">caption1</div>
>   <div dojoType="my:thumbnail" src="image2">caption2</div>
> </div>
> The width and height attributes need to be used in various places:
> .ThumbnailBox { width: WIDTH; height: HEIGHT}
> .ThumbnailIMG { max-width: WIDTH; max-height: HEIGHT }
> The ${value} notation would be a bad choice for substituting into css
> files because {} are css tokens.  The reason it is not sufficient to
> just put these as attributes in the template html file is that (in
> proper browsers at least) using max-width and max-height make my image
> display proportionally and not stretched out.  I'm sure there are
> other reasons to do this.
> I know I could just modify my style with javascript in my widget's
> definition, but I thought I'd suggest this anyway.  It could be useful
> to be able to do this.
> _______________________________________________
> Dojo FAQ: http://dojo.jot.com/FAQ
> Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
> Dojo-interest at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dojotoolkit.org/pipermail/dojo-interest/attachments/20061104/79e4b6b8/attachment.html

More information about the Dojo-interest mailing list