This class represents a UI widget that provides access to the Places API search functionality. The class allows a Web site user to search for places (locations) and view the results. It offers suggestions when the user begins to type a search term, handles the search itself and displays the results in a designated element on a Web page.
abortRequest
()
|
This method aborts the current suggestion and search request. |
| This method hides a suggestion list. | |
navigateList
(direction)
|
This method navigates suggestion list using parameter (positive 'up', negative 'down'). |
search
()
|
This method runs a search, using the current value in the widget's input field. |
select
(term)
|
This method sets the provided term into the input field. |
setCurrentLocation
(location)
|
This method sets the current geographical position in terms of latitude and longitude. |
| This method shows a suggestion list. | |
suggest
()
|
This method runs a suggestion search, using current value in the input field, and causes the results to be displayed as a list of suggestions. |
This class represents a UI widget that provides access to the Places API search functionality. The class allows a Web site user to search for places (locations) and view the results. It offers suggestions when the user begins to type a search term, handles the search itself and displays the results in a designated element on a Web page.
params
searchCenter - a caller-defined function that retrieves an object containing
the geographical coordinates of the search center (searches are conducted in widening circles
around this location and the results are ordered by relevance to the search criteria); if provided,
useGeoLocation is ignored; the function is expected to return an object with the
following properties:
latitude - latitude of the center point for the search
longitude - latitude of the center point for the search
useGeoLocation - {Boolean}, if true and the browser supports the W3C
Geolocation API and searchCenter is not provided, Places search tries to use the W3C
Geolocation API to get the client location and use it as the search center; if this parameter is
false and searchCenter is not provided, a global search is executed
map - an optional reference to a Nokia's Maps API map object; when specified
instead of searchCenter, SearchBox reads the location of the search
center from the map, updating it as the user pans or move the map
onResults - a caller-defined callback function to be invoked after the search
results become available; the function is invoked only if onSelect is not defined;
the function receives the results of a search based on the user-selected search term as an
array of data structures; these can be wrapped in instances of nokia.places.models.PlaceModel)
and you can then use a Place instance to retrieve place data, using the ids of the items
in the received array
onSearchStart - a caller-defined callback function to be invoked when the search is being fired
placeList - a reference to o PlaceList widget @link {nokia.places.PlaceList} if provided SearchBox widget will \
use existing place list widget to render results
suggestions - an optional object whose properties (also optional) define the
composition of the search term suggestions list displayed to the user and functions
that handle suggestions
limits - an optional object containing properties that define the composition of
the list of suggestions displayed to the user
maxSuggestions - (optional) the maximum number of suggestions to show
in the suggestions list when the user starts typing a new search term; the default
value is 4
maxSearched - (optional) maximum number of suggestions based on previous
searches to show in the suggestions list, the default value is 2
maxFavorites - (optional) maximum number of suggestions based on favorites
to show in the suggestions list, the default value is 1
maxSaved - (optional) maximum number of suggestions from local storage
(previously entered search terms) to be included in the suggestion list displayed
when the user starts typing a new search term, the default value is 3
handlers
onSuggestions - an optional caller-defined callback function to be invoked when
when suggestions are returned by the server; the function must accept an array of objects containing
the suggestions
onSearchSuggestions - an optional caller-defined calback function to be invoked when
search suggestions are returned by the server; the function must accept an array of objects
search suggestions
onSelect - an optional caller-defined function to be invoked when the Web user
selects a suggestion; the function must be able to accept two arguments: a search term ({String}),
and an object ({Object}) representing the search results; the search results object is populated with
real search results data if maxSearched is non-zero, thus allowing the search data to
appear in the displayed suggestions list; note that if provided, the onSelect function
prevents execution of onResults and thus overrides the default behavior of SearchBox
favourites - an optional function that can be defined by the caller; if provided, it returns
a list of favorites
keyInterval - an optional {Number} value that indicates how much time to allow the user to
enter suggestions (in milliseconds) before firing a request (this allows you to avoid firing a request
for each letter the user types)
showAddress - a Boolean value that indicates whether to show the street address in the
list of suggestions when maxSearched is greater than zero
abortRequest
()
navigateList
(direction)
direction
select
(term)
term
Copyright © 2011 Nokia. All rights reserved. Terms and Conditions