Closed DeanDavis closed 8 years ago
I hadn't considered that scenario. I'm checking for a completely empty locations dataset to avoid other issues, so I think I'd prefer to handle this by setting up the data like:
[{"result":"none"}]
Then in the plugin if you search for the "Handle no results" comment the conditional could be changed to:
if (_this.isEmptyObject(locationset) || locationset[0].result === 'none') {
I think I'll include that in the next version.
The above has been implemented in v2.7.0
is it possible to move the map to the searched location when there are no results, instead of resetting to the default?
I've set up so that the plugin calls my API service to get results. My API returns JSON data of locations within 50 miles of the location typed into the search bar. Sometime there are no location within the 50 mile radius. What do I return in my API back to the plugin to let it know this? If I return and empty array "[]" the plugin stalls and I get stack errors in the console. Same if I return "[{}]". I've tried returning empty "" and "{}". I can figure out how to make the plugin show the "No results" message and clear the previous results returning the map to it's default state.