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? 
So the Scriptaculous autocompleter has some hooks (updateElement & 
afterUpdateElement) to trigger 'aftercompletion' events, but Tapestry's 
implementation doesn't support these hooks, correct?
So how do I then enable these hooks without hacking it? 

>From other posts, and past experience I recall adding a function somewhere and 
>just passing the parameters didn't work (though it really should). 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"));
                ...
                
    }

private class JSONRaw {
...
}
}

Kind regards,
Peter


----- Original Message -----
From: "Thiago H. de Paula Figueiredo" <thiag...@gmail.com>
To: "Tapestry Mailing List" <users@tapestry.apache.org>, "P Stavrinides" 
<p.stavrini...@albourne.com>
Sent: Tuesday, 8 November, 2011 17:48:25 GMT +02:00 Athens, Bucharest, Istanbul
Subject: Re: Event after completion Tapestry 5 Autocompleter

On Tue, 08 Nov 2011 12:13:38 -0200, <p.stavrini...@albourne.com> wrote:

> Hi All,

Hi!

>> The scriptaculous Ajax.Autocompleter does support
>> updateElement and afterUpdateElement methods, but as far as I can tell
>> you can't get them into the configuration because the JSONObject
>> quotes its attributes (making the function into a string).

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?

-- 
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


----- Forwarded Message -----
From: "P Stavrinides" <p.stavrini...@albourne.com>
To: "Thiago H. de Paula Figueiredo" <thiag...@gmail.com>
Cc: "Tapestry Mailing List" <users@tapestry.apache.org>
Sent: Wednesday, 9 November, 2011 11:13:22 GMT +02:00 Athens, Bucharest, 
Istanbul
Subject: Re: Event after completion Tapestry 5 Autocompleter

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? 
So the Scriptaculous autocompleter has some hooks (updateElement & 
afterUpdateElement) to trigger 'aftercompletion' events, but Tapestry's 
implementation doesn't support these hooks, correct?
So how do I then enable these hooks without hacking it? 

>From other posts, and past experience I recall adding a function somewhere and 
>just passing the parameters didn't work (though it really should). 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"));
                ...
                
    }

private class JSONRaw {
...
}
}

Kind regards,
Peter


----- Original Message -----
From: "Thiago H. de Paula Figueiredo" <thiag...@gmail.com>
To: "Tapestry Mailing List" <users@tapestry.apache.org>, "P Stavrinides" 
<p.stavrini...@albourne.com>
Sent: Tuesday, 8 November, 2011 17:48:25 GMT +02:00 Athens, Bucharest, Istanbul
Subject: Re: Event after completion Tapestry 5 Autocompleter

On Tue, 08 Nov 2011 12:13:38 -0200, <p.stavrini...@albourne.com> wrote:

> Hi All,

Hi!

>> The scriptaculous Ajax.Autocompleter does support
>> updateElement and afterUpdateElement methods, but as far as I can tell
>> you can't get them into the configuration because the JSONObject
>> quotes its attributes (making the function into a string).

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?

-- 
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


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

Reply via email to