ilija veselica
ilija veselica

Reputation: 9574

jquery UI autocomplete - extended data?

I would like to use Jquery's UI autocomplete but with some additional functions: after user selects suggested item, I would also like to display additional data related with that item (for example if database of contacts are being searched, then I'd like to display contact's email, addres...) in some html element.

Is there a way to accomplish this?

Thanks in advance,
Ile

EDIT:

I'd like to provide more detail description of what I actually need:
When user starts searching contacts, as a result from database I would like to return contact's ID and Full Name. After user selects certain contact, then ajax function is called and it retrieves all details from selected contact using it's ID. But I don't know how to do following:

Upvotes: 0

Views: 786

Answers (2)

Arindam Nayak
Arindam Nayak

Reputation: 11

You can specify extra data in formatMatch function. The parameter must be some delimiter separated string. Later in .result function , which takes 3 arguments [event, data, formatted], you can retrieve it by splitting the formatted by the delimiter use and populate the required values.

Upvotes: 1

Christian Studer
Christian Studer

Reputation: 25637

Have a look at its events: You can add a handler for the select event and display all your informations once it fires.

Upvotes: 3

Related Questions