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: [email protected]
[mailto:[email protected]] Im Auftrag von João
Rodrigues
Gesendet: Donnerstag, 21. August 2014 12:14
An: [email protected]
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
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users