August 5, 2019 at 9:36 pm #52962
I am trying to add some content via a JS API call to the listing view for each marker on our map and for the life of me I can’t locate the file that creates that content and make a change take effect.
Can you point me to the file that I should edit to add some custom content to the single marker view in the modern marker listing?
I have the free, pro and gold versions installed.
Thanks in advance for your help.August 6, 2019 at 8:14 am #52971
Thank you for getting in touch.
Can we please ask what content you are trying to add? We might be able to suggest a better approach.
If you want to use JS then you can bind to the event markerlistingupdated.wpgmza on any ancestor element, event.target refers to an instance of WPGMZA.MarkerListing in this context. You can get the marker listings element from event.target.element.
Does that help?
– PerryAugust 12, 2019 at 8:03 pm #53164
Thanks for getting back to me Perry.
I have a number that I need to display as a near real-time value (similar to an inventory count for a product) and it comes from a 3rd party API endpoint.
I don’t really want to store it since it changes regularly.
I was planning on using some custom JS to make the call, parse the response and display the number in the popout panel list and marker when it is loaded.
If you have a better idea – I’m more than happy to listen 🙂August 13, 2019 at 7:32 am #53168
That sounds perfect, you can use markerlistingupdated.wpgmza for the listing itself, for the infowindow popout you can bind to infowindowopen.wpgmza
Assuming your source data objects have some kind of ID that you need to map to our marker IDs, I would suggest perhaps using custom fields to store the remote ID so you have some kind of association there (rather than hard coding that)
The native marker ID’s are available on each list item.
If you need to work with the markers directly (eg to access their custom field data) you can do so by using WPGMZA.getMapByID to obtain a reference to your map, then you can call getMarkerByID on the map to retrieve markers. Custom field data as well as the other fields will be available to you through this marker object.
Does that help?
– PerryAugust 13, 2019 at 4:23 pm #53197
That helps a lot. Thanks!
I already have the IDs in a custom field so it’s good to know we’re on the same page.August 14, 2019 at 7:03 am #53201
You’re very welcome!
Is there anything else we can help you with?
– PerryAugust 22, 2019 at 10:53 am #53585
You must be logged in to reply to this topic.