Please Can you help me?
I have a dynamic page called “sehir”. I search by city name on the “arama” page and I want the result to be shown on the map. I could not. where am I making a mistake.
See the Example: Multiple Markers Google Maps . You can load this example in your Editor to see one way to do this.
You might consider using the GoogleMap element. You can set the location on the map using the location property. You might also want to use the AddressInput element to get location details.
Thank you very much for answering in a very short time. I don’t have Google API. I have latitude and longitude information in my data set by city. How can I show the search result on the map.
Use the location property to show the location on your map.
@yisrael-wix Please, Can you check my codes,
I asked him to search the dynamic page and show it on the map. Sorry, I was not successful.
import wixData from ‘wix-data’;
export function button1_click(event) {
let searchValue = $w(‘#searchInput’).value;
wixData.query(‘sehir’)
.contains(‘ilce’, searchValue)
.find()
.then(results => {
let Results = results.items;
$w(‘#repeater1’).data = results.items;
});
}
export function repeater1_itemReady($item) {
$w(“#repeater1”).onItemReady( ($ilce,) => {
let repeatedElement = $item(“#ilce”);
});
$w.onReady( function () {
});
let myLocation = $w(“#myGoogleMap”).location;
let ilce = $w(‘#dynamicDataset’).getCurrentItem().ilce;
let latitude = $w(‘#dynamicDataset’).getCurrentItem().latitude;
let longitude = $w(‘#dynamicDataset’).getCurrentItem().longitude;
$w(“#myGoogleMap”).location = {
“latitude”: latitude,
“longitude”: longitude,
};
}