I am trying to dynamically update my HTML component based on the content stored for each item in the data collection.
My code almost work but still cant manage to make it happen and display the final widget form. Maybe am I missing something, could someone help ?
Here is the page code :
$w.onReady(() => {
const currentItem = $w(“#dynamicDataset”).getCurrentItem();
$w(‘#text352’).text = currentItem.html;
$w(“#dynamicDataset”).onReady(() => {
const currentItem = $w(“#dynamicDataset”).getCurrentItem();
if (currentItem && currentItem.html) {
// Envoie le contenu HTML à l’élément HTML via postMessage
$w(“#htmlComponent”).postMessage({ htmlContent: currentItem.html });
console.log(“Message envoyé avec le contenu HTML.”);
} else {
console.warn(“Contenu HTML non trouvé dans l’item courant.”);
}
});
});
Here is the HTML component code :
Example 2 :
For now, I just have this display “[object Object]”