Reputation: 2208
I want to get the element that has been clicked from the autocomplete popup.
Upvotes: 2
Views: 2167
Reputation: 2208
Found the popup selected item, from the insertMatch, by adding the insertMatch into the completor:
callback(null,
wordList.map(function (word) {
return {
caption: word,
value: word,
completer: {
insertMatch: function (editor, data) {
console.log("Item clicked: ", data.value);
editor.completer.insertMatch({value: data.name});
}
}
}
Upvotes: 5
Reputation: 345
Using @Harsha pps 's answer - I also had to add the following to get the word selected word to the editor (and remove the characters typed so far):
editor.removeWordLeft();
editor.insert(data.value);
insertMatch
might be a better solution, as suggested by @a user, but I was unable to get this working
Upvotes: 0