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

FeatureStore with Proxy not working correctly with ExtJS 5 #378

Open
chrismayer opened this issue Feb 12, 2016 · 6 comments
Open

FeatureStore with Proxy not working correctly with ExtJS 5 #378

chrismayer opened this issue Feb 12, 2016 · 6 comments

Comments

@chrismayer
Copy link
Contributor

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.

@bentrm
Copy link
Member

bentrm commented Feb 26, 2016

@chrismayer, did you make this work in your application and would you be able to provide a PR?

@chrismayer
Copy link
Contributor Author

Hi @bentrm,

I recently started to fix this.
1.) isn't really a problem but 2.) is caused deep in the ExtJS 'proxy-/reader-world'. I already had a intensive look into that and could figure out that the error is related to the extractData-method of Ext-data-reader-Reader. In this method the fieldExtractorInfo remains empty which causes the wrong data mapping in our records. I am sure if we find the cause for the empty fieldExtractorInfo we can fix the problem. Would be cool if someone else could have a look on that. I will also proceed if I have free timeslots.

Shall I open a PR with the fix for 1.) which can be used a base for further commits?

@bentrm
Copy link
Member

bentrm commented Feb 26, 2016

It's a good start I guess. The whole Ext-proxy/reader stuff ©️ is a bit hard to reason about..

@bentrm
Copy link
Member

bentrm commented Feb 26, 2016

Is this in any way related to #173 and #162?

@chrismayer
Copy link
Contributor Author

I guess. At least #173 seems to be related somehow. For #162 I am not sure.

@chrismayer
Copy link
Contributor Author

I just opened a PR (#384) which fixes 1.) and can be used as base for further development.

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

No branches or pull requests

2 participants