Page MenuHomeGitPull.it

class JX.Tokenizer
Javelin Documentation ()

A tokenizer is a UI component similar to a text input, except that it allows the user to input a list of items ("tokens"), generally from a fixed set of results. A familiar example of this UI is the "To:" field of most email clients, where the control autocompletes addresses from the user's address book.

JX.Tokenizer is built on top of JX.Typeahead, and primarily adds the ability to choose multiple items.

To build a JX.Tokenizer, you need to do four things:

  1. Construct it, padding a DOM node for it to attach to. See the constructor for more information.
  2. Build a JX.Typeahead and configure it with setTypeahead().
  3. Configure any special options you want.
  4. Call start().

If you do this correctly, the input should suggest items and enter them as tokens as the user types.

When the tokenizer is focused, the CSS class jx-tokenizer-container-focused is added to the container node.

Tasks

Builtin Events

  • invoke(type, more) — Invoke a class event, notifying all listeners. You must declare the events your class invokes when you install it; see @{function:JX.install} for documentation. Any arguments you provide will be passed to listener callbacks.
  • static listen(type, callback) — Static listen interface for listening to events produced by any instance of this class. See @{method:listen} for documentation.

Other Methods

Methods

invoke(type, more)
Inherited

JX.Base

Invoke a class event, notifying all listeners. You must declare the events your class invokes when you install it; see JX.install() for documentation. Any arguments you provide will be passed to listener callbacks.

Parameters
stringtypeEvent type, must be declared when class is installed.
...moreZero or more arguments.
Return
JX.EventEvent object which was dispatched.

static listen(type, callback)
Inherited

JX.Base

Listen for events emitted by this object instance. You can also use the static flavor of this method to listen to events emitted by any instance of this object.

See also listen() in JX.Stratcom.

JX.Base

Static listen interface for listening to events produced by any instance of this class. See listen() for documentation.

Parameters
stringtypeType of event to listen for.
functioncallbackFunction to call when this event occurs.
Return
objectA reference to the installed listener. You can later remove the listener by calling this object's remove() method.

construct(containerNode)

This method is not documented.
Parameters
containerNode

Emitted when the value of the tokenizer changes, similar to an 'onchange' from a <select />.

This method is not documented.
Parameters
map

setTypeahead(typeahead)

This method is not documented.
Parameters
typeahead
This method is not documented.
This method is not documented.
Parameters
e
This method is not documented.

private _redraw(force)

This method is not documented.
Parameters
force
This method is not documented.
Parameters
string

addToken(key, value)

This method is not documented.
Parameters
key
value
This method is not documented.
Parameters
key

buildInput(value)

This method is not documented.
Parameters
value

buildToken(key, value)

Generate a token based on a key and value. The "token" and "remove" sigils are observed by a listener in start().

Parameters
key
value
This method is not documented.

private _onkeydown(e)

This method is not documented.
Parameters
e

private _remove(index, focus)

This method is not documented.
Parameters
index
focus

private _didChangeValue()

This method is not documented.
This method is not documented.
This method is not documented.

private _didfocus()

This method is not documented.

private _didblur()

This method is not documented.

private _onbrowse(e)

This method is not documented.
Parameters
e