Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#6989 closed bug (notabug)

AutoComplete is actually AutoSuggest

Reported by: hm2k Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.autocomplete Version: 1.8.9
Keywords: Cc:
Blocked by: Blocking:

Description

You would expect AutoComplete to "complete" the phrase you are typing, but instead it "suggests" based on the characters you are typing.

For example: http://jqueryui.com/demos/autocomplete/

When you type "a" in the input box:

I expect it to "complete" and display: ActionScript AppleScript

Actually, it "suggests" and displays any word that contains that letter.

Here's an example on how you would expect it to work: http://developer.yahoo.com/yui/examples/autocomplete/ac_basic_array.html

Change History (6)

comment:1 Changed 9 years ago by Scott González

Component: ui.coreui.autocomplete
Resolution: invalid
Status: newclosed

You can change the searching logic to whatever you want.

comment:2 Changed 9 years ago by hm2k

  • This is not the default, as expected
  • There is no example of changing the search logic

comment:4 Changed 9 years ago by hm2k

Granted, but none of them show the expected behaviour of an "autoComplete", these are all autoSuggest behaviour.

Further more, these examples seem to show a custom source, rather than custom search logic.

Perhaps you could clarify what you meant, because it is not clear from the examples or documentation.

comment:5 Changed 9 years ago by rdworth

Sorry you didn't find clarity in the examples I shared. A custom source is exactly how you implement custom search logic. Here's a better example that matches from the beginning of the string: http://jsbin.com/avoyu5

$( "#tags" ).autocomplete({
  source: function( request, response ) {
    var matches = $.map( availableTags, function(tag) {
      if ( tag.toUpperCase().indexOf(request.term.toUpperCase()) === 0 ) {
        return tag;
      }
    });
    response(matches);
  }
});
Last edited 9 years ago by rdworth (previous) (diff)

comment:6 Changed 9 years ago by hm2k

Thanks for the clarification.

I propose that an example of expected behaviour should included in the documentation.

Note: See TracTickets for help on using tickets.