agarzola / jQueryAutocompletePlugin

Jörn Zaefferer’s (now deprecated) jQuery plugin, with tweaks.
282 stars 151 forks source link

div cleanup #18

Closed kerlin closed 13 years ago

kerlin commented 13 years ago

I'm having a problem using this in an ajax application. I start by typing and making a selection from a long list. The results displayed are updated, and a shorter list of suggestions is built. When typing again there are 2 lists of suggestions.

To fix this, in the init() function, before line 618, I added the line $("div."+options.resultsClass).remove();

This fixed my problem. It didn't help to put the remove() call anywhere in my code.

Sorry if I've missed something and the error is mine. And many thanks for keeping this module alive.

agarzola commented 13 years ago

Hi, kerlin. Would you mind posting a screenshot of the 2 lists?

Thanks! And sorry I took so long to respond…

kerlin commented 13 years ago

First time, works correctly. Type "pa" and select "Angel Pagan" from the list:

From Jul 6, 2011

Content updates via ajax, rebuild autocomplete with new list. Type "pau" and there are 2 lists:

From Jul 6, 2011
kerlin commented 13 years ago

Not the best solution to send jquery off to remove a div that may or may not exist. Maybe I should be calling .autocomplete('unautocomplete') and that would/should handle removing the div.

agarzola commented 13 years ago

Mind posting a link so I can inspect what goes on in the DOM?

kerlin commented 13 years ago

Sorry for the distraction. Shoulda read the examples; I would have seen to call $('#mySearch').unautocomplete(); before creating a new one. My code isn't live yet, but it's based on http://evolvingweb.github.com/ajax-solr/examples/reuters/index.html This also rebuilds the autocomplete, but always with the same data.