Skip to content
Harold.Luo edited this page May 4, 2013 · 27 revisions

Base usage

$('.atwho-inputor').atwho({
  at: "@",
  data: ["one", "two", "three"],
}).atwho({
  at: ":",
  data: ["+1", "-1", "smile"]
});

Settings

Here are default settings:

$('.atwho-inputor').atwho({
    // key char for observing such as `@`
    at: void 0,
    /*
        alias name of `at`
        it would be a id attribute of the popup view.
    */
    alias: void 0,
    /*
         should be a plain object *Array* or a *URL*
         would save *Array* directly.
         would load and save remote JSON data by *URL*
     */
    data: null,
    /*
         DEFAULT_TPL = "<li data-value='${name}'>${name}</li>";
         would eval it and assign value of the key contained by `${}`
         key-value ( {'name': "one"} ) is an item in `data` Array.
    */
    tpl: DEFAULT_TPL,
    /*
        There are serval data processers can be override in here such as `filter`
        we will cover it later.
    */
    callbacks: DEFAULT_CALLBACKS,
    /*
        would matching item by test against the value of this `search_key` with query string.
    */
    search_key: "name",
    /*
        limit items to show in popup list.
    */
    limit: 5,
    /*
        setting the max length of the string after `at` would be matched
        It will stop matching if the query string is lonager than `max_len`.
    */
    max_len: 20,
    /*
        display `at` or not.
        if it is set to false. `at` would not be inserted into inputor.
    */
    display_flag: true,
    display_timeout: 300
});