click-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Schellink <>
Subject Re: v.2.2.0 development notes
Date Mon, 15 Feb 2010 08:21:08 GMT
On 15/02/2010 09:10 AM, Finn Bock wrote:
> Another question.
> 1) How do I pass request parameters into the ajax call (like a
> database id param) and will the parameter be bound to the @Bindable.

I can currently see two ways to pass parameters.

1. Set attributes on the Control and use JavaScript to grab these parameters at runtime. For
a link control exposes parameters that are rendered as part of the href attribute. The Javascript

can grab these parameters and pass them back to the server.

The following attributes can be checked: src, href, action.

2. The Behavior object can expose a map of parameters for adhoc parameters. The parameter
map can be 
rendered in the behavior template:

   behavior.addParameter("id", student.getId());

   $.ajax( ..., $parameters + '&' + $controlParams, ...);

> That means that the java API that I use in my application depends on
> the javascript framework? If that is the case: yuck.

I suppose if there are enough compatibility between the different frameworks then a simple
API can be exposed. For example Partial.replace could map to element.innerHTML as an example.

A common API is something to keep in mind, but I don't really know what that API would look
like. Of 
course if anybody wants to design such an API that would be great.

In the meantime we could keep the Partial API lean and refactor it later as the implementation
shape. For example the JQuery Taconite implementation has a fair bit of methods which are
by jQuery:

When we have a Prototype implementation we could move some of those methods to Partial if
it is 
supported by both frameworks.

> Yes, when taconite is used, the target control is named together with
> the new content and that is IMO as it should be. I just think that a
> simple replace should be part of the Partial interface and not depend
> on my choice of JQuery as the framework.

Yep, see my comment above.

> How would the choice of framework version be controlled? or put
> another way how could I made AjaxBehavior use the same version of
> JQuery that the rest of my application uses?

Good question. We could expose some static methods or a property file to specify the jQuery
However changing the jQuery version might break plugin dependencies, so Behaviors should clearly

document the minimum jQuery version supported. This is what most jQuery plugins do as well.

kind regards


View raw message