I am trying to get a FeatureTable to display with alternating row backgrounds to make it easier to read, and the Vaadin Grid row-stripes theme seems like the best way of doing it. The problem is there does not seem to be any way to set the theme from the FeatureTable API, and there does not seem to be any API event signalling that the grid has been added to the DOM. Is there a better way of doing it than the kludge I came up with?
const observer = new MutationObserver(function(mutationList) {
for (const mutation of mutationList) {
for (const node of mutation.addedNodes) {
if (node.localName === 'vaadin-grid') {
node.setAttribute('theme', node.getAttribute('theme') + ' row-stripes');
observer.disconnect();
return;
}
}
}
});
observer.observe(document.getElementById('featureTableContainer'), {
childList: true,
subtree: true
});