-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dispatch an event when a popup is displayed #145
Comments
I was able to achieve what I needed with the following code:
Then, elsewhere I can do:
|
@mstenta glad to see you've a solution, I'd be happy to add an event, maybe |
Yea that could be helpful! I'll reopen this. Is it as straightforward as adding two lines? |
Hi, i understand the code not realy. I search for a solution to fill the Popup with content from a ajax request, without JQuery. The problem is, in this moment i must send all the content for all the popups by the first call of the website. That is too much data. I will fill the Popup on the click event with data from the server. The content for the Popup come from a xhttp request. Thats not so easy, because a xhttp request dont return a value. Where and in what place do you use this?
|
@makrolika Yes, that's where I am executing the request in my case (within the This is where we are doing it in farmOS: And in farmOS-map (which is our custom OpenLayers-based map library that is used by farmOS), we create the popup and dispatch the custom Hope that helps! |
OK, thanks, that is also a special solution for a external software named FarmOS. I will not use this software to realized my idea. Is there a default solution to realized it? I will start a new Issue for my question. |
The way we did it in farmOS is just an example you can refer to. You don't need farmOS to do something similar in your code. I assume that somewhere in your code you are running Hope that makes sense. The overall approach is simple, but you will need to figure out how it fits into your current code. |
Please read my new Issue: #217 |
@makrolika I needed |
I'd like to trigger a callback function to run when a popup is displayed using
on('popup')
(or something equivalent). Is this currently possible? Or would it be a new feature request?Perhaps the
Popup.show()
function could calldispatchEvent()
to trigger its own event?https://openlayers.org/en/latest/apidoc/module-ol_Observable-Observable.html#dispatchEvent
The text was updated successfully, but these errors were encountered: