Jquery CAutoComplete formatItem

Can anyone please provide some examples how to use cautocomplete formatItem and formatResult property?

Thank you!

Ok. I’ve solved my problem. But seems like there is a bug in CAutoComplete formatItem or I’m doing something wrong.

In the documentation for formatItem property it says:

The last parameter "search term" returns exactly the same as the first one "the results row".

Here is the code:













				 'formatItem'=>"function(result, i, num, term) { return result + '(' + term + ')'; }",



In the code above result is the same as term. So in my sample search for "New" the results look like:

New Jersey (New Jersey)

New York (New York)


instead of

New Jersey (New)

New York (New)


Am I doing something wrong or it’s a bug?

P.S. I don’t really need it for my project, just asking out of curiosity.

Hello, people! Two topics and no answers? What’s going on here? :)