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.<div>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.</div>
<div>I post some code:</div><div><br></div><div><div><i>var featureStore = new GeoExt.data.FeatureStore({</i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>        </i></span><i> fields: [</i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>        </i></span><i> {name: "name", type: "string"}</i></div>
<div><span class="Apple-tab-span" style="white-space:pre"><i>        </i></span><i> ],</i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>        </i></span><i> layer: map.getLayersByName('Sites')[0],</i></div>
<div><i> featureFilter : new OpenLayers.Filter.Spatial({</i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>                </i></span><i>type : OpenLayers.Filter.Spatial.BBOX,</i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>                </i></span><i>value : map.getExtent()</i></div>
<div><i>});</i></div><div><i>var gridFeature = new Ext.grid.GridPanel({</i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>                </i></span><i>store: featureStore,</i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>                </i></span><i>sm: new GeoExt.grid.FeatureSelectionModel(),</i></div>
<div><span class="Apple-tab-span" style="white-space:pre"><i>                </i></span><i>cm: new Ext.grid.ColumnModel([{header:'Name',dataIndex: "name",id:'name'}]),</i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>                </i></span><i>autoExpandColumn : 'name'</i></div>
<div><i>});</i></div><div><i><br></i></div><div>Then I wrote:</div><div><i>map.events.register('zoomend',this, function(){</i></div><div><i> featureStore.reload();</i></div><div><i>});</i></div><div><i><br>
</i></div><div>But in this way I get the this.proxy is null error from ext.js</div><div>I've also tried to re-bind the layer:</div><meta charset="utf-8"><div><i>map.events.register('zoomend',this, function(){</i> </div>
<div> <i> featureStore.unbind();</i></div><div><i> featureStore.bind(map.getLayersByName('Sites')[0]);</i></div><div><i>});</i></div><div> But I get record is undefined error from ext.js</div><div><br></div>
<div>
For both I still have all the features displayed in the grid.</div><div>Maybe I should destroy and recreate the entire gridPanel but is not the right way to do that for me.</div><div>Can you help me?</div><div>Thanks</div>
-- <br>Simone Dalmasso<br>
</div>