Condividi tramite


SearchBox.createResultSuggestionImage method

[SearchBox is no longer available for use as of Windows 10. Instead, use AutoSuggestBox. ]

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

Syntax

searchBox.createResultSuggestionImage(url);

Parameters

  • url
    Type: String

    The URL of the image.

Return value

Required image argument for the SearchSuggestionCollection.appendResultSuggestion method.

Remarks

Creates the image argument for SearchSuggestionCollection.appendResultSuggestion when handling the suggestionsrequested event.

The source code for this method can be found in the WinJS library (see SearchBox.js).

Note   For Windows, this member is available starting with the WinJS 3.0 library. The WinJS 3.0 library is available via CDN, package manager, or website download but currently not through the Windows Store as a Windows Store framework package.

 

Examples

The following code snippet stems from the full Searchbox with provided suggestions example.

function suggestionsRequestedHandler(eventObject) {
  var queryText = eventObject.detail.queryText,

  if (queryText.length > 0) {
    suggestionCollection.appendResultSuggestion("Mint", "Minty Mint", null, WinJS.UI.SearchBox.createResultSuggestionImage("/images/fruits/60Mint.png"), "");
  }
}

var searchBox = document.getElementById("searchBoxId");
searchBox.addEventListener("suggestionsrequested", suggestionsRequestedHandler);

WinJS.UI.processAll();

Requirements

Minimum WinJS version

WinJS 3.0

Namespace

WinJS.UI

See also

SearchBox