It is possible to add a data property on the autocomplete renderItem function.
It will enable us to do the create rich templates with custom renderItem function.
Currently the renderItem receives these parameters from autocomplete-class.js (448 & 480):
valuesHTML += ac.renderItem({
value: itemValue,
text: typeof items[i] === 'object' ? items[i][ac.params.textProperty] : items[i],
inputType: ac.inputType,
id: ac.id,
inputName: ac.inputName,
selected: selected
}, i);
If data property is added then it can look like this:
valuesHTML += ac.renderItem({
value: itemValue,
text: typeof items[i] === 'object' ? items[i][ac.params.textProperty] : items[i],
inputType: ac.inputType,
id: ac.id,
inputName: ac.inputName,
selected: selected,
data: items[i] <--
}, i);
Then the renderItem function will have access to the whole object and any other custom properties that we can pass via source property render(result), ie:
source(query, render) {
const results = ...
// properties on items in the array passed here will be received in the custom render template
render(results);
},