Bug Tracker

Opened 11 years ago

Closed 10 years ago

#4485 closed enhancement (invalid)

[autocomplete] enhancement: new function to show all values even when the input contains a value already

Reported by: mephiztophelez Owned by:
Priority: minor Milestone:
Component: plugin Version: 1.2.6
Keywords: Cc:
Blocked by: Blocking:

Description

Problem Description

We had the requirement to show a link next to the input field like "show options". When clicking this link the autocomplete input field should show the drop down with all the available values. That functionality is already there, but only if the input field is empty and you click/focus/keydown/keyup it.

But if there is already a value inside the input field then the dropdown only shows that filled value or other values which match the current value (depending on some options).

But what we want is that even something is filled in already, that you see the complete list.

Solution / Proposal

I have solved this by a minor enhancement to the jquery.autocomplete.js file. I have created a new function showAllValues on the $AutoCompleter object which can be called on an HTML Element e.g.

var inputFieldAutocompleter = $("#myInputField").autocomplete([value1, value2, value3], { matchContains: true, minChars: 0, delay: 1, scroll:true });

$("#myShowOptionsLinkWhichShowsAllValues").click(	function(){
															## call the new showAllValues function which shows all values even though there is already a value filled in the input field 
															inputFieldAutocompleter.showAllValues();
														});

I will attach the enhancement as a patch for discussion. Would be great if something like that could make it into the next release of the autocomplete plugin.

Thanks Christoph

Attachments (1)

jQueryAutocompleteShowAllValues.patch (1.0 KB) - added by mephiztophelez 11 years ago.
Patch which adds the showAllValues function

Download all attachments as: .zip

Change History (2)

Changed 11 years ago by mephiztophelez

Patch which adds the showAllValues function

comment:1 Changed 10 years ago by dmethvin

Resolution: invalid
Status: newclosed

This is not a jQuery core bug. Please report plugin bugs to the plugin's author, or ask on the jQuery forums. jQuery UI bugs should be reported on the UI bug tracker, http://dev.jqueryui.com .

Note: See TracTickets for help on using tickets.