[dojo-contributors] Re: Figuring out what Dojo needs to become. A few questions.
Bill Keese
bill at dojotoolkit.org
Thu Dec 28 21:24:17 EST 2006
Eugene Lazutkin wrote:
> For example the calendar (DatePicker) widget has pretty elaborate visual
> implementation, which is initialized dynamically (when the page has
> loaded). Why? It would be much better to generate all necessary HTML for
> it on the server in a proper state showing an exact date: 12/28/2006.
Uh oh, I opened a can of worms. :-)
Of course, the main reason we don't do that is that it requires a
back-end to be written in ever server language (PHP, Java, ASP, etc).
But also, it's because creating widgets programatically would require an
XHR to the server to get the HTML. In the DatePicker case it would be
worse; wouldn't you have to XHR w/the server every time you hit the
next-month or previous-month button?
> It
> will cut down on initialization time,
> user will see the result much
> earlier
Hmm, I'm not sure if that's true. (Assuming Dojo's javascript is
cached) doing templates on the server means that you are downloading
more data to the client each time, and you aren't reducing the amount of
code that gets run. You are just changing the language, and the machine.
I bet we could speed up initial instantiation time though, if (for
DropdownDatePicker), we didn't create the DatePicker widget until you
pressed the drop-down button. Deferred instantiation is something to
think about for Tooltip too.
> and it will prevent flickering.
Flickering is definitely something to think about. Of course, if you
declare the widget like <dojo:DatePicker> then it will be hidden until
rendered, so at least you wouldn't see something that disappeared later.
More information about the dojo-contributors
mailing list