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 monitor such as `@`
    at: void 0,
    // alias name of `at`
    alias: void 0,
    /*
         should be a plain object *Array* or a *URL*
         would save *Array* directly.
         would load and then save remote JSON data by *URL*
     */
    data: null,
    /*
         DEFAULT_TPL = "<li data-value='${name}'>${name}</li>";
         would eval this tpl and assign value to key that are contained by `${}`
         key-value is a item in `data` Array.
    */
    tpl: DEFAULT_TPL,
    /*
        There are serval data processer can be override in here such as `filter`
        we will cover it later.
    */
    callbacks: DEFAULT_CALLBACKS,
    /*
        would filter by the value of this `search_key`
    */
    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's will stop matching if the query string is lonager than `max_len`.
    */
    max_len: 20,
    /*
        display `at` or not.
        if it is set to be false. `at` would not be inserter into inputor.
    */
    display_flag: true,
    display_timeout: 300
});