On Wed, 09 Nov 2011 11:25:29 -0200, Peter Stavrinides <p.stavrini...@albourne.com> wrote:

Hi Thiago,

Have you tried adding the function as a JSONLiteral? And why are you
returning a function instead of having this function declared somewhere
else and just passing parameters to it in the JSONObject?
I am not, Tapestry is responsible for these hooks, we simply pass the configuration or am I missing something?

I think we are not on the same page. I didn't quite understand your comment... Tapestry's Autocompleter if recollection serves is based on the underlying Scriptaculous autocompleter, right?

Yes.

So the Scriptaculous autocompleter has some hooks (updateElement & afterUpdateElement) to trigger 'aftercompletion' events, but Tapestry's implementation doesn't support these hooks, correct?

I guess so.

So how do I then enable these hooks without hacking it?

I'm sorry, I made a huge confusion in my last message.

From other posts, and past experience I recall adding a function somewhere and just passing the parameters didn't work (though it really should).

Examples please. :)

So far as I know only by overriding the mixin, or fudging the parameters you can trigger these hooks, something like the following which extends the mixin and rewires it a little:

public class ExtendedAutocomplete extends Autocomplete {

@Override
    protected void configure(JSONObject config)
    {
config.put("afterUpdateElement", new JSONRaw("onSelectFromAutocomplete"));
                ...
   }

I guess this should work, but I don't know about the client-side part. And JSONLiteral already does what your proposed JSONRaw does.

Anyway, you can file a JIRA for this being added to Autocomplete itself.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to