aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorsp00n <sp.00.n@gmx.net>2021-05-20 22:41:03 +0200
committerGitHub <noreply@github.com>2021-05-20 22:41:03 +0200
commitfb30170bc138ee2ec609927150ca8c33c378400d (patch)
tree7c7ba79ae1079d29032fa69bbaeaf210141acb78 /README.md
parentdbca6d0a995b2a66a30ace2c4e6e777411594b08 (diff)
Added the ability to set the label and value key names
You can now set the names of the `label` and `value` keys in the options. They default to `label` and `value` to not break the current behavior, but you can also set them to `null`, so that you can use a simple object instead of an array of objects, just like in bootstrap-4-autocomplete. Examples: ``` const ac = new Autocomplete(field, { data: [{name: "entry1", text: "The first entry"}, {name: "entry2", text: "The second entry"}], label: "name", value: "text", onSelectItem: ({label, value}) => { console.log("user selected:", label, value); } }); const ac = new Autocomplete(field, { data: {entry1: "The first entry", entry2: "The second entry"}, label: null, value: null, onSelectItem: ({label, value}) => { console.log("user selected:", label, value); } }); ```
Diffstat (limited to 'README.md')
0 files changed, 0 insertions, 0 deletions