[OpenLayers-Users] new attributes (i.e. this.whatever)
dissappearing for WFS subclass
crschmidt at metacarta.com
Tue May 15 01:27:11 EDT 2007
On Mon, May 14, 2007 at 10:09:27PM -0700, mfrumin wrote:
> check out:
> in my subclass'd processXMLNode method, I pull some app-specific fields out
> of the return of the WFS request. clearly it 'works' because the data is
> used to generate the Icon that has the pictures.
> but why, in later functions such as createPopup, are this.data and this.pic
> undefined (see the alert()'s when u click on an icon/picture)? I am
> directly assigning this.pic in the processXMLNode function, and it doesn't
> stick. and this.data is used all over the place in the superclasses, why
> can't I see it?
You are misusing the 'register' call: You want the second argument to
'register' in your createMarker call to be 'this'. The second argument
is the object which will be bound as 'this' -- you want to bind it to
the feature (which has the 'this.pic' property set on it), rather than
to the marker, which doesn't have any of your custom properties set. (if
you need the marker, you can then do 'this.marker' inside createPopup.
More information about the Users