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