[Resolved] re-initialize map after search button clicked
This support ticket is created 2 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I'm not showing the map with results until after a user has set search filters and clicked search button with a php filter on "wpv_filter_query_post_process"
But in this case, the map never appears and I get some jQuery errors shown in console:
Uncaught TypeError: self.api is null
init_map hidden link
initMapOrWaitIfInsideHiddenBootstrapAccordionOrTab hidden link
init_map_after_loading_styles hidden link
jQuery 9
init_map_after_loading_styles hidden link
ViewAddonMaps hidden link
jQuery 7
reload_map hidden link
N Underscore
ViewAddonMaps hidden link
jQuery 7
manage_update_results hidden link
jQuery 41
manage_update_results hidden link
manage_changed_form hidden link
jQuery 7
get_updated_query_results hidden link
manage_changed_form hidden link
ViewParametricSearch hidden link
Do I need to initialise the map after a the search button is clicked?
Not sure what you mean by here I'm not showing the map with results until after a user has set search filters and clicked search button with a php filter on "wpv_filter_query_post_process"
Secondly does the map load normally on a fresh view and a search is performed?
But without that filter, then the map does load normally.
Take a look here: hidden link
You will see that when you set a search filter that results are generated and even a space is created where the map should display, but the map is not visible.
It's another issue, but this map is very slow. There are over 4,000 posts and it is creaking. That's one of the reasons that I'm looking at this approach, because showing the map on page load with all results is very slow. If you have any suggestions about that, then I'd also like to hear them.
Where on the view the map was added? I suspect that this was added in the [wpv-items-found] shortcode ?
There is a different way to perform this exact same query of starting without any results that makes use of our conditionals and this should get your view's map to work regardless.
Please let me know if you want to go ahead and try this.