| Author |
How to use external data source in jQuery UI
|
Aaron Raja
Ranch Hand
Joined: Jun 07, 2007
Posts: 206
|
|
I am try to use Autocomplete using jQuery UI.
Here is working code for hard code value but I need to use external data (Database) ?
Thanks
AR
|
Thanks, AR
SCWCD 5, SCJP 1.4, OCA (PL/SQL)
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56521
|
|
You can use the callback option for the data source. The callback can use Ajax to fetch data from the server.
This is covered in detail in my jQuery in Action, 2nd ed book (section 11.4 to be exact).
Or you can read through the online documentation for autocompleters.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Aaron Raja
Ranch Hand
Joined: Jun 07, 2007
Posts: 206
|
|
There are examples in the book only for hard coded Array values.
I have StateDao class which have method getStateList() which provides List<String>.
How can I use data from database ?
Thanks
AR
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56521
|
|
The book describes how to do it.
But essentially your callback will use Ajax to make a request back to the server. The response should contain the data in any of the JSON formats described in the documentation.
Once the request is on the server, the autocompleter could care less what the server-side code does, so your java code can call your DAO in any manner that you see fit.
|
 |
 |
|
|
subject: How to use external data source in jQuery UI
|
|
|