[Users] featureStore filter reload

Moataz Elmasry zaza1851983ml at googlemail.com
Tue Nov 2 14:40:27 CET 2010


maybe you can use store.filter or store.filterby and inside the filter 
function you check the coordinates of the feature againest the current 
bounding box

Regards

Simone Dalmasso wrote:
> Hi list, I have an OL vector layer with a feature store linked. The 
> output of the store is in a grid, so I have the name of the features 
> selectable.
> What I would like to do is to apply a spatial filter (BBOX) on the 
> store to have displayed in the grid only the features that are within 
> the BBOX. The update events for the store should be the 'zoomend' and 
> the 'moveend' events of the map.
> I post some code:
>
> /var featureStore = new GeoExt.data.FeatureStore({/
> / //    fields: [/
> / //        {name: "name", type: "string"}/
> / //    ],/
> / //    layer: map.getLayersByName('Sites')[0],/
> /            featureFilter : new OpenLayers.Filter.Spatial({/
> / //type : OpenLayers.Filter.Spatial.BBOX,/
> / //value : map.getExtent()/
> /});/
> /var gridFeature = new Ext.grid.GridPanel({/
> / //store: featureStore,/
> / //sm: new GeoExt.grid.FeatureSelectionModel(),/
> / //cm: new Ext.grid.ColumnModel([{header:'Name',dataIndex: 
> "name",id:'name'}]),/
> / //autoExpandColumn : 'name'/
> /});/
> /
> /
> Then I wrote:
> /map.events.register('zoomend',this, function(){/
> /            featureStore.reload();/
> /});/
> /
> /
> But in this way I get the this.proxy is null error from ext.js
> I've also tried to re-bind the layer:
> /map.events.register('zoomend',this, function(){/   
>    / featureStore.unbind();/
> /    featureStore.bind(map.getLayersByName('Sites')[0]);/
> /});/
>  But I get record is undefined error from ext.js
>
> For both I still have all the features displayed in the grid.
> Maybe I should destroy and recreate the entire gridPanel but is not 
> the right way to do that for me.
> Can you help me?
> Thanks
> -- 
> Simone Dalmasso
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>   



More information about the Users mailing list