export async function setItems ( itemsArray ) {
$w ( “#repeater1” ). data = [];
$w ( “#repeater1” ). data = itemsArray ;
$w ( “#repeater1” ). forEachItem (( $w , itemData , index ) => {
if ( itemData [ “updatedAirconPrice” ] === undefined ) {
itemData [ “updatedAirconPrice” ] = itemData [ “600012000Btu” ]
}
$w ( “#ServiceName” ). text = itemData . serviceName ;
$w ( “#ServiceRating” ). numRatings = itemData . numberOfRatings ;
$w ( “#ServiceRating” ). rating = itemData . rating ;
$w ( “#ServicePrice” ). text = itemData [ “updatedAirconPrice” ]. toString ();
$w(“#oldPrice”).hide();
$w(“#strikethroughPrice”).hide();
console . log ( "old price: " + itemData [ “oldPrice” ] + " new price: " + itemData [ “updatedAirconPrice” ]);
if ( itemData [ “oldPrice” ] > itemData [ “updatedAirconPrice” ]) {
$w ( ‘#oldPrice’ ). show ();
$w ( ‘#strikethroughPrice’ ). show ();
$w ( ‘#oldPrice’ ). text = "฿ " + itemData [ “oldPrice” ]. toString ();
}
});
}
The lines in red don’t seem to work. Rest works fine, the .show(); functions with the same elements work properly too. Any idea why?