modify autoComplete resultlist (e.g. add a number)

UI Components for JSF
Post Reply
nilsm
Posts: 2
Joined: 13 May 2011, 16:36

13 May 2011, 17:03

Hi there,

first of all I really like to thank you for the great work you guys have done! I really like primefaces and can't wait to get the final v3 :)

As much as I love the autoComplete component, is it possible to modify the resultlist? E.g. add a count to each item like you can find it on the google auto completion?
I know that there's a way to do this using the jquery api (http://jqueryui.com/demos/autocomplete/#custom-data), but after a few hours I wasn't able to find out if there's a way to get this working in Primefaces.

If there is hack to prevent primefaces in escaping all characters e.g. "<" and ">" I would simply add a span in my result string and do some css. e.g.

Code: Select all

 public List<String> complete(String query) {  
   ...
   list.add("abc   <span style='float:right;'>12</span>");
   ...
 }     
Is there a way to get this working?

Anyway, if you guys don't know which component should be upgraded next, ... ;)
Thank you so much!

Regards,
Nils

nilsm
Posts: 2
Joined: 13 May 2011, 16:36

13 May 2011, 18:22

It looks like jQuery is escaping html characters since v1.8.6.
If this is the case in the current primefaces release, I found a blogpost on how to prevent jquery from escaping all these lovely html char's ;)
http://www.arctickiwi.com/blog/jquery-a ... -html-tags
I will give that a go next week.

But if someone has an idea how to solve this without changing jQuery's autoComplete behavior, please let me know. :mrgreen:

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 36 guests