Skip to content

FeatureStore with Proxy not working correctly with ExtJS 5 #378

@chrismayer

Description

@chrismayer

I have discovered issues which prevent a FeaturStore loading its data via Proxy correctly when using ExtJS 5, like this:

Ext.create('GeoExt.data.FeatureStore', {
    layer: vecLayer,
    fields: [
        {name: 'name', type: 'string'}
    ],
    autoLoad: true,
    proxy: Ext.create('GeoExt.data.proxy.Protocol', {
        reader: Ext.create('GeoExt.data.reader.Feature', {root: 'features'}),
        protocol: new OpenLayers.Protocol.HTTP({
            url: "../data/busstops.geojson",
            format: new OpenLayers.Format.GeoJSON({})
        })
    })
});

This can be tested with the example here, which is by the way not listed on the GeoExt 2 webpage.

I found 2 reasons for this:

1.) In https://github.com/geoext/geoext2/blob/master/src/GeoExt/data/proxy/Protocol.js#L196 we call operation.setSuccessful(); which in ExtJS 5 also calls operation.setCompleted(); and we also call the later explicitly the line before. This leeds to a double call of the operation callbacks, what ends in an empty FeatureStore. In ExtJS 4 operation.setSuccessful() did not call operation.setCompleted() so this issue did not appear.

2.) Once the data is loaded correctly one will discover that the attributes of the loaded feature(s) are not mapped correctly to the record, so the UIs (e.g. columns a grid) will remain empty. Here it seems we have to apply the attributes explicitly in case of using ExtJS 5.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions