geoext2
geoext2 copied to clipboard
LayerModel getLayer() in ExtJS5
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;
}
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.
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
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 ...
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.