Data Binding

The data map for the Bootstrap Buttons component is listed below. The component expects these field names in its data configuration.

Properties

const users = [
    { id: "bsimmons", label: "Ben Simmons", selected: false },
    { id: "jembiid", label: "Joel Embiid", selected: false }
]

const buttons = new wire.bsButtons().render("#buttons", {
    data: users
});

Datamap

Use the datamap configuration property to bind a data structure to the component that does not have the same field names.

const users = [
    { user: "bsimmons", name: "Ben Simmons" },
    { user: "jembiid", name: "Joel Embiid" },
]

const buttons = new wire.bsButtons().render("#buttons", {
    data: users,
    datamap: { id: "user", label: "name" }
});

Last updated