0

Jquery Autocomplete

asked 2010-04-29 10:12:17 +0800

Bobzk gravatar image Bobzk
444 1 8

I would like to use JQuery autocomplete function on a ZK textbox (i.e. do it all at the client side) similar to code shown here

But I'm having problems.

Anyone managed to get such a thing working?

delete flag offensive retag edit

8 Replies

Sort by » oldest newest

answered 2010-04-29 21:23:32 +0800

PeterKuo gravatar image PeterKuo
481 2

@Bobzk
I am developing wrapping jquery ui widget to be a zk widget.
Autocomplete is wrapped.
You may take a look in the project
jQuery4j http://code.google.com/p/jquery4j/

I'm writing smalltalk about it.

I haven't try to mix zk component with jquery ui widget.
I think it's feasible,
you have to get the sync the data between zk widget and jquery ui widget and server.

link publish delete flag offensive edit

answered 2010-04-30 03:50:12 +0800

Bobzk gravatar image Bobzk
444 1 8

Many thanks, I'll have a look.

link publish delete flag offensive edit

answered 2011-06-11 22:08:26 +0800

crsna gravatar image crsna
30

@Bobzk
i'm trying todo the same thing as you are? were you successfull in getting it to work?
thanks
goutham

@PeterKuo
i'm using the autocomplete widget, how can i add onBlur event to it? and is there a way to override the matching logic like we can do in jquery, like doing the following thing where in the source we can specify the method to call.

<script type="text/javascript">

$(function() {

// fetch data
var terms;
$.ajax({
url: 'terms.txt',
success: function(data) {
terms = data.split("\n");
}
});

// create autocomplete box
$("#autocomplete").autocomplete({
delay: 150,
minLength: 3,
source: function(req, resp) { resp(findTerms(req.term)) }
});

function findTerms(q) {
var words = q.split(" ");
var re = new Array();
for (var i=0; i<words.length; i++) {
re = new RegExp("\\b"+words, "gi");
}
var found = new Array();
var j = 0;
for (var i=0; i < terms.length; i++) {
match = true;
for (var k=0; k<words.length; k++) {
if (!re.test(terms)) {
match = false;
break;
}
}
if (match) {
found = terms;
j++;
}
}
return found;
}


});

</script>

link publish delete flag offensive edit

answered 2011-06-16 05:27:15 +0800

Bobzk gravatar image Bobzk
444 1 8

crsna,

No, not that I tried too hard - used the server to do it all in the end because of development time.

However obviously (for performance) prefer to do it at client, so if ever you get it working correctly let me know - thanks.

link publish delete flag offensive edit

answered 2011-06-17 12:44:50 +0800

crsna gravatar image crsna
30

i was able to integrate the zk Textbox with JqueryUI autcomplete widget. i can send you the code. i wanted to use Peterkuo's autocomplete widget, but did not know how to do callback for source ans also customize the list to use Scott "González' html extension"

link publish delete flag offensive edit

answered 2011-09-07 05:49:43 +0800

Bobzk gravatar image Bobzk
444 1 8

Hi crsna,

Would be most interested in your code - email peetee(at)cheerful.com when you get time - many thanks.

link publish delete flag offensive edit

answered 2012-01-11 16:49:54 +0800

dagarwal82 gravatar image dagarwal82
246 4

Please send it to me also. dagarwal82 gmail

link publish delete flag offensive edit

answered 2012-01-11 17:27:09 +0800

twiegand gravatar image twiegand
1807 3

crsna,

If you don't mind, please share your code here (or even better, use ZK Fiddle) so that all can benefit from your experience.

Thanks,

Todd

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-04-29 10:12:17 +0800

Seen: 1,290 times

Last updated: Jan 11 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More