new RemoteObjectMatcher(uri, opt_xhrIo, opt_xmlHttpFactory, opt_multi, opt_noSimilar)
This class is an alternative to goog.ui.ac.RemoteArrayMatcher. It
submits an ajax request to fetch an array of matches. The array may contain
plain strings or objects. If the matches are objects, then the objects
'should' contain a 'caption' property. If they don't, a user will see the
result of 'toString' in the suggestion list. This class fires events if the
server returned matches, the ajax request failed (i.e. server error), or the
server returned an invalid response for some reason.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
uri |
goog.Uri | The uri which generates the auto complete matches. The search term is passed to the server as the 'token' query param | |
opt_xhrIo |
goog.net.XhrIo |
<optional> |
Optional XhrIo object to use. By default we create a new instance |
opt_xmlHttpFactory |
goog.net.XmlHttpFactory |
<optional> |
Optional factory to use when creating XMLHttpRequest objects |
opt_multi |
boolean |
<optional> |
Whether to allow multiple entries |
opt_noSimilar |
boolean |
<optional> |
If true, request that the server does not do similarity matches for the input token against the dictionary The value is sent to the server as the 'use_similar' query param which is either "1" (opt_noSimilar==false) or "0" (opt_noSimilar==true) |
- Source:
Extends
- goog.events.EventTarget
Classes
Members
-
<static> CAPTION_PROPERTY :string
-
The property name of objects that contain the caption to display in the list of suggestions
Type:
- string
- Source:
-
<static> EventType :string
-
List of events dispatched by this class
Type:
- string
- Source:
Properties:
Name Type Description FAILED_REQUEST
string Event dispatched if ajax request did not succeed MATCHES
string Event dispatched when an array of matches has been returned from the server INVALID_RESPONSE
string Event dispatched if the server object was not an array -
<static> FULL_STRING_PARA :string
-
The name of the parameter that contains the entire input value, including previous tokens
Type:
- string
- Source:
-
<static> MATCHES_PROPERTY :string
-
The property name that will contain the server matches, if the server is returning additional information along the matches, for example, total available matches on the server
Type:
- string
- Source:
-
<static> MAX_MATCHES_PARA :string
-
The name of the parameter that specifies how many matches the server should return
Type:
- string
- Source:
-
<static> MULTI_TOKEN_PARA :string
-
The parameter name of the flag that specifies whether the autocomplete supports multiple tokens
Type:
- string
- Source:
-
<static> TOKEN_PARA :string
-
The name of the token parameter passed to the server
Type:
- string
- Source:
-
<static> TOTAL_PROPERTY :string
-
The property name that will contain the total count of matches available on the server
Type:
- string
- Source:
-
<static> USE_SIMILAR_PARA :string
-
The parameter name of the flag that specifies whether the server should return matches that are similar to the search token
Type:
- string
- Source:
- See:
-
- goog.ui.ac.AutoComplete for an explanation of this flag
-
<protected> uri :goog.Uri
-
Reference to the URI used to request matches
Type:
- goog.Uri
- Source:
-
<protected> xhrIo :goog.net.XhrIo
-
The class for performing ajax requests
Type:
- goog.net.XhrIo
- Source:
-
<protected> xhrIoReady :boolean
-
Boolean flag whether the request object is ready to handle another request
Type:
- boolean
- Source:
Methods
-
disposeInternal()
-
- Source:
-
getQueryData() → {goog.Uri.QueryData}
-
This function returns the query data of the request objec so that a user can modify it on the fly
- Source:
Returns:
- Type
- goog.Uri.QueryData
-
<protected> onRequestCompleted(e)
-
Callback for when the server request completed.
Parameters:
Name Type Description e
goog.events.Event - Source:
-
requestMatches(token, maxMatches, fullstring)
-
Retrieve a set of matching rows from the server via ajax
Parameters:
Name Type Description token
string The text that should be matched; passed to the server as the 'token' query param maxMatches
number The maximum number of matches requested from the server; passed as the 'max_matches' query param. The server is responsible for limiting the number of matches that are returned fullstring
string The complete text, including token - Source:
-
setRequestHeaders(headers)
-
Setter for a map of headers to add to requests.
Parameters:
Name Type Argument Description headers
Object <nullable>
Headers to send along ajax requests - Source:
-
setRequestTimeout(timeout)
-
Setter for the timeout for ajax requests
Parameters:
Name Type Description timeout
number Set to 0 for no timeout - Source:
-
setRequestType(requestType)
-
Setter for the type of request, i.e. 'GET' or 'POST'.
Parameters:
Name Type Description requestType
string The request type of the ajax request - Source: