Skip to main content

Search and Top Navigation

#9651 closed feature (plugin)

Opened November 05, 2013 09:06PM UTC

Closed November 05, 2013 10:04PM UTC

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.

Attachments (0)
Change History (2)

Changed November 05, 2013 09:09PM UTC by Javadocs comment:1

Wrong component selected. Should be ui.autocomplete.

Changed November 05, 2013 10:04PM UTC by tj.vantoll comment:2

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/