It'd be nice to be able to get the DOM item on the labelRenderer callback.
So we can apply modifications to it if we need to.
Right now I'm doing the following, but when scrolling up & down very fast it won't find the optionItem by the data-visible-index class. I guess because probably it's not yet created on the DOM.
labelRenderer: sampleLabelRenderer,
selectedLabelRenderer: sampleLabelRenderer
function sampleLabelRenderer(data) {
let prefix = '';
if (!data.isCurrentNew && !data.isNew) {
var optionItem = document.querySelector('.vscomp-option[data-visible-index="'+data.visibleIndex+'"]');
//fails to get the item
if(!optionItem){
console.error("sale...");
console.log(data.label);
return `${prefix}${data.label}`;
}
console.log("vaa...");
} else {
}
return `<span style="${styles}">${prefix}${data.label}</span>`;
}
It'd be nice to be able to get the DOM item on the
labelRenderer
callback. So we can apply modifications to it if we need to.Right now I'm doing the following, but when scrolling up & down very fast it won't find the
optionItem
by thedata-visible-index
class. I guess because probably it's not yet created on the DOM.