We are using the searchStoresByParameters method to query our stores by location or tags then use mapView.set(‘stores’, stores) with the results.
So when no stores are returned by the dataSource api we are doing mapView.set(‘stores’,) and surprisingly the map will show all the stores regardless of the current filters ! It might be a feature but in our case we don’t think it makes much sense to have all stores displayed if the user search for specific stores. Is it possible to clear the map of the default stores when filters are set and there is no results for them ?
Hello @Tucsky,
Yes, it’s the default behaviour when using woosmap.TiledView.
To return the TiledView to its original display state, without any query or location marker, you should set the properties 'stores' and 'location' to null.
But, it will properly work only if you’re not applying a location bias (lat,lng) to your Search Parameter.
If you’re using a location to search nearby stores, one solution could be to set a query which returns no stores, for example:
mapView.setSearchParameters(
new woosmap.search.SearchParameters({ query: 'tag:"No_Results_Tag"' })
);
I know it is not the best we can give you. Preferably, we should support the location bias also in the tiledview setSearchParameters. I will feedback this to our product team.
Please let me know if this can be an acceptable workaround for you.
We weren’t using mapView.searchParameters at the time and that was the problem. It wasn’t so clear we had to use both set(‘stores’, …) AND setSearchParameters reading the doc