myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Winer" <awi...@gmail.com>
Subject Re: [AJAX] choosing an AJAX solution...
Date Fri, 03 Aug 2007 21:52:15 GMT
On 8/3/07, Andrew Robinson <andrew.rw.robinson@gmail.com> wrote:
> > > * ability to skip the update phase to just check for
> > > validation/conversion errors (would be nice functionality)
> >
> > Trinidad has probably the most extensive set of fully
> > client-side conversion/validation checking out there,
> > obviating the need to post back to the server.
>
> While client side validation is nice, it is not a replacement to
> server-side validation. Sometimes validation needs to hit the database
> (like to see if a username is already taken), or sometimes validation
> is more complex (hibernate validation using the model for example).

100% total agreement - which is, in part, why the only way
to get client-side validation in Trinidad is by adding server-side
validators.  My point is more in reference to supporting postbacks
that just check validation, and skip update model - client-side
validation makes *that* a good bit less necessary.
>
> > > * ajax on event functionality (re-render such-and-such when a select
> > > box changes value for example)
> >
> > Yes (autoSubmit + partialTriggers).
>
> This seems a bit limiting. It doesn't look like autoSubmit lets the
> developer specify which events trigger the AJAX call (for example a
> specific key press).

autoSubmit means when the value changes, trigger AJAX
that will fire a valueChangeListener.  If you wanted a hook
other than valueChange, you could add onkeypress, etc.
handlers and do this yourself.

> Also there doesn't look like a comparable
> component to a4j:support that allows for additional functionality.

What additional functionality specifically?

> Example of that functionality: append "return false;" on the event of
> the component to swallow the HTML event, can work on any JSF component
> (including tomahawk components).
>
> I guess "TrPage.getInstance().sendFormPost(form, {yourparams]);" is
> required for this functionality?

Yes, I think that's what you're getting at.

> > > How easy is it to write custom trinidad ajax components?
> >
> > Pretty simple.  All you need to initiate a Trinidad AJAX request
> > from JS is:
> >   TrPage.getInstance().sendFormPost(form, {yourparams]);
> > (again, in 1.0.2)
>
> Is there JS documentation? I cannot find any on this function on the
> myfaces trinidad site

It's new for 1.0.2.  I really need to sit down and write some
docs for this API.

> Does this allow you to specify the components
> to be updated (replicate the partial trigger functionality)?

On the server-side, you can explicitly request a component
be repainted with RequestContext.addPartialTarget(UIComponent).
We don't currently have an API for driving this entirely from
the client-side, though it wouldn't be hard to add this.


>
> Couple of additional questions:
>
> Is there AJAX queue functionality (to be able to have simultaneous
> requests or have some wait for others)?

Currently, it is entirely queued.  JSF state saving really
doesn't permit non-queued requests.

> Is there a request delay feature? (fire the AJAX request on key down
> but no more than once per 5 seconds for example).

No, there's not.  You'd have to build that on top of this
(for auto-suggest, for example).

> Is there a way for components to specify their JavaScript and CSS file
> requirements so that they are loaded correctly before or during a
> partial rendering?

Yes, JS can be loaded during PPR.  CSS is generally handled via
an integrated skinning stylesheet that would already be present.

-- Adam


>
> Thanks,
> Andrew
>

Mime
View raw message