aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes How to use external data source in  jQuery UI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to use external data source in  jQuery UI" Watch "How to use external data source in  jQuery UI" New topic
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: 61764
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by 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: 61764
    
  67

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use external data source in jQuery UI