Regarding the specific code, if you’re using both a dataset and wix-data
together, it might be helpful to refer to the code shared by the captain in the link. Also, just to confirm — are you using the dataset in order to swap out the apartment images (the ones placed below the highlight image) when the page is refreshed?
import wixData from 'wix-data';
//xxxxxxxxxxxxxxxxxx [USER-INTERFACE] xxxxxxxxxxxxxx
const DATASET = "myDatasetID"; // the name of your dataset, which you still did not mention in this context !!!
const DATABASE = "Properties"; // the name of your database, which is in your case --> PROPERTIES !!!
const REPEATER = "myRepeaterID"; // the name of your repeater, which you still did not mention in this context !!!
const FIELD = "mapLocation"; // the name of your field, in your case --> mapLocation !!!
//xxxxxxxxxxxxxxxxxx [USER-INTERFACE] xxxxxxxxxxxxxx
$w.onReady(()=> {console.log('PAGE-READY...');
$w(`#${DATASET}`).onReady(async()=>{console.log('DATASET READY...');
const myDataQuery = await wixData.query(DATABASE).find(); console.log('myDataQuery: ', myDataQuery);
// REPEATER-PART...
$w(`#${REPEATER}`).onItemReady(($item, itemData, idex) => {console.log('Item-Data: ', itemData);
if(itemData) {console.log('Item-Data found!');
if (itemData[FIELD]) { console.log('Location-Property found!');
const mapLocation = itemData[FIELD];
const city = mapLocation.city;
const state = mapLocation.state;
const country = mapLocation.country;
$item('#txtElemntCity').text = `${city}`;
$item('#txtElemetState').text = `${state}`;
$item('#txtElementCountry').text = `${country}`;
$item('#txtElementAlltogether').text = `${city}, ${state}, ${country}`;
} else {console.log('Location-Property NOT found!');}
} else {console.log('Item-Data is not defined or null...');}
});
});
});
Referenced from …