[Grok-dev] Re: AJAX example for Uli using Mochikit and
HTML-injection
Martin Aspeli
optilude at gmx.net
Mon May 28 13:19:32 EDT 2007
Hi Martijn
>> - KSS (http://kssproject.org), which is what powers AJAX in Plone 3.
>> This is designed so that it works in "pure Zope 3". This is a bit
>> "different" in that you generally don't write Java Script at all. Take a
>> look at the demos on that website to see what I mean. I know Philipp did
>> some work with KSS in Grok a while ago.
>
> We should definitely see whether we can use KSS with Grok.
I'm pretty sure you can. kss.core should work in plain zope 3 as far as
I know.
> It's
> definitely attractive because it seems quite declarative.
It is.
> This needs
> more examination.
I'm using KSS right now in a separate project, and I'm quite enjoying
it. It fits my brain. It may not fit everyone's brains, of course.
To me, the advantage (which may be a disadvantage to others) of KSS is
that it imposes some common structure. You write a CSS-like file which
says *what* is being acted upon and which event (click, change, load...)
is being trapped. Then you configure one or more server-side or
client-side actions which react to that event. On the server-side, you
construct a response (via a simple API) which says which commands the
client should undertake, e.g. "add this CSS class to this node" or
"delete all nodes that have this class".
Then, there are higher level constructs, e.g. to refresh a
viewlet/content provider. This is quite pluggable, so that in Plone we
have standard commands for e.g. refreshing a portlet or issuing a
standard status message. This is attractive because the developer only
uses the higher level API and we can centralise and standardise these
primitives.
OTOH, I don't think I'd use KSS if I wanted a JS-only application (KSS
is great if you want to make sure you don't implicitly rely on JS, i.e.
you have safe fallbacks) like Flickr or something like that. You
*could*, definitely, but KSS is very much about isolating you from
writing JS, not giving you more JS to play with.
My experience, anyway. :)
Martin
--
Acquisition is a jealous mistress
More information about the Grok-dev
mailing list