0

I'm using the latest jQuery ui auto complete (version as per the js file: jQuery UI Autocomplete 1.8.13). I've successfully deployed the static autocomplete which looks something like: (Version 1)

$( "#Vendors" ).autocomplete({ 
source: [{ "id": "3", "value": "Ven 03" }, { "id": "1", "value": "Ven 01" }, { "id": "2", "value": "Ven 02"}]
});

But when I do the same dynamically using a remote file in my C# MVC2 web web-app the problem starts. Here's the code: (Version 2)

$( "#Vendors" ).autocomplete({ source: "/common/lookup?id=vendor" })

Version 2 gets the data suggessfully and I've verified the JSON generates is same as mentioned in Version 1 example. But when I start typing in the textbox - the autosearch is NOT performed as it is done in the Version 1.

In short the filtering of items as the user types is not available in the url version. Does it mean I've to query my data each time and perform that filtering on server side? Isn't the data cached?

Pls help, I'm stuck on this since about a day!

Edit 1: I've settled with the fact that it won't cache the search and that it'll go to server to search each new term.

Edit 2: Something useful for MVC - MVC extension for jQuery ui auto-complete:

http://www.codevoyeur.com/Articles/10/ASP.NET-MVC-HtmlHelper-Extensions-for-jQuery-AutoComplete.aspx

1
  • Thank you guys .. ok I got it .. it won't cache and/or search locally it'll need to go to server each time I enter a value and I'll get it as term in my Action parameters. Commented Jun 18, 2011 at 15:14

1 Answer 1

1

use this:

$( "#Vendors" ).autocomplete({ source: "/common/lookup" })

search variable: term instead id,
ajax query looks like: http://localhost/common/lookup?term=search_string

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.