Compartir a través de


AutoSuggestBox.onsuggestionsrequested event

Raised when the AutoSuggestBox requests suggestions.

Syntax

<div 
    data-win-control="WinJS.UI.AutoSuggestBox" 
    data-win-options="{onsuggestionsrequested : handler}">
</div>
function handler(eventInfo) { /* Your code */ }
 
// addEventListener syntax
autoSuggestBox.addEventListener("suggestionsrequested", handler);
autoSuggestBox.removeEventListener("suggestionsrequested", handler);

Event information

Synchronous No
Bubbles Yes
Cancelable Yes

 

Event handler parameters

  • eventInfo
    Type: CustomEvent**

    An object that contains information about the event. The detail property of this object contains the following sub-properties:

    • detail.language
      The IETF language tag (BCP47 standard) that identifies the language associated with the query.

    • detail.linguisticDetails
      A JavaScript object containing details about the query.

    • detail.queryText
      The query text entered into the AutoSuggestBox control.

    • detail.searchSuggestionCollection
      The collection of suggested options for the search query. The maximum length of all of the textual fields in a suggestion (such as text, detail text, and image alt text) is 512 characters.

Remarks

Note  If your data source is asynchronous, you must wrap updates to the search suggestion collection in a Promise.

 

Requirements

Minimum WinJS version

WinJS 4.0

Namespace

WinJS.UI

See also

AutoSuggestBox