Seems that the proxy doesn't have the setFilter method.<div>Actually the strategy is an excellent solution, but I need to trigger a reload of the store on zoomend and moovend.</div><div><br></div><div>To explain I pos my new code:</div>
<div><br></div><div><div><i>var sites = new OpenLayers.Layer.Vector('Sites',{</i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>                                </i></span><i>styleMap: styleMap,</i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>                                </i></span><i>strategies: [/*new OpenLayers.Strategy.Fixed(),*/new OpenLayers.Strategy.BBOX()], </i></div>
<div><span class="Apple-tab-span" style="white-space:pre"><i>                                </i></span><i>projection: new OpenLayers.Projection("EPSG:4326"), </i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>                                </i></span><i>protocol: new OpenLayers.Protocol.WFS({ </i></div>
<div><span class="Apple-tab-span" style="white-space:pre"><i>                                        </i></span><i>version: "1.1.0", </i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>                                </i></span><i> srsName: "EPSG:4326",</i></div>
<div><span class="Apple-tab-span" style="white-space:pre"><i>                                        </i></span><i>url: '/geoserver/wfs/',</i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>                                        </i></span><i>featureType: 'name',</i></div>
<div><span class="Apple-tab-span" style="white-space:pre"><i>                                </i></span><i> featurePrefix: "prefix"</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>});<span class="Apple-tab-span" style="white-space:pre">        </span></i></div><div><br></div><div><div><i>map.events.register('zoomend',this, function(){</i></div>
<div><span class="Apple-tab-span" style="white-space:pre"><i>                </i></span><i> sites.redraw();</i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>        </i></span><i>});</i></div><div><i><br></i></div><div><div style="font-style: italic; ">
var featureStore = new GeoExt.data.FeatureStore({</div><div style="font-style: italic; "><span class="Apple-tab-span" style="white-space:pre">        </span> fields: [</div><div style="font-style: italic; "><span class="Apple-tab-span" style="white-space:pre">        </span> {name: "name", type: "string"}</div>
<div style="font-style: italic; "><span class="Apple-tab-span" style="white-space:pre">        </span> ],</div><div style="font-style: italic; "><span class="Apple-tab-span" style="white-space:pre">        </span> layer: sites</div>
<div style="font-style: italic; "><span class="Apple-tab-span" style="white-space:pre">        </span>});</div><div style="font-style: italic; "><br></div><div style="font-style: italic; ">and more...</div><div style="font-style: italic; ">
<br></div><div>With that I can't see changes in the grid.</div></div><div><br></div><div>Thanks a lot for your help.</div><div><br></div><div>Simone</div><div><br></div><div class="gmail_quote">2010/11/2 Andreas Hocevar <span dir="ltr"><<a href="mailto:ahocevar@opengeo.org">ahocevar@opengeo.org</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<br>
try the following:<br>
<br>
featureStore.proxy.setFilter(your_new_filter);<br>
featureStore.reload();<br>
<br>
But note that you could also configure your vector layer with your protocol and a BBOX strategy, and bind your featureStore to that layer by configuring the store's layer property. This will make the BBOX strategy take care of requesting features for the correct extent.<br>
<br>
Regards,<br>
Andreas.<br>
<div><div></div><div class="h5"><br>
On Nov 2, 2010, at 14:24 , Simone Dalmasso wrote:<br>
<br>
> 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.<br>
> 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.<br>
> I post some code:<br>
><br>
> var featureStore = new GeoExt.data.FeatureStore({<br>
> fields: [<br>
> {name: "name", type: "string"}<br>
> ],<br>
> layer: map.getLayersByName('Sites')[0],<br>
> featureFilter : new OpenLayers.Filter.Spatial({<br>
> type : OpenLayers.Filter.Spatial.BBOX,<br>
> value : map.getExtent()<br>
> });<br>
> var gridFeature = new Ext.grid.GridPanel({<br>
> store: featureStore,<br>
> sm: new GeoExt.grid.FeatureSelectionModel(),<br>
> cm: new Ext.grid.ColumnModel([{header:'Name',dataIndex: "name",id:'name'}]),<br>
> autoExpandColumn : 'name'<br>
> });<br>
><br>
> Then I wrote:<br>
> map.events.register('zoomend',this, function(){<br>
> featureStore.reload();<br>
> });<br>
><br>
> But in this way I get the this.proxy is null error from ext.js<br>
> I've also tried to re-bind the layer:<br>
> map.events.register('zoomend',this, function(){<br>
> featureStore.unbind();<br>
> featureStore.bind(map.getLayersByName('Sites')[0]);<br>
> });<br>
> But I get record is undefined error from ext.js<br>
><br>
> For both I still have all the features displayed in the grid.<br>
> Maybe I should destroy and recreate the entire gridPanel but is not the right way to do that for me.<br>
> Can you help me?<br>
> Thanks<br>
> --<br>
> Simone Dalmasso<br>
</div></div><div><div></div><div class="h5">> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@geoext.org">Users@geoext.org</a><br>
> <a href="http://www.geoext.org/cgi-bin/mailman/listinfo/users" target="_blank">http://www.geoext.org/cgi-bin/mailman/listinfo/users</a><br>
<br>
</div></div><font color="#888888">--<br>
Andreas Hocevar<br>
OpenGeo - <a href="http://opengeo.org/" target="_blank">http://opengeo.org/</a><br>
Expert service straight from the developers.<br>
<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Simone Dalmasso, Ing.<br>ITHACA<br>Information Technology for Humanitarian Assistance, Cooperation and Action<br><a href="http://www.ithacaweb.org">www.ithacaweb.org</a><br>
Via Pier Carlo Boggio 61 - 10138 Torino<br>Tel: +39.011.1975.1854<br>
</div></div>