Zimlet JavaScript API Reference - ZmAutocomplete

Class ZmAutocomplete


This class manages auto-completion via <AutoCompleteRequest> calls to the server. Currently limited to matching against only one type among people, locations, and equipment.

Defined in: ZmAutocomplete.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
ZmAutocomplete(params)
Creates and initializes support for server-based autocomplete.
Method Summary
Method Attributes Method Name and Description
<static>  
ZmAutocomplete.acSortCompare(a, b)
Sort auto-complete list by ranking scores.
 
autocompleteMatch(str, callback, aclv, account, options, type, needItem, supportForget)
Returns a list of matching contacts for a given string.
 
expandDL(contact, offset, callback)
Expands a contact which is a DL and returns a list of its members.
 
forget(addr, callback)
Asks the server to drop an address from the ranking table.
 
Checks if the given string is a valid email.
 
Returns a string representation of the object.
Class Detail
ZmAutocomplete(params)
Creates and initializes support for server-based autocomplete.
Author: Conrad Damon.
Parameters:
params
Method Detail
<static> {int} ZmAutocomplete.acSortCompare(a, b)
Sort auto-complete list by ranking scores.
Parameters:
{ZmAutocomplete} a
the auto-complete list
{ZmAutocomplete} b
the auto-complete list
Returns:
{int} 0 if the lists match; 1 if "a" is before "b"; -1 if "b" is before "a"

autocompleteMatch(str, callback, aclv, account, options, type, needItem, supportForget)
Returns a list of matching contacts for a given string. The first name, last name, full name, first/last name, and email addresses are matched against.
Parameters:
{String} str
the string to match against
{closure} callback
the callback to run with results
{ZmAutocompleteListView} aclv
the needed to show wait msg
{ZmZimbraAccount} account
the account to fetch cached items from
{Hash} options
additional options:
{constant} type
type of result to match; default is ZmAutocomplete.AC_TYPE_CONTACT; other valid values are for location or equipment
{Boolean} needItem
if true, return a ZmItem as part of match result
{Boolean} supportForget
allow user to reset ranking for a contact (defaults to true)

expandDL(contact, offset, callback)
Expands a contact which is a DL and returns a list of its members.
Parameters:
{ZmContact} contact
DL contact
{int} offset
member to start with (in case we're paging a large DL)
{closure} callback
callback to run with results

forget(addr, callback)
Asks the server to drop an address from the ranking table.
Parameters:
{string} addr
email address
{closure} callback
callback to run after response

{Boolean} isComplete(str)
Checks if the given string is a valid email.
Parameters:
{String} str
a string
Returns:
{Boolean} true if a valid email

{String} toString()
Returns a string representation of the object.
Returns:
{String} a string representation of the object

Documentation generated by JsDoc Toolkit 2.3.0 on Tue Jun 28 2016 21:01:38 GMT-0400 (EDT)