Hi Marco,
If you want commit access to ClickClick let me know. Please note that Click itself might support
Ajax in a future release which will impact ClickClick. For example if we introduce behaviors in
Click, then ClickClick Helper objects would very likely be refactored into these behaviors.
In the changes you made to AutoComplete I'd suggest that "options" should always be rendered. That
way, even if a new version of AutoComplete is released, its new options can easily be used without
having to release a new version of AutoComplete.
Perhaps options should be a map as well? Most JavaScript options are JSON based so perhaps we should
look for a small JSON third-party library, or write one ourselves. For example a Map could be
rendered as:
{key: value, key: value}
and a Map of Maps could become:
{key: value, key: value {nested-key: nested-value, nested-key: nested-value}}
kind regards
bob
On 17/02/2010 03:41 AM, Marco Gattei wrote:
If anyone is interested code in the attachment
1) javascript template file,
2) Helper java class with extended properties for Jquery autocomplete option
3) demo page
Marco
2010/2/16, Marco Gattei<[email protected]>:
Fix works like a charm ...
Marco
2010/2/16 Bob Schellink<[email protected]>
Hi Marco,
I've just checked in a fix for jquery.autocomplete.js to pass the element
ID attribute to the server. Thus the jquery.autocomplete.template.js
doesn't
need to use extraParams anymore.
Changes can be seen here:
http://code.google.com/p/clickclick/source/detail?r=511
Having an API to specify extra params would be good. I don't think it
matters that the JQuery AutoCompleteField is dependent on JQuery. The
extraParams would be dependent on the AutoComplete plugin options anyway.
kind regards
bob
On 17/02/2010 12:49 AM, Marco Gattei wrote:
Damn ! how could i've been so blind ?
By the way, i'm workin on it ... i think about adding properties in
JQAutoCompleteHelper some properties
to mirror Jquery autocomplete options so in java code you can do:
autocompField.getJQueryHelper().addExtraParam( "paramname" ,
"js_code_to_get_value" );
param would be held internally by the Helper as a map , with ID already
set .....
I've used this approach to create a JQDialogHelper and worked well for
me.
Only drawback i can see is that the component gets VERY dependent from
the libray javascript underneath...
but after all you are using clickclick-jquery !
By the way, great work bob
Marco
2010/2/16 Bob Schellink<[email protected]<mailto:[email protected]>>
Hi Marco,
AutoCompleteField uses the template jquery.autocomplete.template.js.
If you look at the template you'll notice that it already uses the
extraParams property to send the field ID parameter to the server.
If you specify extraParams it overrides the default value and Click
cannot figure out which field sent the request.
To fix this we'll need to "append" extraParams instead of replace
them.
For now you can work around this by specifying your extraParams as
follows:
setOptions("extraParams: {" + completeField.getId() + ":1,<add
custom params here>}");
kind regards
bob
On 16/02/2010 11:41 PM, Marco Gattei wrote:
Hi everyone ,
i'm trying to play with Jquery AutoCompleteField from wobnderful
clickclick project ....
What i'm trying to do is submit extra params to the server when
requesting the list for autocomplete field.
(i.e. i choose state first, then autosuggest city that are only
in that
state ).
Jquery autocomplete plugin has a nice feature that allow to
define extra
params to send with the ajax request for autocomplete.
http://docs.jquery.com/Plugins/Autocomplete#Dependencies_between_fields.
I tried it, but when i set this particular option, the server
method for
getting suggestion list doesn't get invoked !!!!
Removing the option from jquery $('selector').autocomplete( url ,
options ) gets JQAutoCompleteField to work again.
I tried to sniff HTTP dialog between client and server and i
noticed
that where JQuery autocomplete with extraParam options on,
request to the server are made whit type='application/xml' .
When extraParam is off, request type = 'text/plain'.
It seems like when request type of the ajax request is not
text/plain,
Click isn't able to invoke the JQAutoCompleteFiled listener.
As someone any idea ?
Is that a Click or a JQuery iussue ?
--
Marco
--
Marco
--
Marco