jquery-autocomplete icon indicating copy to clipboard operation
jquery-autocomplete copied to clipboard

Empty results DOM

Open basham opened this issue 13 years ago • 5 comments

I'd like to attach some sort of markup that would inform the user when there are no results from the server (determined by an empty array server output). Currently, the only way I see to determine this is to check the data length from a custom processData function, since there's no other callback. Is this the preferred way? It would be nice to have a <div> already created and positioned where the $results DOM is, which displays when there's no results. This would enable something like what Facebook does:

Facebook Empty Results

basham avatar Mar 20 '12 00:03 basham

Can do, put on the list

On Tue, Mar 20, 2012 at 01:50, Chris Basham [email protected] wrote:

I'd like to attach some sort of markup that would inform the user when there are no results from the server (determined by an empty array server output). Currently, the only way I see to determine this is to check the data length from a custom processData function, since there's no other callback. Is this the preferred way? It would be nice to have a <div> already created and positioned where the $results DOM is, which displays when there's no results. This would enable something like what Facebook does:

Facebook Empty Results


Reply to this email directly or view it on GitHub: https://github.com/dyve/jquery-autocomplete/issues/31

dyve avatar Mar 20 '12 06:03 dyve

I'll do this but it takes a little more time than expected. Please have some patience :-)

dyve avatar Mar 22 '12 08:03 dyve

Absolutely. My head was spinning a bit thinking about proper implementation. I would be astonished if this feature was a simple 20-min upgrade. Good luck.

basham avatar Mar 22 '12 15:03 basham

Hi Dyve,

Thx for your work on this plugin. What about this feature ? I'd like to add some default values to be displayed with or without results ... Any advice ?

hugodouchet avatar Apr 30 '12 16:04 hugodouchet

I worked around the lack of this feature in the following way:

  • Check if there are any results in processData
  • Add a "fake" result item if so
  • Interpret the fake item in showResult, rendering your custom DOM

In the process, I had to worked around issue #96, but in the end it works out pretty well.

Xion avatar Aug 15 '13 20:08 Xion