Class: SearchMenuAPI

searchmenu.SearchMenuAPI()

new SearchMenuAPI()

Search Menu UI API

Source:

Methods

addElementCreatedHandler(listener)

Adds another listener, that will be called, when a new HTML element was created.

Parameters:
Name Type Description
listener module:searchmenu.ElementCreatedListener
Source:
Returns:

module:searchmenu.SearchMenuAPI

addFocusStyleClassOnEveryCreatedElement(focusStyleClassNameopt)

Adds the given style class when an element receives focus. This is done for every element that is created dynamically (e.g. search results and filters). It is only meant to be used for browsers like old IE5 ones that doesn't support focus pseudo style class.

Parameters:
Name Type Attributes Default Description
focusStyleClassName String <optional>
"focus"
Source:
Returns:

module:searchmenu.SearchMenuAPI

addPredefinedParametersTo(adder)

Defines the function, that adds predefined (fixed, constant, environmental) search parameters to the first parameter object.

Parameters:
Name Type Description
adder module:searchmenu.SearchParameterAdder

function that will be called to before search is triggered.

Source:
Returns:

module:searchmenu.SearchMenuAPI

dataConverter(converter)

Defines the converter, that converts search result data to search ui data. Without setting a data converter, data is taken directly from the backend service, that needs to provide the results in the search menu data structure.

Parameters:
Name Type Description
converter module:searchmenu.DataConverter

function that will be called to create the search menu data structure

Source:
Returns:

module:searchmenu.SearchMenuAPI

detailView(view)

Sets the view, that is used to display details of a selected search result.
The default view settings can be found here.

Parameters:
Name Type Description
view module:searchmenu.SearchViewDescription

connects the part of the search menu, that displays details of a selected search result

Source:
See:
Returns:

module:searchmenu.SearchMenuAPI

filterOptionsView(view)

Sets the view, that is used to display currently selected filter options.
The default view settings can be found here.

Parameters:
Name Type Description
view module:searchmenu.SearchViewDescription

connects the part of the search menu, that displays currently selected filter options

Source:
See:
Returns:

module:searchmenu.SearchMenuAPI

filtersView(view)

Sets the view, that is used to display search results, that represent filter options.
The default view settings can be found here.

Parameters:
Name Type Description
view module:searchmenu.SearchViewDescription

connects the part of the search menu, that displays search results, that represent filter options

Source:
See:
Returns:

module:searchmenu.SearchMenuAPI

inputElementId(idopt)

Sets the input search text element ID,.

Parameters:
Name Type Attributes Default Description
id String <optional>
"searchinputtext"

id of the input element, that contains the search text.

Source:
Returns:

module:searchmenu.SearchMenuAPI

resultsView(view)

Sets the view, that is used to display all search results.
The default view settings can be found here.

Parameters:
Name Type Description
view module:searchmenu.SearchViewDescription

connects the part of the search menu, that displays all search results

Source:
See:
Returns:

module:searchmenu.SearchMenuAPI

searchAreaElementId(idopt)

Sets the element ID of the parent, that represents the whole search menu component.

Parameters:
Name Type Attributes Default Description
id String <optional>
"searcharea"

id of the parent element, that represents the whole search menu component.

Source:
Returns:

module:searchmenu.SearchMenuAPI

searchService(service)

Defines the search service function, that will be called whenever search is triggered.

Parameters:
Name Type Description
service module:searchmenu.SearchService

function that will be called to trigger search (backend).

Source:
Returns:

module:searchmenu.SearchMenuAPI

searchTextParameterName(valueopt)

Sets the name of the backend search service parameter, that contains the input search text.

Parameters:
Name Type Attributes Default Description
value String <optional>
"searchtext"

name of the parameter, that contains the input search text and that can be used as a variable inside the url or body template for the backend service

Source:
Returns:

module:searchmenu.SearchMenuAPI

setElementCreatedHandler(listener)

Sets the listener, that will be called, when a new HTML element was created.

Parameters:
Name Type Description
listener module:searchmenu.ElementCreatedListener
Source:
Returns:

module:searchmenu.SearchMenuAPI

start()

Finishes the configuration and creates the module:searchmenu.SearchMenuUI.

Source:
Returns:

module:searchmenu.SearchMenuUI

templateResolver(resolver)

Defines the template resolver, that replaces variables in double curly brackets with the property values of the given object.

Parameters:
Name Type Description
resolver module:searchmenu.TemplateResolver

function that will be called to resolve strings with variables.

Source:
Returns:

module:searchmenu.SearchMenuAPI

waitBeforeClose(msopt)

Sets the time the search menu will remain open, when it has lost focus. Prevents the menu to disappear while using it.

Parameters:
Name Type Attributes Default Description
ms number <optional>
700

time in milliseconds the search menu will remain open until it is closed after loosing focus.

Source:
Returns:

module:searchmenu.SearchMenuAPI

waitBeforeMouseOver(msopt)

Sets the time to wait before search result details are opened on mouse over. Doesn't affect keyboard selection, which will immediately open the search details. Prevents details to open on search results, that are only touched by the mouse pointer for a short period of time.

Parameters:
Name Type Attributes Default Description
ms number <optional>
700

time in milliseconds to wait before search result details are opened on mouse over.

Source:
Returns:

module:searchmenu.SearchMenuAPI

waitBeforeSearch(msopt)

Sets the time to wait before the search service is called. Prevents calls to the search backend while changing the search input.

Parameters:
Name Type Attributes Default Description
ms number <optional>
500

time in milliseconds to wait before the search service is called

Source:
Returns:

module:searchmenu.SearchMenuAPI

(protected, static) defaultDetailView() → {module:searchmenu.SearchViewDescription}

Contains the default settings for the details view.

  • viewElementId = "searchdetails"
  • listParentElementId = "searchdetailentries"
  • listEntryElementIdPrefix = "detail"
  • listEntryTextTemplate = "<b>{{displayName}}:</b> {{value}}"
Source:
Returns:

default settings for the details view

Type
module:searchmenu.SearchViewDescription

(protected, static) defaultFilterOptionsView() → {module:searchmenu.SearchViewDescription}

Contains the default settings for the filter options view.

  • viewElementId = "searchfilteroptions"
  • listParentElementId = "searchfilteroptionentries"
  • listEntryElementIdPrefix = "filter"
  • listEntryTextTemplate = "{{value}}"
  • listEntrySummaryTemplate = "{{summaries[0].value}}"
  • isSelectableFilterOption = true
Source:
Returns:

default settings for the filter options view

Type
module:searchmenu.SearchViewDescription

(protected, static) defaultFiltersView() → {module:searchmenu.SearchViewDescription}

Contains the default settings for the filters view.

  • viewElementId = "searchresults"
  • listParentElementId = "searchfilters"
  • listEntryElementIdPrefix = "filter"
  • isSelectableFilterOption = true
Source:
Returns:

default settings for the filters view

Type
module:searchmenu.SearchViewDescription

(protected, static) defaultResultsView() → {module:searchmenu.SearchViewDescription}

Contains the default settings for the results view.

  • viewElementId = "searchresults"
  • listParentElementId = "searchmatches"
  • listEntryElementIdPrefix = "result"
  • listEntryTextTemplate = "{{abbreviation}} {{displayName}}"
  • listEntrySummaryTemplate = "{{summaries[0].abbreviation}} <b>{{summaries[1].value}}</b><br>{{summaries[2].value}}: {{summaries[0].value}}"
Source:
Returns:

default settings for the results view

Type
module:searchmenu.SearchViewDescription