Skip to content

Handling an array of objects #16788

Description

@travpeck

Would it be feasible to have the feature where you could have an array of objects like such:

[{ name="Johnny Appleseed", id="100" }, { name="Paul Bunyan", id="200" }]

And be able to show the name property in the list but also associate the id property with it once it is selected? Basically hold a reference to the record of the selected item.

Example:

var input = document.getElementById("myinput");
new Awesomplete(input, {
    list: [{ name="Johnny Appleseed", id="100" }, { name="Paul Bunyan", id="200" }],
    display: 'name'
});

input.on('awesomplete-selectcomplete', function() {
    // Ability to get the selected value, such as 'Johnny Appleseed'
    // But also get other record information (such as id)
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions