[Grok-dev] AJAX example for Uli using Mochikit and HTML-injection
Sebastian Ware
sebastian at urbantalk.se
Sat May 26 03:05:30 EDT 2007
This is what it looks like in action:
http://www.urbantalk.se/DEVELOPER/tvsk
Click on the days or change pictures with the buttons marked "<" and
">".
What I did was to create widgets that produce HTML that I can inject
either using the PageTemplate or the Mochikit HTML-injection method.
By adding some extra attributes when rendering the widget I get
parameters that I can easily find and use in my AJAX calls.
If javascript is turned off, the links work as normal. If javascript
is turned on, and the Mochikit library can be loaded, the 'onclick'
events are intercepted and trigger the AJAX stuff.
All design is done in the widget renderer using python (I didn't want
to learn javascript... :p). And the HTML-injection is flicker free on
my old Powerbook so it looks very much like the real thing. :)
The PageTemplate (renamed with prefix "my_")
http://www.urbantalk.se/DEVELOPER/tvsk/my_index_html
Widgets... (renamed with prefix "my_")
http://www.urbantalk.se/DEVELOPER/tvsk/my_render_picset
http://www.urbantalk.se/DEVELOPER/tvsk/my_render_veckoschema
My javascript-file that does the AJAX stuff
http://www.urbantalk.se/DEVELOPER/tvsk/render_blocks/helper/tvsk.js
Support...
http://www.urbantalk.se/DEVELOPER/tvsk/javascripts/mochikit/
MochiKit.js
Regards Sebastian Ware
More information about the Grok-dev
mailing list