Class: SearchWidget

SearchWidget()

Search Widget is an SData-enabled search component that List uses by default for search. The search widget is a dijit Widget with all the Widget aspects. It supports two types of shortcuts: 1\. `#text` - The key `text` will be replaced with the matching expression. This is a "hashtag". 2\. `#!Name eq 'John'` - The `Name eq 'John'` will be inserted directly, avoiding formatSearchQuery. This is a "custom expression". Multiple hashtags is supported as well as hashtags with additional text that gets sent through formatSearchQuery. To go through a full example, take this expression: `#open #urgent Bob` `#open` is replaced with: `TicketStatus eq 1` `#urgent` is replaced with: `TicketUrgency gt 3` `Bob` is passed to `formatSearchQuery` which returns `TicketId eq ("Bob") or TicketOwner like "Bob" The final result is "anded" together, resulting in this final where clause: `where=(TicketStatus eq 1) and (TicketUrgency gt 3) and (TicketId eq ("Bob") or TicketOwner like "Bob") See the [Defining Hash Tags guide](#!/guides/v2_beyond_the_guide_defining_hashtags) for more information and how it supports localization.

Constructor

new SearchWidget()

Source:

Members

(static) attributeMap

Provides a setter for HTML node attributes, namely the value for search text
Properties:
Type Description
Object
Source:

(static) customSearchRE

Properties:
Name Type Description
The RegExp regular expression used to determine if a search query is a custom search expression. A custom search expression is not processed, and directly passed to SData.
Source:

(static) hashTagSearchRE :RegExp

The regular expression used to determine if a search query is a hash tag search.
Type:
  • RegExp
Source:

(static) widgetTemplate

Simple that defines the HTML Markup
Properties:
Type Description
Simplate
Source:

hashTagQueries

Properties:
Name Type Description
Array Array.<Object> of hash tag definitions
Source:

queryNode

Dojo attach point to the search input
Source:

searchText

Text that is used when no value is in the search box - "placeholder" text.
Properties:
Type Description
String
Source:

Methods

_onClearClick()

Deprecated:
  • Yes
Source:

_onKeyPress(evt)

Detects the enter/return key and fires search
Parameters:
Name Type Description
evt Event Key press event
Source:

clear()

Sets search text to empty and removes active styling
Source:

configure(options)

Configure allows the controller List view to overwrite properties as the passed object will be mixed in.
Parameters:
Name Type Description
options Object Properties to be mixed into Search Widget
Source:

customSearch(query) → {String}

Returns an unmodified search query which allows a user to type in their own where clause
Parameters:
Name Type Description
query String Value of search box
Source:
Returns:
query Unformatted query
Type
String

expandExpression(expression) → {String}

Expands the passed expression if it is a function.
Parameters:
Name Type Description
expression String/Function Returns string directly, if function it is called and the result returned.
Source:
Returns:
String expression.
Type
String

getFormattedSearchQuery()

Gets the current search expression as a formatted query. * Gathers the inputted search text * Determines if its a custom expression, hash tag, or normal search
Source:

getSearchExpression()

Gets the current search expression. * Gathers the inputted search text
Source:

hashTagSearch(query) → {String}

Returns the search query based on a hash selector Any hash tags in the search are replaced by predefined search statements Remaining text not preceded by a hash will receive that views normal search formatting
Parameters:
Name Type Description
query String Value of search box
Source:
Returns:
query Hash resolved query
Type
String

onSearchExpression(expression, widget)

The event that fires when the search widget provides a search query. Listened to by the controlling List View
Parameters:
Name Type Description
expression
widget
Source:
This function is invoked from the search button and it: * Gathers the inputted search text * Determines if its a custom expression, hash tag, or normal search * Calls the appropriate handler * Fires the onSearchExpression event which listens to.
Source: