[OpenLayers-Users] How to add custom events to OpenLayers-based API?
Arnd Wippermann
arnd.wippermann at web.de
Fri Aug 22 04:59:12 PDT 2014
have you registered your event?
something like that, should do the job:
xgis.map.prototype.initialize = function(name) {
...
...
this.events = new OpenLayers.Events(this,
null,
['groupadded'],
false,
{includeXY: true});
this.events.register("groupadded", this, function (e) {
alert("group layer added");
});
};
xgis.map.prototype.addGroup = function(name) {
/* CODE FOR ADDING A GROUP */
/* Trigger when group is added */
this.events.triggerEvent('groupadded', group);
};
Regards,
Arnd
_____
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von João
Rodrigues
Gesendet: Donnerstag, 21. August 2014 12:14
An: openlayers-users at lists.osgeo.org
Betreff: [OpenLayers-Users] How to add custom events to OpenLayers-based
API?
Hi
I am woking on a GIS API built on top of OpenLayers. I have a class called
xgis.group, which represent a group of layers.
I want to add an event that can be triggered when a group is added.
For example, in the map, I have tried this without success:
xgis.map.prototype.addGroup = function(name) {
/* CODE FOR ADDING A GROUP */
/* Trigger when group is added */
this.events.triggerEvent('groupadded', group);
};
I don't know how to deal with custom-made events.
Could you lend me some help, please?
Thanks
---
Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus Schutz ist aktiv.
http://www.avast.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20140822/cd1e715a/attachment.html>
More information about the Users
mailing list