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

Error when clearing a FeatureCollection #712

Open
geographika opened this issue Mar 23, 2022 · 0 comments
Open

Error when clearing a FeatureCollection #712

geographika opened this issue Mar 23, 2022 · 0 comments
Assignees

Comments

@geographika
Copy link
Member

I'm getting an occasional error when clearing a features collection using mySource.getFeaturesCollection().clear();

The following GeoExt code calls this.findBy:

onOlCollectionRemove: function(evt) {
var element = evt.element;
var idx = this.findBy(function(rec) {
return rec.olObject === element;
});

Then in Ext.data.AbstractStore this.getData() returns null resulting in TypeError: Cannot read properties of null (reading 'findIndexBy')

    findBy: function(fn, scope, start) {
        return this.getData().findIndexBy(fn, scope, start);
    },

The simple fix is to add a check to onOlCollectionRemove to exit if this.getData() is null, however I'll try to see why null is returned.

@geographika geographika self-assigned this Mar 24, 2022
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

1 participant