简体   繁体   中英

Grails: How to make a g:textfield autocomplete?

I have ag:textfield, and I want to write something and then show me all the options possible that start with the same letter. I understand that is called AutoComplete.

Maybe using jQuery or JavaScript?? Any ideas??

Thanks in advance!

How about using an existing plugin:

If have problem to use it with <g:textfield> , Here is a thread that may help you to implement.

say you are going to autocomplete on a 'thing' field

  1. you need an autocomplete widget, jquery has one, that you use for the thing field
  2. you need a server endpoint that finds 'things' based on what the user types in. this endpoint will return json.

thats really it. as you mentioned, the widget will use ajax to query the server when the user types in the field, and it will use the response to draw a div that contains possible completions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM