[Seaside] RE: JQuery ui autocomplete with multiple parameters

Robert Sirois watchlala at hotmail.com
Tue Aug 28 16:09:32 UTC 2012


Nice! Looks good. Are you able to do this:
callback: [:val1 :val2 | term1 := val1. term2 := val2. ] value: (JSStream on: 'request.term') value: (JSStream on: '$(''#name'').val()');
instead of this:
callback: [:val1 :val2 | term1 := value ] value: (JSStream on: 'request.term');callback: [ :value | term2 := value ] value: (JSStream on: '$(''#name'').val()');
Just a thought.RS
> Date: Tue, 28 Aug 2012 00:47:06 -0700
> From: lasmiste at gmail.com
> To: seaside at lists.squeakfoundation.org
> Subject: [Seaside] RE: JQuery ui autocomplete with multiple parameters
> 
> Hi Robert,
>  I solved it. I haven't data on client and I don't use the blur event, it's
> enough to read the "name" value via JQuery.
> 
> 
> On JQAutocomplete, I implemented a method mimicking
> JQAutocomplete>>sourceCallback: but with a two arguments block
> 
> JQAutocomplete>>customSourceCallback: aTwoArgumentsBlock
> 		
> 	|  term1 term2 |
> 	self source: ((self jQuery getJson
> 
> 		callback: [ :value | term1 := value ] value: (JSStream on:
> 'request.term');
> 		callback: [ :value | term2 := value ] value: (JSStream on:
> '$(''#name'').val()');
> 		text: [ :stream | stream json: (aTwoArgumentsBlock value: term1
> value:term2).];
> 		onSuccess: 'response(arguments[0])'; 
> 		dataType: 'jsonp') asFunction: #('request' 'response'))
> 
> request.term is "address" field and you can see I easily grabbed the "name"
> value		
> 		
> 
> 
> Eventually, on my class, I linked the autocomplete to "address" field this
> way
> 
> MyClass>>autocompleteOnAddress
>   self addressField script: (html jQuery this autocomplete delay: 0;
> customSourceCallback: [ :address :name| self tryToFind: address and: name
> ]).
> 
> 
> 
> In MyClass>>tryToFind:and: I made the search. That's it.
> 
> 
> 
> Cheers
>  Dave
> 
> 
> 
> --
> View this message in context: http://forum.world.st/JQuery-ui-autocomplete-with-multiple-parameters-tp4645397p4645458.html
> Sent from the Seaside General mailing list archive at Nabble.com.
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20120828/9c825b75/attachment.htm


More information about the seaside mailing list