Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#6043 closed enhancement (wontfix)

Add "match at beginning" to autocomplete

Reported by: beermad Owned by:
Priority: minor Milestone:
Component: ui.autocomplete Version: 1.8.4
Keywords: Cc:
Blocked by: Blocking:

Description

In a couple of projects that I've used the autocomplete widget, I've found that it's been particularly useful to get it to ONLY match against the start of the strings in the "source" array.

So, for example if the user types "ad", it matches "adnams", "adkin", "adur" but doesn't match "Madeley", "Head", etc.

At the moment I can do this by editing the autocomplete Javascript so that:

var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );

becomes

var matcher = new RegExp( '^'+$.ui.autocomplete.escapeRegex(term), "i" );

I think it would probably be useful to other users of this useful widget if this were made a standard option that could be applied when creating an autocomplete widget.

Change History (2)

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

Resolution: wontfix
Status: newclosed

We don't want to build in multiple searching methods in the core of the plugin. You can accomplish this by passing a custom function as the source option. Alternatively, you can create an extension to adds this option.

comment:2 Changed 7 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.