Skip to content
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

LayerModel getLayer() in ExtJS5 #390

Open
KaiVolland opened this issue Oct 14, 2016 · 4 comments
Open

LayerModel getLayer() in ExtJS5 #390

KaiVolland opened this issue Oct 14, 2016 · 4 comments

Comments

@KaiVolland
Copy link
Contributor

The current function getLayers() function of the LayerModel does not work with ExtJS 5 as raw of Ext.data.Model is gone. My recommendation would be to replace it with data but im not sure if this fits for all current scenarios...

/**
 * Returns the {OpenLayers.Layer} layer object used in this model instance.
 *
 * @return {OpenLayers.Layer}
 */
 getLayer: function() {
     return this.raw;
 }
@bentrm
Copy link
Member

bentrm commented Oct 14, 2016

My recommendation would be to replace it with data but im not sure if this fits for all current scenarios...

It's probably the safest bet. Just had a look at getData(options) which seems to return a shallow copy and has other options that may render the layer object invalid.

@chrismayer
Copy link
Contributor

I also agree that this might be the best way to achieve the former behaviour.

@KaiVolland be sure to implement a check for ExtJS v5 before returning this.raw. Otherwise it will break in ExtJS 4

@KaiVolland
Copy link
Contributor Author

For me this.getData() didn't return the same as this.data ... this.getData() didn't return an OpenLayers.Layer. I have to have a look at it again...

I'm testing it in an complex environment so i can't say if there is some project magic changes the conditions ...

@bentrm
Copy link
Member

bentrm commented Oct 14, 2016

For me this.getData() didn't return the same as this.data ... this.getData() didn't return an OpenLayers.Layer. I have to have a look at it again...

Yes, that's what I meant. It's a shallow copy of the properties of data. this.raw || this.data or the like may be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants