Hi Jasper,
I did try your code, it worked only for that static page but this won’t work for a dynamic page which relies on retrieving the current item on page. I’m getting SOOOO close with the below code but the current item is one behind, i.e. when I click the button I expect to console log the second item but it gives me the first item. Similarly if I click the button again I expect to console log the third item but it gives me the second item. So I feel like I am on the right track! I think it has something to do with the data not loading fast enough on the page before the item is read.
$w.onReady( function () {
$w("#dataset1").onReady( **function** () {
**let** currentItemData = $w("#dataset1").getCurrentItem().flag;
console.log(currentItemData);
$w(“#button2”).onClick( (event) => {
**let** $item = $w. at( event.context );
**let** clickedItemData = $item("#dataset1").getCurrentItem();
console.log(clickedItemData.flag);
} );
});
});
Thanks
Harmeet