Opened 6 years ago

Closed 6 years ago

#9651 closed feature (plugin)

New option to set limit on items displayed

Reported by: Javadocs Owned by:
Priority: minor Milestone: none
Component: ui.core Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:

Description

I have a few applications that use jQuery UI's autocomplete, but some of those fields have around 20-200 entries for autocomplete (people's names, for example).

For example, if I search for 'Jo', and there are 100 items that start with 'Jo', there's no way to limit the number of auto complete results so that it stop after displaying X number of items.

My request is to see if there could be an option when the autocomplete is initialized to set a maximum number of items displayed.

$jQueryObject.autocomplete({
    source: data, //some valid data source that has a lot of autocomplete items
    maxItems: 10
});

The resulting autocomplete would only display 10 items, even if there are 30 items for a particular string. It will stop producing autocomplete rows after the 10th item.

Change History (2)

comment:1 Changed 6 years ago by Javadocs

Wrong component selected. Should be ui.autocomplete.

comment:2 Changed 6 years ago by tj.vantoll

Resolution: plugin
Status: newclosed

This isn't something we're going to place in the core file, but you can easily write this as an extension.

See our autocomplete extension docs - http://api.jqueryui.com/autocomplete/#extension-points Here's an example implementation - http://jsfiddle.net/tj_vantoll/XCMer/

Note: See TracTickets for help on using tickets.