[Users] featureStore filter reload

Simone Dalmasso simone.dalmasso at gmail.com
Tue Nov 2 14:24:18 CET 2010

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:
* **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?
Simone Dalmasso
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101102/6b73eecd/attachment.htm 

More information about the Users mailing list