Search

App.Search. Search

The App.Search module handles search.

Note:This search module is superseded by App.searchV2

Constructor

See:

Note:This search module is superseded by App.searchV2

Parameters:
Name Type Description
options object

Search options

configRef string

Reference to search config, e.g. tvc:search:helium/MySearch.xml

$element jquery

Element

Methods

clear()

Clear any previous search result

close()

Internal function for closing the search dialog

doSearch(force)

Performs the call to search side to perform the search. This is done only if the criteria has been modified and there actually is one.

Parameters:
Name Type Description
force boolean

Forces a search to occur regardless of criteria has changed etc.

init()

Initialize search.

initEvents()

Initialize events.

isOpen() → {boolean}

Is search open?

Returns:

True is search open/visible

Type
boolean

off(event, handler)

Parameters:
Name Type Description
event
handler

on()

Events

onClickSearchHit(hit)

Default behavior when clicking search result.

Parameters:
Name Type Description
hit element

Search hit DOM element

onKeyDown(event)

Handles keydown events when typing in input field.

Parameters:
Name Type Description
event object

Event object

onKeyUp()

Handles keyup events when typing in input field.

open()

Internal function for opening the search dialog

render(data)

Renders the search result.

Parameters:
Name Type Description
data object

Data object, contains both data section and configurations

renderExceedsLimit()

Display warning that criteria matched more hits than can be displayed.

renderResultNoHits()

Displays a no result message.

renderResultWithHits(data)

Renders the search result based on data sent from server. Requires there to be search hits.

Parameters:
Name Type Description
data object

Data object, contains both data section and configurations

setState(state)

Modifies state of search. Display/hide loader etc.

Parameters:
Name Type Description
state String

State to set

setupHtml()

Builds HTML for search and attaches events.

toggle(open)

Internal function for toggling visibility of search dialog

Parameters:
Name Type Description
open boolean

True to open search, otherwise it closes