Hi there, I have a search button and when it is clicked i would like it to refresh the map box so that it only shows the ‘hikes’ that appear in the search.
Just so people know, i am not using HTML Map but simply the built in Google Map Box Connected to a dataset in wix.
@russian-dima This may not work because if i refreshed the dataset it would clear the search terms.
import wixData from 'wix-data';
export function searchbutton_click(event) {
search();
}
function search() {
wixData.query("Recipes")
.contains("title", String($w("#iTitle").value))
.and(wixData.query("Recipes").contains("state1", String($w("#brandDropdown").value)))
.and(wixData.query("Recipes").contains("level", String($w("#categoryDropdown").value)))
//--------- COPY AND PASTE FROM THE .and() TO THE NEXT LINE TO ADD CODE FOR MORE DROPDOWN
.find()
.then(results => {
$w("#articlesList").data = results.items;
});
}
export function resetButton_click_1(event) {
$w("#dynamicDataset").setFilter(wixData.filter())
$w("#iTitle").value = undefined;
$w("#brandDropdown").value = undefined;
$w("#categoryDropdown").value = undefined;
}
Thats the code for my search areas
@welchjoshua818
Your question was…
Hi there, I have a search button and when it is clicked i would like it to refresh the map box so that it only shows the 'hikes ’ that appear in the search .
Just so people know, i am not using HTML Map but simply the built in Google Map Box Connected to a dataset in wix .
- Will work!
- Will → NOT ← work!
- Reason!
Do not forget → the PINs on your map are directly CONNECTED to the → DATASET!
Wix-Data will NOT help you in this case!
Your only ways, would be either to generate an UPDATE-FUNCTION, which would REWRITE your DATA inside your DATABASE, or you go the → DATASET-WAY → using → setFieldValues() + save() + refresh()
I ALWAYS say → NEVER mix Dataset-Setup with Wix-Data.
In 90% it will driving you crazy!