Class wink.ux.Search
The Search object allows you to process searches in an HTML document and browse search results. To instantiate the search component, you need to provide the DOM node where the search should be performed, the results classname and a classname for the selected results
- Defined in: search.js
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
wink.ux.Search(properties)
|
| Compatibility list | Supported platforms / browsers |
|---|---|
|
iOS2, iOS3, iOS4, iOS5, iOS6, Android 1.1, Android 1.5, Android 2.1, Android 2.2, Android 2.3, Android 3.0, Android 3.1, Android 4.0, BlackBerry 6, BlackBerry 7, Bada 1.0, Windows Phone 7.5, Windows Phone 8
|
Method Summary
Class Detail
wink.ux.Search(properties)
var searchProperties =
{
textNode: wink.byId("moveable"),
resultClassName: "surligne",
resultSelectClassName: "surligneSelect"
}
search = new wink.ux.Search(searchProperties);
- Parameters:
- {object} properties
- The properties object
- {HTMLElement} properties.textNode
- DOM node containing the text to search in
- {string} properties.resultClassName
- CSS class to apply to search results. This class has to be defined by the developer
- {string} properties.resultSelectClassName
- CSS class to apply to the currently selected search result. This class has to be defined by the developer
- See:
- Test page
Field Detail
{integer}
currentResult
Index of the currently selected result (from 1 to totalResults)
{integer}
totalResults
Number of search results
{integer}
uId
Unique identifier
Method Detail
-
{HTMLElement} next()Selects next result
- Returns:
- {HTMLElement} the current result SPAN node or null
-
{HTMLElement} previous()Selects previous result
- Returns:
- {HTMLElement} the current result SPAN node or null
-
reset()Resets the considered HTML node (replaces its content by the original content)
-
{HTMLElement} search(s)processes a search in the considered HTML node. Applies the adequate CSS class to results (by encapsulating each result in a SPAN node) and selects first result Number of search results and current result index can be accessed through totalResults and currentResult public attributes
- Parameters:
- {string} s
- The text to search in textNode
- Returns:
- {HTMLElement} the first result SPAN node or null