11 Commits

Author SHA1 Message Date
sp00n
32bcb0326a
Update README.md 2021-05-20 22:55:02 +02:00
sp00n
fb30170bc1
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);
    }
});
```
2021-05-20 22:41:03 +02:00
Evgeny Zinoviev
dbca6d0a99
Merge pull request #4 from lukasjelonek/master
Fix bug: Navigation with cursor keys does not work
2021-05-19 13:30:15 +03:00
Lukas Jelonek
3f6e558144
Fix bug: Navigation with cursor keys does not work
data toggle field changed from `data-toggle` to `data-bs-toggle`
2021-05-19 09:07:43 +02:00
Evgeny S
147d3a70ea
Merge pull request #3 from CBke/arrowdownkey
set focus to first suggestion by down arrow key
2021-04-08 01:50:43 +03:00
Evgeny S
88f0973087
Merge pull request #2 from CBke/dynamicdata
render again if data has changed
2021-04-06 15:30:28 +03:00
Christophe
67c49775fd set focus to first suggestion by down arrow key 2021-03-31 18:34:30 +02:00
Christophe
82d0321f1f render again if data has changed 2021-03-31 18:30:13 +02:00
Evgeny Zinoviev
724ee6c6f4 add example 2021-02-01 17:31:59 +03:00
Evgeny Zinoviev
adf2068ba6 fix issue #1 2021-02-01 17:31:29 +03:00
Evgeny Zinoviev
80f28167ab initial commit 2021-01-03 23:46:02 +03:00