WinJS.UI.AutoSuggestBox object

Enables the user to perform search queries and select suggestions.

Syntax

<div 
    data-win-control="WinJS.UI.AutoSuggestBox">
</div>
var object = new WinJS.UI.AutoSuggestBox();

Members

The AutoSuggestBox object has these types of members:

  • Constructors
  • Events
  • Methods
  • Properties

Constructors

The AutoSuggestBox object has these constructors.

Constructor Description
AutoSuggestBox

Creates a new AutoSuggestBox.

 

Events

The AutoSuggestBox object has these events.

Event Description
onquerychanged

Raised when the user or the app changes the queryText.

onquerysubmitted

Raised when the user clicks the search glyph or presses Enter.

onresultsuggestionchosen

Raised when the user selects a suggested option.

onsuggestionsrequested

Raised when the AutoSuggestBox requests suggestions.

 

Methods

The AutoSuggestBox object has these methods.

Method Description
addEventListener

Registers an event handler for the specified event.

createResultSuggestionImage

Creates the image argument for appending result suggestions when handling the onsuggestionsrequested event.

dispatchEvent

Raises an event of the specified type and with additional properties.

dispose

Releases resources held by this AutoSuggestBox. Call this method when the AutoSuggestBox is no longer needed. After calling this method, the AutoSuggestBox becomes unusable.

removeEventListener

Removes an event handler that the addEventListener method registered.

setLocalContentSuggestionSettings

Specifies whether suggestions based on local files are automatically displayed in the search pane, and defines the criteria that Windows uses to locate and filter these suggestions.

 

Properties

The AutoSuggestBox object has these properties.

Property Access type Description

chooseSuggestionOnEnter

Read/write

Gets or sets whether the first suggestion is chosen when the user presses Enter.

disabled

Read/write

Gets or sets a value that specifies whether the AutoSuggestBox is disabled. If the control is disabled, it won't receive focus.

element

Read-only

Gets the DOM element that hosts the AutoSuggestBox.

placeholderText

Read/write

Gets or sets the placeholder text for the AutoSuggestBox. This text is displayed if there is no other text in the input box.

queryText

Read/write

Gets or sets the query text for the AutoSuggestBox.

searchHistoryContext

Read/write

Gets or sets the search history context. This context is used a secondary key (the app ID is the primary key) for storing search history.

searchHistoryDisabled

Read/write

Gets or sets a value that specifies whether search history is disabled.

 

Remarks

For more info, see Guidelines for search.

Requirements

Minimum WinJS version

WinJS 4.0

Namespace

WinJS.UI